Error executing template "Designs/Rapido/_parsed/ContentPage.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at S_DW_BKI.CustomModules.Extensions.PageViewExtensions.GetCanonical(PageView pageView)
   at CompiledRazorTemplates.Dynamic.RazorEngine_c98dfa8101c24978bc05f295348e9518.<RenderHeaderCanonical>b__205_0(TextWriter __razor_helper_writer) in E:\Solutions\S_DW_BKI\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8323
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_c98dfa8101c24978bc05f295348e9518.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in E:\Solutions\S_DW_BKI\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
   at CompiledRazorTemplates.Dynamic.RazorEngine_c98dfa8101c24978bc05f295348e9518.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in E:\Solutions\S_DW_BKI\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_c98dfa8101c24978bc05f295348e9518.<RenderMasterHead>b__210_0(TextWriter __razor_helper_writer) in E:\Solutions\S_DW_BKI\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8440
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_c98dfa8101c24978bc05f295348e9518.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in E:\Solutions\S_DW_BKI\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
   at CompiledRazorTemplates.Dynamic.RazorEngine_c98dfa8101c24978bc05f295348e9518.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in E:\Solutions\S_DW_BKI\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_c98dfa8101c24978bc05f295348e9518.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in E:\Solutions\S_DW_BKI\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 292
   at CompiledRazorTemplates.Dynamic.RazorEngine_c98dfa8101c24978bc05f295348e9518.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in E:\Solutions\S_DW_BKI\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_c98dfa8101c24978bc05f295348e9518.Execute() in E:\Solutions\S_DW_BKI\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8430
   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.PageViewModel> @using System.Web; @using Dynamicweb @using Dynamicweb.Frontend @using Dynamicweb.Frontend.Devices @using Dynamicweb.Extensibility @using Dynamicweb.Content @using Dynamicweb.Security @using Dynamicweb.Core @using System @using System.Web @using System.IO @using Dynamicweb.Rapido.Blocks @using System.Net @functions { BlocksPage masterPage = BlocksPage.GetBlockPage("Master"); string getFontFamily(params string[] items) { var itemParent = Pageview.AreaSettings; foreach (var item in items) { itemParent = itemParent.GetItem(item); if (itemParent == null) { return null; } } var googleFont = itemParent.GetGoogleFont("FontFamily"); if (googleFont == null) { return null; } return googleFont.Family.Replace(" ", "+"); } } @{ Block root = new Block { Id = "Root", SortId = 10, BlocksList = new List<Block> { new Block { Id = "Head", SortId = 10, SkipRenderBlocksList = true, Template = RenderMasterHead(), BlocksList = new List<Block> { new Block { Id = "HeadMetadata", SortId = 10, Template = RenderMasterMetadata(), }, new Block { Id = "HeadCss", SortId = 20, Template = RenderMasterCss(), }, new Block { Id = "HeadManifest", SortId = 30, Template = RenderMasterManifest(), } } }, new Block { Id = "Body", SortId = 20, SkipRenderBlocksList = true, Template = RenderMasterBody(), BlocksList = new List<Block> { new Block() { Id = "Master", SortId = 10, BlocksList = new List<Block> { new Block { Id = "MasterTopSnippets", SortId = 10 }, new Block { Id = "MasterMain", SortId = 20, Template = RenderMain(), SkipRenderBlocksList = true, BlocksList = new List<Block> { new Block { Id = "MasterHeader", SortId = 10, Template = RenderMasterHeader(), SkipRenderBlocksList = true }, new Block { Id = "MasterPageContent", SortId = 20, Template = RenderPageContent() } } }, new Block { Id = "MasterFooter", SortId = 30 }, new Block { Id = "MasterReferences", SortId = 40 }, new Block { Id = "MasterBottomSnippets", SortId = 50, BlocksList = new List<Block> { new Block { Id = "iOsTabletFix", SortId = 10, Template = RenderIosTabletFix() } } } } } } } } }; masterPage.Add(root); } @* 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); try { if (debug) { <!-- Component: @methodName.Replace("Render", "") --> } if(customMethod != null) { @customMethod.Invoke(this, methodParameters).ToString(); } else { MethodInfo generalMethod = methodType.GetMethod(methodName); @generalMethod.Invoke(this, methodParameters).ToString(); } } catch { try { MethodInfo generalMethod = methodType.GetMethod(methodName); @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) { <div class="u-flex u-flex--align-items-center @settings.CssClass">@settings.Label <i class="@settings.Prefix @settings.Name u-margin-left" @color></i></div> } else { <div class="u-flex u-flex--align-items-center @settings.CssClass"><i class="@settings.Prefix @settings.Name u-margin-right--lg u-w20px" @color></i>@settings.Label</div> } } } 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)) { string cleanTitle = Regex.Replace(settings.Title, "<.*?>", String.Empty); cleanTitle = cleanTitle.Replace("&nbsp;", " "); attributes.Add("title", cleanTitle); } 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.CssClass += Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower() != "linkclean" ? " u-flex--align-center" : ""; 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 alternativeImage = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("AlternativeImage")) ? Pageview.AreaSettings.GetItem("Settings").GetFile("AlternativeImage").PathUrlEncoded : "/Images/missing_image.jpg"; 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; case ImageStyle.Triangle: imageStyle = "grid__cell-img--triangle"; break; } if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle || settings.Style == ImageStyle.Triangle) { settings.ImageDefault.Crop = settings.ImageDefault.Crop == 5 ? settings.ImageDefault.Crop = 0 : settings.ImageDefault.Crop; 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 : ""; } defaultImage += "&AlternativeImage=" + alternativeImage; } 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 += "&alternativeImage=" + alternativeImage; 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 += "&alternativeImage=" + alternativeImage; 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); } if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } string setValueToFakeInput = "FileUpload.setValueToFakeInput(this)"; attributes.Add("onchange", setValueToFakeInput + (!string.IsNullOrEmpty(settings.OnChange) ? settings.OnChange : "")); attributes.Add("type", "file"); if (settings.Value != null) { 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) || settings.Link != null ) { <div class="u-full-width"> @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } @if (settings.Link != null) { <div class="u-pull--right"> @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } @Render(settings.Link) </div> } </div> } @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, Link = settings.Link, 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 (settings.Value != null) { attributes.Add("value", settings.Value); } settings.CssClass = "u-full-width " + settings.CssClass; if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 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) || settings.Link != null ) { <div class="u-full-width"> @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } @if (settings.Link != null) { settings.Link.ButtonLayout = ButtonLayout.LinkClean; <div class="u-pull--right"> @Render(settings.Link) </div> } </div> } @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) || settings.Link != null ) { <div class="u-full-width"> @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } @if (settings.Link != null) { <div class="u-pull--right"> @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } @Render(settings.Link) </div> } </div> } @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 { <div class="form__field-combi u-no-margin dw-mod"> <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> </div> } @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); if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } <div class="form__field-group @settings.WrapperCssClass dw-mod"> @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) { <div class="u-full-width"> @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } @if (settings.Link != null) { <div class="u-pull--right"> @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } @Render(settings.Link) </div> } </div> } @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 (settings.Value != null) { 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*/ if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } attributes.Add("type", "checkbox"); if (settings.Checked) { attributes.Add("checked", "true"); } settings.CssClass = "form__control " + settings.CssClass; if (settings.Value != null) { 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 (settings.Link != null) { <span> @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } @Render(settings.Link) </span> } @if (!string.IsNullOrEmpty(settings.HelpText)) { <small class="form__help-text checkbox-help dw-mod">@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) || settings.Link != null ) { <div class="u-full-width"> @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } @if (settings.Link != null) { <div class="u-pull--right"> @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } @Render(settings.Link) </div> } </div> } <div class="u-pull--left"> @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> </div> } @using Dynamicweb.Rapido.Blocks.Components.General @* Component *@ @helper RenderSearch(Search settings) { var searchValue = HttpContext.Current.Request.QueryString.Get(settings.SearchParameter) ?? ""; var groupValue = HttpContext.Current.Request.QueryString.Get(settings.GroupsParameter) ?? ""; if (string.IsNullOrEmpty(settings.Id)) { settings.Id = Guid.NewGuid().ToString("N"); } var resultAttributes = new Dictionary<string, string>(); if (settings.PageSize != 0) { resultAttributes.Add("data-page-size", settings.PageSize.ToString()); } if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl)) { resultAttributes.Add("data-groups-feed-url", settings.GroupItemsFeedUrl); if (!string.IsNullOrEmpty(groupValue)) { resultAttributes.Add("data-selected-group", groupValue); } if (!string.IsNullOrEmpty(settings.GroupsParameter)) { resultAttributes.Add("data-groups-parameter", settings.GroupsParameter); } } resultAttributes.Add("data-force-init", "true"); if (settings.GoToFirstSearchResultOnEnter) { resultAttributes.Add("data-go-to-first-search-result-on-enter", settings.GoToFirstSearchResultOnEnter.ToString().ToLower()); } if (!string.IsNullOrEmpty(settings.SearchParameter)) { resultAttributes.Add("data-search-parameter", settings.SearchParameter); } resultAttributes.Add("data-search-feed-url", settings.SearchData.SearchFeedUrl); resultAttributes.Add("data-results-template-id", settings.SearchData.ResultsTemplateId); if (settings.SecondSearchData != null) { resultAttributes.Add("data-second-search-feed-url", settings.SecondSearchData.SearchFeedUrl); resultAttributes.Add("data-second-results-template-id", settings.SecondSearchData.ResultsTemplateId); } if (!string.IsNullOrEmpty(settings.ResultsPageUrl)) { resultAttributes.Add("data-results-page-url", settings.ResultsPageUrl); } resultAttributes = resultAttributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); string searchFieldCss = (settings.SearchButton == null) ? "search--with-icon" : ""; <div class="search @settings.CssClass @searchFieldCss js-search-data-source dw-mod" id="@settings.Id" @ComponentMethods.AddAttributes(resultAttributes)> @if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl)) { <button type="button" class="search__groups-btn dw-mod js-search-groups-btn">@Translate("All")</button> <ul class="dropdown dropdown--absolute-position dw-mod search__groups-results js-search-groups-list"></ul> } <input type="text" class="search__field dw-mod js-search-field" placeholder="@settings.Placeholder" value="@searchValue"> <div class="dropdown dropdown--absolute-position search__results dw-mod js-search-results @(settings.SecondSearchData != null ? "search__results--combined" : "")"> @if (settings.SecondSearchData != null) { <div class="search__column search__column--products dw-mod"> <div class="search__column-header dw-mod">@Translate("Products")</div> <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul> @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl)) { @Render(new Link { Title = Translate("View all"), CssClass = "js-view-all-button u-margin", Href = settings.SearchData.ResultsPageUrl }); } </div> <div class="search__column search__column--pages dw-mod"> <div class="search__column-header">@Translate("Pages")</div> <ul class="search__results-list dw-mod js-search-results-second-list" id="@(settings.Id)_SecondResultsList"></ul> @if (!string.IsNullOrEmpty(settings.SecondSearchData.ResultsPageUrl)) { @Render(new Link { Title = Translate("View all"), CssClass = "js-view-all-button u-margin", Href = settings.SecondSearchData.ResultsPageUrl }); } </div> } else { <div class="search__column search__column--only dw-mod"> <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul> @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl)) { @Render(new Link { Title = Translate("View all"), CssClass = "js-view-all-button u-margin", Href = settings.SearchData.ResultsPageUrl }); } </div> } </div> @if (settings.SearchButton != null) { settings.SearchButton.CssClass += " search__btn js-search-btn"; if (settings.RenderDefaultSearchIcon) { settings.SearchButton.Icon = new Icon { Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue }; } @Render(settings.SearchButton); } </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) || settings.Link != null ) { <div class="u-full-width"> @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } @if (settings.Link != null) { <div class="u-pull--right"> @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } @Render(settings.Link) </div> } </div> } @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 (settings.Value != null) { 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 (settings.Value != null) { 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) { if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } <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 (settings.Value != null && 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(); string messageLayoutClass = Enum.GetName(typeof(NotificationMessageLayout), settings.MessageLayout).ToLower(); string minHeightClass = settings.Icon != null ? "u-min-h70px" : ""; <div class="notification-message-@messageTypeClass notification-message-@messageLayoutClass @messageLayoutClass @minHeightClass @settings.CssClass u-full-width dw-mod" @ComponentMethods.AddAttributes(attributes)> @if (settings.Icon != null) { settings.Icon.Label = !string.IsNullOrEmpty(settings.Icon.Label) ? settings.Message + settings.Icon.Label : settings.Message; @Render(settings.Icon) } else { @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) { if (Pageview.Device.ToString() != "Mobile") { action.CssClass += " u-no-margin"; } else { action.CssClass += " u-full-width u-margin-bottom"; } @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 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce @using Dynamicweb.Frontend @using System.Reflection @using Dynamicweb.Content.Items @using System.Web.UI.HtmlControls @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks @using Dynamicweb.Rapido.Blocks.Components.Articles @* Components for the articles *@ @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.Articles @* Component for the articles *@ @helper RenderArticleBanner(dynamic settings) { string filterClasses = "image-filter image-filter--darken"; settings.Layout = ArticleHeaderLayout.Banner; if (settings.Image != null) { if (settings.Image.Path != null) { <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> <div class="background-image @filterClasses dw-mod"> <div class="background-image__wrapper @filterClasses dw-mod"> @{ settings.Image.CssClass += "background-image__cover dw-mod"; } @Render(settings.Image) </div> </div> <div class="center-container dw-mod"> <div class="grid"> <div class="grid__col-md-8 grid__col-xs-12 paragraph-container paragraph-container--height-lg"> <div class="u-left-middle"> <div> @if (!String.IsNullOrEmpty(settings.Heading)) { <h1 class="article__header article__header--giant dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> } @if (!String.IsNullOrEmpty(settings.Subheading)) { <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> } @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) { <small class="article__post-info u-margin-bottom--lg dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> } @if (!String.IsNullOrEmpty(settings.Link)) { <div class="grid__cell"> @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) </div> } </div> </div> </div> @if (settings.ExternalParagraphId != 0) { <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod"> <div class="u-color-light-gray--bg u-color-dark dw-mod"> @RenderParagraphContent(settings.ExternalParagraphId) </div> </div> } </div> </div> </section> if (!String.IsNullOrEmpty(settings.Image.Caption)) { <div class="image-caption dw-mod">@settings.Image.Caption</div> } } else { settings.Layout = ArticleHeaderLayout.Clean; @RenderArticleCleanHeader(settings); } } else { settings.Layout = ArticleHeaderLayout.Clean; @RenderArticleCleanHeader(settings); } } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components.Articles @using Dynamicweb.Rapido.Blocks @* Component for the articles *@ @helper RenderArticleHeader(ArticleHeader settings) { dynamic[] methodParameters = new dynamic[1]; methodParameters[0] = settings; MethodInfo customMethod = this.GetType().GetMethod("RenderArticleHeaderCustom"); if (customMethod != null) { @customMethod.Invoke(this, methodParameters).ToString(); } else { switch (settings.Layout) { case ArticleHeaderLayout.Clean: @RenderArticleCleanHeader(settings); break; case ArticleHeaderLayout.Split: @RenderArticleSplitHeader(settings); break; case ArticleHeaderLayout.Banner: @RenderArticleBannerHeader(settings); break; case ArticleHeaderLayout.Overlay: @RenderArticleOverlayHeader(settings); break; default: @RenderArticleCleanHeader(settings); break; } } } @helper RenderArticleCleanHeader(ArticleHeader settings) { dynamic[] methodParameters = new dynamic[1]; methodParameters[0] = settings; MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom"); if (customMethod != null) { @customMethod.Invoke(this, methodParameters).ToString(); } else { string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; <div class="grid grid--align-content-start grid--justify-start"> <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod"> @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0) { <div class="u-border-bottom u-padding-bottom"> @if (!String.IsNullOrEmpty(settings.Category)) { <div class="u-pull--left"> <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> </div> } <div class="u-pull--right"> @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) { <small class="article__post-info dw-mod">@settings.Author @settings.Date</small> } @if (settings.RatingOutOf != 0) { @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) } </div> </div> } <div class="grid__cell"> @if (!String.IsNullOrEmpty(settings.Heading)) { <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> } @if (settings.Image != null) { if (settings.Image.Path != null) { <div class="u-padding-bottom--lg"> @Render(settings.Image) </div> } } @if (!String.IsNullOrEmpty(settings.Subheading)) { <div class="article__leadtext dw-mod">@settings.Subheading</div> } @if (!String.IsNullOrEmpty(settings.Link)) { <div class="grid__cell"> @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) </div> } </div> </div> @if (settings.ExternalParagraphId != 0) { <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod"> @RenderParagraphContent(settings.ExternalParagraphId) </div> } </div> } } @helper RenderArticleSplitHeader(ArticleHeader settings) { dynamic[] methodParameters = new dynamic[1]; methodParameters[0] = settings; MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSplitHeaderCustom"); if (customMethod != null) { @customMethod.Invoke(this, methodParameters).ToString(); } else { string headerColumnWidth = settings.ExternalParagraphId != 0 ? "4" : "6"; if (settings.Image != null) { if (settings.Image.Path != null) { <section class="multiple-paragraphs-container paragraph-container--full-width"> <div class="grid"> <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod"> <div class="u-left-middle u-padding--lg"> <div> @if (!String.IsNullOrEmpty(settings.Category)) { <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> } @if (!String.IsNullOrEmpty(settings.Heading)) { <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> } @if (!String.IsNullOrEmpty(settings.Subheading)) { <div class="article__leadtext dw-mod">@settings.Subheading</div> } @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) { <small class="article__post-info u-pull--left dw-mod">@settings.Author @settings.Date</small> } @if (settings.RatingOutOf != 0) { <div class="u-pull--right"> @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) </div> } @if (!String.IsNullOrEmpty(settings.Link)) { <div class="u-full-width u-pull--left u-margin-top"> @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) </div> } </div> </div> </div> <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod" style="background-image:url(/Admin/Public/GetImage.ashx?width=1800&amp;height=1100&amp;crop=0&amp;Compression=85&amp;DoNotUpscale=true&amp;image=@settings.Image.Path); background-position: center center; background-size: cover;"></div> @if (settings.ExternalParagraphId != 0) { <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto u-color-light-gray--bg dw-mod"> @RenderParagraphContent(settings.ExternalParagraphId) </div> } </div> </section> } } else { @RenderArticleCleanHeader(settings); } } } @helper RenderArticleOverlayHeader(ArticleHeader settings) { dynamic[] methodParameters = new dynamic[1]; methodParameters[0] = settings; MethodInfo customMethod = this.GetType().GetMethod("RenderArticleOverlayHeaderCustom"); if (customMethod != null) { @customMethod.Invoke(this, methodParameters).ToString(); } else { string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; string contentAlignment = settings.TextLayout == ArticleHeaderTextLayout.Center ? "grid--justify-center" : ""; if (settings.Image != null) { if (settings.Image.Path != null) { if (settings.ExternalParagraphId == 0) { <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> <div class="background-image image-filter image-filter--darken dw-mod"> <div class="background-image__wrapper image-filter image-filter--darken dw-mod"> @{ settings.Image.CssClass += "background-image__cover dw-mod"; } @Render(settings.Image) </div> </div> <div class="center-container dw-mod"> <div class="grid @contentAlignment"> <div class="grid__col-md-@contentColumns grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod"> @if (!string.IsNullOrEmpty(settings.Heading)) { <h1 class="article__header article__header--giant u-padding-top--lg dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> } @if (!String.IsNullOrEmpty(settings.Subheading)) { <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> } <div class="u-margin-top"> @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) { <small class="article__post-info u-pull--left dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> } @if (settings.RatingOutOf != 0) { <div class="u-pull--right"> @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) </div> } </div> @if (!String.IsNullOrEmpty(settings.Link)) { <div class="grid__cell"> @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) </div> } </div> </div> </div> </section> } else { @RenderArticleBanner(settings); } } } else { @RenderArticleCleanHeader(settings); } } } @helper RenderArticleBannerHeader(dynamic settings) { dynamic[] methodParameters = new dynamic[1]; methodParameters[0] = settings; MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerHeaderCustom"); if (customMethod != null) { @customMethod.Invoke(this, methodParameters).ToString(); } else { @RenderArticleBanner(settings); } } @using System.Reflection @using System.Text.RegularExpressions; @using Dynamicweb.Frontend @using Dynamicweb.Content.Items @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.Articles @using Dynamicweb.Rapido.Blocks @* Component for the articles *@ @helper RenderArticleBodyRow(ArticleBodyRow settings) { string position = settings.TopLayout == "overlay" ? "article__overlay-offset" : ""; string contentAlignment = settings.TextLayout == "center" ? "grid--justify-center" : ""; <div class="grid grid--align-content-start @contentAlignment @position dw-mod"> @RenderBlockList(settings.SubBlocks) </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components.Articles @using Dynamicweb.Rapido.Blocks @* Component for the articles *@ @helper RenderArticleImage(ArticleImage settings) { if (settings.Image != null) { if (settings.Image.Path != null) { <div class="u-margin-bottom--lg"> @Render(settings.Image) </div> } } } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.Articles @* Component for the articles *@ @helper RenderArticleSubHeader(ArticleSubHeader settings) { if (!String.IsNullOrEmpty(settings.Title)) { <h2 class="article__header">@settings.Title</h2> } } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.Articles @using Dynamicweb.Rapido.Blocks @* Component for the articles *@ @helper RenderArticleText(ArticleText settings) { if (!String.IsNullOrEmpty(settings.Text)) { string greatTextClass = settings.EnableLargeText == true ? "article__paragraph--great-text" : ""; <div class="article__paragraph @greatTextClass dw-mod"> @settings.Text </div> } } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.Articles @using Dynamicweb.Rapido.Blocks @* Component for the articles *@ @helper RenderArticleQuote(ArticleQuote settings) { string text = Regex.Replace(settings.Text, "<.*?>", String.Empty); <div class="grid u-padding-bottom--lg"> @if (settings.Image != null) { if (settings.Image.Path != null) { <div class="grid__col-3"> <div class="grid__cell-img"> @{ settings.Image.Title = !String.IsNullOrEmpty(settings.Image.Title) ? settings.Image.Title : settings.Author; settings.Image.CssClass += " article__image article__image--ball"; settings.Image.ImageDefault.Width = 200; settings.Image.ImageDefault.Height = 200; } @Render(settings.Image) </div> </div> } } <div class="grid__col-auto"> @if (!String.IsNullOrEmpty(settings.Text)) { <div class="article__quote dw-mod"> <i class="fas fa-quote-right u-margin-bottom--lg"></i> @settings.Text <i class="fas fa-quote-right"></i> </div> } @if (!String.IsNullOrEmpty(settings.Author)) { <div class="article__quote-author dw-mod"> - @settings.Author </div> } </div> </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.Articles @using Dynamicweb.Rapido.Blocks @* Component for the articles *@ @helper RenderArticleInfoTable(ArticleInfoTable settings) { <table class="table table--clean"> @foreach (var row in settings.Rows) { string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two"; <tr> @if (!String.IsNullOrEmpty(row.Icon)) { <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td> } <td class="u-no-margin-on-p-elements"> <div class="u-bold">@row.Title</div> @if (!String.IsNullOrEmpty(row.SubTitle)) { if (row.Link == null) { <div>@row.SubTitle</div> } else { <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a> } } </td> </tr> } </table> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components.Articles @using Dynamicweb.Rapido.Blocks @* Component for the articles *@ @helper RenderArticleGalleryModal(ArticleGalleryModal settings) { Modal galleryModal = new Modal { Id = "ParagraphGallery", Width = ModalWidth.Full, BodyTemplate = RenderArticleGalleryModalContent() }; @Render(galleryModal) } @helper RenderArticleGalleryModalContent() { <div class="modal__image-min-size-wrapper"> @Render(new Image { Id = "ParagraphGallery", Path = "#", CssClass = "modal--full__img", DisableLazyLoad = true, DisableImageEngine = true }) </div> <div class="modal__images-counter" id="ParagraphGallery_counter"></div> @Render(new Button { Id = "ParagraphGallery_prev", ButtonType = ButtonType.Button, ButtonLayout = ButtonLayout.None, CssClass = "modal__prev-btn", Icon = new Icon { Prefix = "far", Name = "fa-angle-left", LabelPosition = IconLabelPosition.After }, OnClick = "Gallery.prevImage('ParagraphGallery')" }) @Render(new Button { Id = "ParagraphGallery_next", ButtonType = ButtonType.Button, ButtonLayout = ButtonLayout.None, CssClass = "modal__next-btn", Icon = new Icon { Prefix = "far", Name = "fa-angle-right", LabelPosition = IconLabelPosition.After }, OnClick = "Gallery.nextImage('ParagraphGallery')" }) } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.Articles @using Dynamicweb.Rapido.Blocks @* Component for the articles *@ @helper RenderArticleRelated(ArticleRelated settings) { string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : ""; string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : ""; <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width"> <div class="center-container dw-mod"> <div class="grid u-padding"> <div class="grid__col-md-12 grid__col-xs-12"> <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2> </div> </div> <div class="js-handlebars-root u-padding" id="@settings.Title.Replace(" ", String.Empty)" data-template="RelatedSimpleTemplate" data-json-feed="/Default.aspx?ID=@settings.FeedPageId&@settings.Query&ExcludeItemID=@settings.CurrentPageId&PageSize=@settings.PageSize"></div> <script id="RelatedSimpleTemplate" type="text/x-template"> {{#.}} <div class="grid u-padding-bottom--lg"> {{#Cases}} <div class="grid__col-lg-3 grid__col-sm-6 image-hover--zoom dw-mod"> <a href="{{link}}" class="u-full-height u-color-light--bg u-flex u-flex--column"> {{#if image}} <div class="u-color-light--bg u-no-padding dw-mod"> <div class="flex-img image-hover__wrapper"> <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=680&height=314&amp;crop=1&amp;DoNotUpscale=True&amp;Compression=75&amp;image={{image}}" alt="{{title}}" /> </div> </div> {{/if}} <div class="card u-color-light--bg u-full-height dw-mod"> <h3 class="article-list__item-header u-truncate-text dw-mod">{{title}}</h3> <p class="article__short-summary dw-mod">{{summary}}</p> </div> </a> </div> {{/Cases}} </div> {{/.}} </script> </div> </section> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.Articles @using Dynamicweb.Rapido.Blocks @* Component for the articles *@ @helper RenderArticleMenu(ArticleMenu settings) { if (!String.IsNullOrEmpty(settings.Title)) { <div class="u-margin u-border-bottom"> <h3 class="u-no-margin">@settings.Title</h3> </div> } <ul class="menu-left u-margin-bottom dw-mod"> @foreach (var item in settings.Items) { @Render(item) } </ul> } @helper RenderArticleMenuItem(ArticleMenuItem settings) { string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#"; if (!String.IsNullOrEmpty(settings.Title)) { <li class="menu-left__item dw-mod"> <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a> </li> } } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.Articles @using Dynamicweb.Rapido.Blocks @* Component for the articles *@ @helper RenderArticleList(ArticleList settings) { if (Pageview != null) { bool isParagraph = Pageview.CurrentParagraph != null ? true : false; string[] sortArticlesListBy = new string[2]; if (isParagraph) { sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; } else { sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; } string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString(); if (!settings.DisablePagination) { @RenderItemList(new { ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle", ListSourceType = settings.SourceType, ListSourcePage = sourcePage, ItemFieldsList = "*", Filter = settings.Filter, ListOrderBy = sortArticlesListBy[0], ListOrderByDirection = sortArticlesListBy[1], ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date", ListSecondOrderByDirection = "ASC", IncludeAllChildItems = true, ListTemplate = settings.Template, ListPageSize = settings.PageSize.ToString() }); } else { @RenderItemList(new { ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle", ListSourceType = settings.SourceType, ListSourcePage = sourcePage, ItemFieldsList = "*", Filter = settings.Filter, ListOrderBy = sortArticlesListBy[0], ListOrderByDirection = sortArticlesListBy[1], ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date", ListSecondOrderByDirection = "ASC", IncludeAllChildItems = true, ListTemplate = settings.Template, ListPageSize = settings.PageSize.ToString(), ListViewMode = "Partial", ListShowTo = settings.PageSize + 1 }); } } } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.Articles @* Component for the articles *@ @helper RenderArticleSummary(ArticleSummary settings) { if (!String.IsNullOrEmpty(settings.Text)) { <div class="article__summary dw-mod">@settings.Text</div> } } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.Articles @using Dynamicweb.Rapido.Blocks @* Component for the articles *@ @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings) { string pageId = Pageview.ID.ToString(); string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All"); var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); foreach (var option in settings.Categories) { selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter; } if (selectedFilter == pageId) { selectedFilter = Translate("All"); } if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") { <div class="u-pull--right u-margin-left"> <div class="collection u-no-margin"> <h5>@Translate("Category")</h5> <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> <div class="dropdown u-w180px dw-mod"> <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> <div class="dropdown__content dw-mod"> @foreach (var option in settings.Categories) { <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> } </div> <label class="dropdown-trigger-off" for="CategorySelector"></label> </div> </div> </div> } else { <div class="u-full-width u-margin-bottom"> <h5 class="u-no-margin">@Translate("Category")</h5> <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> <div class="dropdown u-full-width dw-mod"> <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> <div class="dropdown__content dw-mod"> @foreach (var option in settings.Categories) { <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> } </div> <label class="dropdown-trigger-off" for="CategorySelector"></label> </div> </div> } } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.Articles @using Dynamicweb.Rapido.Blocks @using System.Collections.Generic @* Component for the articles *@ @helper RenderArticleListFilter(ArticleListFilter settings) { string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All"); var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); if (settings.Options != null) { if (settings.Options is IEnumerable<dynamic>) { var options = (IEnumerable<dynamic>) settings.Options; settings.Options = options.OrderBy(item => item.Name); } foreach (var option in settings.Options) { selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter; } if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") { <div class="u-pull--right u-margin-left"> <div class="collection u-no-margin"> <h5>@settings.Label</h5> <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> <div class="dropdown u-w180px dw-mod"> <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> <div class="dropdown__content dw-mod"> <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> @foreach (var option in settings.Options) { <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> } </div> <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> </div> </div> </div> } else { <div class="u-full-width u-margin-bottom"> <h5 class="u-no-margin">@settings.Label</h5> <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> <div class="dropdown u-full-width w-mod"> <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> <div class="dropdown__content dw-mod"> <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> @foreach (var option in settings.Options) { <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> } </div> <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> </div> </div> } } } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.Articles @using Dynamicweb.Rapido.Blocks @* Component for the articles *@ @helper RenderArticleListSearch(ArticleListSearch settings) { string searchParameter = !string.IsNullOrEmpty(settings.SearchParameter) ? settings.SearchParameter : "Title"; string searchWord = HttpContext.Current.Request.QueryString.Get(searchParameter); string searchString = !string.IsNullOrEmpty(searchWord) ? searchWord.Trim('*') : ""; string className = "u-w340px u-pull--right u-margin-left"; if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") { className = "u-full-width"; } <div class="typeahead u-color-inherit u-margin-bottom dw-mod @className"> <input type="text" class="typeahead-search-field u-no-margin dw-mod" placeholder="@Translate("Search in list")" value="@searchString" id="ArticleListSearchInput" onchange="QueryArray.setParameterInCurrentURL('@searchParameter', '*' + document.getElementById('ArticleListSearchInput').value + '*')"> <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button> </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.Articles @using Dynamicweb.Rapido.Blocks @* Component for the articles *@ @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings) { <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components.Articles @using Dynamicweb.Rapido.Blocks @using System.Text.RegularExpressions @* Component for the articles *@ @helper RenderArticleListItem(ArticleListItem settings) { switch (settings.Type) { case ArticleListItemType.Card: @RenderArticleListItemCard(settings); break; case ArticleListItemType.List: @RenderArticleListItemList(settings); break; case ArticleListItemType.Simple: @RenderArticleListItemSimple(settings); break; default: @RenderArticleListItemCard(settings); break; } } @helper RenderArticleListItemCard(ArticleListItem settings) { <a href="@settings.Link" class="u-full-height u-color-light--bg u-flex u-flex--column"> <div class="u-color-light--bg u-no-padding dw-mod"> @if (settings.Logo != null) { string backgroundImage = settings.Image != null ? "background-image:url(/Admin/Public/GetImage.ashx?width=992&amp;height=760&amp;crop=0&amp;Compression=75&amp;DoNotUpscale=True&amp;image=" + settings.Image.Path + "); background-size: cover;" : ""; settings.Logo.ImageDefault.Crop = 5; settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> @if (settings.Stickers != null) { if (settings.Stickers.Position != StickersListPosition.Custom && settings.Stickers.Position != StickersListPosition.None) { @Render(settings.Stickers); } } @RenderImage(settings.Logo) </div> } else if (settings.Image != null) { <div class="flex-img image-hover__wrapper u-position-relative dw-mod"> @if (settings.Stickers != null) { if (settings.Stickers.Position != StickersListPosition.Custom && settings.Stickers.Position != StickersListPosition.None) { @Render(settings.Stickers); } } @Render(settings.Image) </div> } </div> @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) { <div class="card u-color-light--bg u-full-height dw-mod"> @if (settings.Stickers != null) { if (settings.Stickers.Position == StickersListPosition.Custom) { @Render(settings.Stickers); } } @if (!String.IsNullOrEmpty(settings.Title)) { <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> } @if (!String.IsNullOrEmpty(settings.SubTitle)) { <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> } @if (!String.IsNullOrEmpty(settings.Summary)) { <p class="article__short-summary dw-mod">@settings.Summary</p> } </div> } </a> } @helper RenderArticleListItemList(ArticleListItem settings) { <a href="@settings.Link"> <div class="grid u-color-light--bg u-no-padding dw-mod"> <div class="grid__col-md-3"> <div class="u-color-light--bg u-no-padding dw-mod"> @if (settings.Logo != null) { string backgroundImage = settings.Image != null ? "background-image:url(/Admin/Public/GetImage.ashx?width=992&amp;height=760&amp;crop=0&amp;Compression=75&amp;DoNotUpscale=True&amp;image=" + settings.Image.Path + "); background-size: cover;" : ""; settings.Logo.ImageDefault.Crop = 5; settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> @if (settings.Stickers != null) { if (settings.Stickers.Position != StickersListPosition.Custom) { @Render(settings.Stickers); } } @RenderImage(settings.Logo) </div> } else if (settings.Image != null) { <div class="flex-img image-hover__wrapper dw-mod"> @if (settings.Stickers != null) { if (settings.Stickers.Position != StickersListPosition.Custom) { @Render(settings.Stickers); } } @Render(settings.Image) </div> } </div> </div> @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) { <div class="grid__col-md-9"> @if (!String.IsNullOrEmpty(settings.Title)) { <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> } @if (settings.Stickers != null) { if (settings.Stickers.Position == StickersListPosition.Custom) { @Render(settings.Stickers); } } @if (!String.IsNullOrEmpty(settings.SubTitle)) { <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> } @if (!String.IsNullOrEmpty(settings.Summary)) { <p class="article__short-summary dw-mod">@settings.Summary</p> } </div> } </div> </a> } @helper RenderArticleListItemSimple(ArticleListItem settings) { <a href="@settings.Link" class="u-color-inherit"> <div class="grid u-color-light--bg u-no-padding dw-mod"> <div class="grid__col-md-12"> @if (!String.IsNullOrEmpty(settings.Title)) { <div class="article-list-item__header u-truncate-text u-no-margin dw-mod">@settings.Title</div> } @if (!String.IsNullOrEmpty(settings.SubTitle)) { <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> } </div> </div> </a> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.Articles @* Component for the articles *@ @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings) { <small class="article__subscription"> @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) { <text>@Translate("Written")</text> } @if (!string.IsNullOrWhiteSpace(settings.Author)) { <text>@Translate("by") @settings.Author</text> } @if (!string.IsNullOrWhiteSpace(settings.Date)) { <text>@Translate("on") @settings.Date</text> } </small> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.Articles @using Dynamicweb.Rapido.Blocks.Components.General @* Component for the articles *@ @helper RenderArticleLink(ArticleLink settings) { if (!string.IsNullOrEmpty(settings.Title)) { Button link = new Button { ConfirmText = settings.ConfirmText, ConfirmTitle = settings.ConfirmTitle, ButtonType = settings.ButtonType, Id = settings.Id, Title = settings.Title, AltText = settings.AltText, OnClick = settings.OnClick, CssClass = settings.CssClass, Disabled = settings.Disabled, Icon = settings.Icon, Name = settings.Name, Href = settings.Href, ButtonLayout = settings.ButtonLayout, ExtraAttributes = settings.ExtraAttributes }; <div class="grid__cell"> @Render(link) </div> } } @using System.Reflection @using Dynamicweb.Rapido.Blocks @using Dynamicweb.Rapido.Blocks.Components.Articles @using Dynamicweb.Rapido.Blocks.Components.General @* Component for the articles *@ @helper RenderArticleCarousel(ArticleCarousel settings) { <div class="grid"> <div class="grid__col-12 u-no-padding u-margin-bottom"> <div class="carousel" id="carousel_@settings.Id"> <div class="carousel__container js-carousel-slides dw-mod"> @RenderBlockList(settings.SubBlocks) </div> </div> </div> </div> <script> document.addEventListener("DOMContentLoaded", function () { new CarouselModule("#carousel_@settings.Id", { slideTime: 0, dots: true }); }); </script> } @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings) { string imageEngine = "/Admin/Public/GetImage.ashx?"; string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image; if (settings.ImageSettings != null) { defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : ""; defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : ""; defaultImage += "Crop=" + settings.ImageSettings.Crop + "&"; defaultImage += "Compression=" + settings.ImageSettings.Compression + "&"; defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&"; defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&"; } defaultImage += "&Image=" + settings.Image; <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')"> <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title"> <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2> <div class="article-list__item-info"> @if (settings.Stickers != null) { settings.Stickers.Position = StickersListPosition.Custom; @Render(settings.Stickers); } <small class="u-margin-top--lg u-color-light"> @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) { <text>@Translate("Written")</text> } @if (!string.IsNullOrWhiteSpace(settings.Author)) { <text>@Translate("by") @settings.Author</text> } @if (!string.IsNullOrWhiteSpace(settings.Date)) { <text>@Translate("on") @settings.Date</text> } </small> </div> <h3 class="article__short-summary u-color-light">@settings.Summary</h3> </a> @if (settings.UseFilters == true) { <div class="background-image image-filter image-filter--darken dw-mod"></div> } </div> } @using System.Text.RegularExpressions @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components.Articles @using Dynamicweb.Rapido.Blocks @* Component for the articles *@ @helper RenderArticleVideo(ArticleVideo settings) { if (settings.Url != null) { //getting video ID from youtube URL string videoCode = settings.Url; 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; } } int autoPlay = settings.AutoPlay == "true" ? 1 : 0; <div class="video-wrapper"> <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div> </div> } } @* Simple helpers *@ @*Requires the Gallery ItemType that comes with Rapido*@ @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) { if (gallery != null && gallery.Count > 0) { int count = 1; foreach (var item in gallery) { if (item.GetFile("ImagePath") != null) { string image = item.GetFile("ImagePath").PathUrlEncoded; string imagePrefix = "/Admin/Public/GetImage.ashx?width=1200&amp;height=820&amp;crop=5&amp;Compression=75&amp;DoNotUpscale=1&amp;image="; int imagesCount = gallery.Count; if (count == 1) { <label class="gallery" for="ParagraphGalleryModalTrigger" onclick="Gallery.openImage(this.querySelector('.js-gallery'))"> <span class="gallery__main-image"> <img src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=992&amp;height=760&amp;crop=0&amp;Compression=75&amp;DoNotUpscale=1&amp;image=@image" class="b-lazy flex-img js-gallery" alt="" data-for="ParagraphGallery" data-image="@imagePrefix@image" /> </span> <span class="gallery__image-counter"> <i class="fas fa-camera fa-2x"></i> <span class="gallery__image-counter__number">@imagesCount</span> <span class="gallery__image-counter__text">@Translate("See all") <i class="fas fa-angle-right"></i></span> </span> </label> } else { <div class="u-hidden js-gallery" data-for="ParagraphGallery" data-image="@imagePrefix@image"></div> } count++; } } @Render(new ArticleGalleryModal()) } } @helper RenderMobileFilters(List<Block> subBlocks) { if (subBlocks.Count > 0) { <div class="grid__col-12"> <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" /> <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters"> @RenderBlockList(subBlocks) </div> <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label> <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label> </div> } } @* Include the Blocks for the page *@ @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @functions { string GoogleTagManagerID = ""; string GoogleAnalyticsID = ""; } @{ GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID"); GoogleAnalyticsID = Model.Area.Item.GetItem("Settings").GetString("GoogleAnalyticsTrackingID"); BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); if (!string.IsNullOrWhiteSpace(GoogleAnalyticsID)) { Block tagManager = new Block() { Id = "GoogleAnalytics", SortId = 0, Template = RenderGoogleAnalyticsSnippet() }; topSnippetsBlocksPage.Add("Head", tagManager); } if (!string.IsNullOrWhiteSpace(GoogleTagManagerID)) { Block tagManager = new Block() { Id = "TagManager", SortId = 1, Template = RenderGoogleTagManager() }; topSnippetsBlocksPage.Add("Head", tagManager); Block tagManagerBodySnippet = new Block() { Id = "TagManagerBodySnippet", SortId = 1, Template = RenderGoogleTagManagerBodySnippet() }; topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManagerBodySnippet); } Block facebookPixel = new Block() { Id = "FacebookPixel", SortId = 2, Template = RenderFacebookPixel() }; topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel); } @helper RenderGoogleAnalyticsSnippet() { <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=@GoogleAnalyticsID"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '@GoogleAnalyticsID'); </script> } @helper RenderGoogleTagManager() { <script> (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','@GoogleTagManagerID'); </script> } @helper RenderGoogleTagManagerBodySnippet() { <!-- Google Tag Manager (noscript) --> <noscript> <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID" height="0" width="0" style="display:none;visibility:hidden"></iframe> </noscript> <!-- End Google Tag Manager (noscript) --> } @helper RenderFacebookPixel() { string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID"); if (!string.IsNullOrWhiteSpace(FacebookPixelID)) { <!-- Facebook Pixel Code --> <script> !function(f,b,e,v,n,t,s) {if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)}; if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t,s)}(window, document,'script', 'https://connect.facebook.net/en_US/fbevents.js'); fbq('init', '@FacebookPixelID'); fbq('track', 'PageView'); </script> <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript> } } @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Security.UserManagement @using Dynamicweb.Security.UserManagement.ExternalAuthentication @using Dynamicweb.Rapido.Blocks.Components.General @{ BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master"); Block loginModal = new Block() { Id = "LoginModal", SortId = 10, Component = new Modal { Id = "SignIn", Heading = new Heading { Level = 0, Title = Translate("Sign in") }, Width = ModalWidth.Sm, BodyTemplate = RenderLoginForm() } }; loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal); } @helper RenderLoginForm() { int pageId = Model.TopPage.ID; string userSignedInErrorText = ""; int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); bool showModalOnStart = pageId != GetPageIdByNavigationTag("CustomerCenter") && Pageview.Page.ID != GetPageIdByNavigationTag("SignInPage") && Model.LogOnFailed; bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink"); ProviderCollection providers = Provider.GetActiveProviders(); if (Model.LogOnFailed) { switch (Model.LogOnFailedReason) { case LogOnFailedReason.PasswordLengthInvalid: userSignedInErrorText = Translate("Password length is invalid"); break; case LogOnFailedReason.IncorrectLogin: userSignedInErrorText = Translate("Invalid email or password"); break; case LogOnFailedReason.ExceededFailedLogOnLimit: userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked"); break; case LogOnFailedReason.LoginLocked: userSignedInErrorText = Translate("The user account is temporarily locked"); break; case LogOnFailedReason.PasswordExpired: userSignedInErrorText = Translate("The password has expired and needs to be renewed"); break; default: userSignedInErrorText = Translate("An unknown error occured"); break; } } Form form = new Form { Method = FormMethod.Post, Name = "LoginModalForm" }; TextField passwordField = new TextField { Id = "login-password", Type = TextFieldType.Password, Name = "password", Label = Translate("Password"), Required = true }; if (!hideForgotPasswordLink) { passwordField.Link = new Link { Title = Translate("Forgot password?"), Href = "/Default.aspx?id=" + signInProfilePageId + "&LoginAction=Recovery" }; } form.Add(new HiddenField { Name = "ID", Value = Converter.ToString(pageId) }); form.Add(new HiddenField { Name = "DWExtranetUsernameRemember", Value = "True" }); form.Add(new HiddenField { Name = "DWExtranetPasswordRemember", Value = "True" }); form.Add(new HiddenField { Name = "LoginAction", Value = "Login" }); form.Add(new TextField { Id = "LoginUsername", Name = "username", Label = Translate("Email"), CssClass = "u-full-width", Required = true }); form.Add(passwordField); form.Add(new NotificationMessage { Message = userSignedInErrorText, MessageType = NotificationMessageType.Error }); form.Add(new CheckboxField { Id = "LoginRememberMe", Value = "True", Name = "Autologin", Label = Translate("Remember me") }); form.Add(new Button { ButtonType = ButtonType.Submit, Title = Translate("Sign in"), CssClass = "btn--full", OnClick = "Buttons.LockButton(event)" }); foreach (Provider LoginProvider in providers) { var ProviderName = LoginProvider.Name.ToLower(); form.Add(new Link { Href = "/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=" + LoginProvider.ID, Icon = new Icon { Prefix = "fab", Name = "fa-" + ProviderName, CssClass = "fa-1_5x", LabelPosition = IconLabelPosition.After }, ButtonLayout = ButtonLayout.LinkClean, CssClass = "btn--condensed u-margin-bottom u-margin-right u-inline-block u-color-" + ProviderName, AltText = ProviderName }); } if (!hideCreateAccountLink) { form.Add(new Text { Content = "<div class=\"u-border-top u-full-width u-margin-bottom--lg\"></div>" }); form.Add(new Link { Href = "/Default.aspx?id=" + createAccountPageId, ButtonLayout = ButtonLayout.LinkClean, Title = Translate("Create account"), CssClass = "u-full-width u-ta-center" }); } @Render(form) if (showModalOnStart) { <script> document.getElementById("SignInModalTrigger").checked = true; </script> } } @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") { <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @using Dynamicweb.Rapido.Services @functions { BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); } @{ var mobileTopLayout = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetString("Design")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; bool mobileHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); bool mobileHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart") || !Dynamicweb.Rapido.Services.User.IsBuyingAllowed(); Block mobileHeader = new Block() { Id = "MobileTop", SortId = 10, Template = RenderMobileTop(), SkipRenderBlocksList = true }; mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader); Block mobileHeaderNavigation = new Block() { Id = "MobileHeaderNavigation", SortId = 10, Template = RenderMobileHeaderNavigation(), SkipRenderBlocksList = true, BlocksList = new List<Block> { new Block { Id = "MobileHeaderNavigationTrigger", SortId = 10, Template = RenderMobileHeaderNavigationTrigger() } } }; mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation); Block mobileHeaderLogo = new Block() { Id = "MobileHeaderLogo", SortId = 20, Template = RenderMobileHeaderLogo(), SkipRenderBlocksList = true }; mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo); Block mobileHeaderActions = new Block() { Id = "MobileHeaderActions", SortId = 30, Template = RenderMobileTopActions(), SkipRenderBlocksList = true }; mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions); if (!mobileHideSearch) { Block mobileHeaderSearch = new Block { Id = "MobileHeaderSearch", SortId = 10, Template = RenderMobileTopSearch() }; mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch); } Block mobileHeaderMiniCart; if (!mobileHideCart) { mobileHeaderMiniCart = new Block { Id = "MobileHeaderMiniCart", SortId = 20, Template = RenderMobileTopMiniCart() }; Block miniCartCounterScriptTemplate = new Block { Id = "MiniCartCounterScriptTemplate", Template = RenderMobileMiniCartCounterContent() }; BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); } else { mobileHeaderMiniCart = new Block { Id = "MobileHeaderMiniCart", SortId = 20 }; } if (!mobileHideSearch) { Block mobileHeaderSearchBar = new Block() { Id = "MobileHeaderSearchBar", SortId = 30, Template = RenderMobileTopSearchBar() }; mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar); } switch (mobileTopLayout) { case "nav-left": mobileHeaderNavigation.SortId = 10; mobileHeaderLogo.SortId = 20; mobileHeaderActions.SortId = 30; mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); break; case "nav-right": mobileHeaderLogo.SortId = 10; mobileHeaderActions.SortId = 20; mobileHeaderNavigation.SortId = 30; mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); break; case "nav-search-left": mobileHeaderNavigation.SortId = 10; mobileHeaderLogo.SortId = 20; mobileHeaderActions.SortId = 30; mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); break; case "search-left": mobileHeaderActions.SortId = 10; mobileHeaderLogo.SortId = 20; mobileHeaderNavigation.SortId = 30; mobileHeaderMiniCart.SortId = 0; mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); break; } } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ BlocksPage customMobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); } @helper RenderMobileTop() { List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList(); <nav class="main-navigation-mobile dw-mod"> <div class="center-container top-container__center-container dw-mod"> <div class="grid grid--align-center"> @RenderBlockList(subBlocks) </div> </div> </nav> } @helper RenderMobileHeaderNavigation() { List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList(); <div class="grid__col-auto-width"> <ul class="menu dw-mod"> @RenderBlockList(subBlocks) </ul> </div> } @helper RenderMobileHeaderNavigationTrigger() { <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label> </li> } @helper RenderMobileHeaderLogo() { List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList(); var mobileTopLayout = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetString("Design")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : ""; string firstPageId = Model.Area.FirstActivePage.ID.ToString(); string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName"); string mobileLogo = "/Files/Images/logo-dynamicweb.png"; if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null) { mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded; } if (Path.GetExtension(mobileLogo).ToLower() != ".svg") { mobileLogo = "/Admin/Public/GetImage.ashx?height=40&amp;width=100&amp;crop=5&amp;Compression=75&amp;image=" + mobileLogo; } else { mobileLogo = HttpUtility.UrlDecode(mobileLogo); } <div class="grid__col-auto grid__col--bleed"> <div class="grid__cell @centeredLogo"> <a href="/Default.aspx?ID=@firstPageId" class="logo logo--mobile u-inline-block dw-mod"> <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" /> </a> </div> @RenderBlockList(subBlocks) </div> } @helper RenderMobileTopActions() { List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList(); <div class="grid__col-auto-width"> <ul class="menu dw-mod"> @RenderBlockList(subBlocks) </ul> </div> } @helper RenderMobileTopSearch() { <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> </label> </li> } @helper RenderMobileTopMiniCart() { int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); int cartPageId = GetPageIdByNavigationTag("CartPage"); double cartProductsCount = Model.Cart.TotalProductsCount; <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper"> <div class="mini-cart dw-mod"> <a href="/Default.aspx?ID=@cartPageId&Purge=True" id="miniCartCounterWrap" class="menu__link menu__link--icon menu__link--mobile dw-mod js-mini-cart-button"> <div class="u-inline u-position-relative"> <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> <div class="mini-cart__counter dw-mod"> <div class="js-handlebars-root js-mini-cart-counter" id="cartCounter" data-template="MiniCartCounterContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=Counter" data-init-onload="false" data-preloader="false"> <div class="js-mini-cart-counter-content" data-count="@cartProductsCount"> @cartProductsCount </div> </div> </div> </div> </a> </div> </li> } @helper RenderMobileTopSearchBar() { string searchFeedId = ""; string searchSecondFeedId = ""; int groupsFeedId; int productsPageId = GetPageIdByNavigationTag("ProductsPage"); string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; string resultPageLink; string searchPlaceholder; string searchType = "product-search"; string searchTemplate; string searchContentTemplate = ""; string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; bool showGroups = true; if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") { searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; resultPageLink = contentSearchPageLink; searchPlaceholder = Translate("Search page"); groupsFeedId = 0; searchType = "content-search"; searchTemplate = "SearchPagesTemplate"; showGroups = false; } else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") { searchFeedId = productsPageId + "&feed=true"; searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; resultPageLink = Converter.ToString(productsPageId); searchPlaceholder = Translate("Search products or pages"); groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); searchType = "combined-search"; searchTemplate = "SearchProductsTemplateWrap"; searchContentTemplate = "SearchPagesTemplateWrap"; showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); } else { resultPageLink = Converter.ToString(productsPageId); searchFeedId = productsPageId + "&feed=true"; groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); searchPlaceholder = Translate("Search products"); searchTemplate = "SearchProductsTemplate"; searchType = "product-search"; showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); } <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" /> <div class="main-navigation-mobile typeahead-mobile dw-mod"> <div class="center-container top-container__center-container dw-mod"> <div class="grid"> <div class="grid__col-auto"> <div class="typeahead-mobile__search-field dw-mod js-typeahead" data-page-size="@(searchType == "combined-search" ? 4 : 8)" id="MobileProductSearch" data-search-feed-id="@searchFeedId" data-search-second-feed-id="@searchSecondFeedId" data-result-page-id="@resultPageLink" data-search-type="@searchType"> <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue"> @if (string.IsNullOrEmpty(searchSecondFeedId)) { <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="MobileProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></ul> } else { <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> <div class="js-handlebars-root js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="MobileProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></div> <div class="js-handlebars-root js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="MobileContentSearchBarContent" data-template="@searchContentTemplate" data-json-feed="/Default.aspx?ID=@searchSecondFeedId" data-init-onload="false"></div> </div> } <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button> </div> </div> <div class="grid__col-auto-width"> <ul class="menu dw-mod"> <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> <i class="fas fa-times fa-1_5x"></i> </label> </li> </ul> </div> </div> </div> </div> } @helper RenderMobileMiniCartCounterContent() { <script id="MiniCartCounterContent" type="text/x-template"> {{#.}} <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> {{numberofproducts}} </div> {{/.}} </script> } </text> <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @using S_DW_BKI.CustomModules.Extensions @functions { BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master"); } @{ bool mobileNavigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); bool mobileHideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); bool mobileHideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); bool mobileHideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); bool mobileHideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); bool mobileHideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); Block mobileNavigation = new Block() { Id = "MobileNavigation", SortId = 10, Template = MobileNavigation(), SkipRenderBlocksList = true }; mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation); if (Model.CurrentUser.ID > 0 && !mobileHideMyProfileLink) { Block mobileNavigationSignIn = new Block { Id = "MobileNavigationSignIn", SortId = 10, Template = RenderMobileNavigationSignIn() }; mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn); } Block mobileNavigationMenu = new Block { Id = "MobileNavigationMenu", SortId = 20, Template = RenderMobileNavigationMenu() }; mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu); Block mobileNavigationActions = new Block { Id = "MobileNavigationActions", SortId = 30, Template = RenderMobileNavigationActions(), SkipRenderBlocksList = true }; mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions); if (!mobileNavigationItemsHideSignIn) { if (Model.CurrentUser.ID <= 0) { Block mobileNavigationSignInAction = new Block { Id = "MobileNavigationSignInAction", SortId = 10, Template = RenderMobileNavigationSignInAction() }; mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); if (!mobileHideCreateAccountLink) { Block mobileNavigationCreateAccountAction = new Block { Id = "MobileNavigationCreateAccountAction", SortId = 20, Template = RenderMobileNavigationCreateAccountAction() }; mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction); } } else { if (!mobileHideMyOrdersLink) { Block mobileNavigationOrdersAction = new Block { Id = "MobileNavigationOrdersAction", SortId = 30, Template = RenderMobileNavigationOrdersAction() }; mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction); } if (!mobileHideMyFavoritesLink) { Block mobileNavigationFavoritesAction = new Block { Id = "MobileNavigationFavoritesAction", SortId = 20, Template = RenderMobileNavigationFavoritesAction() }; mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction); } if (!mobileHideMySavedCardsLink) { Block mobileNavigationSavedCardsAction = new Block { Id = "MobileNavigationFavoritesAction", SortId = 30, Template = RenderMobileNavigationSavedCardsAction() }; mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction); } Block mobileNavigationPreviouslyBought = new Block { Id = "MobileNavigatioPreviouslyBought", SortId = 25, Template = RenderMobileNavigationPreviouslyBought() }; mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationPreviouslyBought); Block mobileNavigationSignOutAction = new Block { Id = "MobileNavigationSignOutAction", SortId = 40, Template = RenderMobileNavigationSignOutAction() }; mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction); } } if (Model.Languages.Count > 1) { Block mobileNavigationLanguagesAction = new Block { Id = "MobileNavigationLanguagesAction", SortId = 50, Template = RenderMobileNavigationLanguagesAction() }; mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction); } } @helper MobileNavigation() { List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList(); string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right"; <!-- Trigger for mobile navigation --> <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" /> <!-- Mobile navigation --> <nav class="mobile-navigation mobile-navigation--@position dw-mod"> <div class="mobile-navigation__wrapper" id="mobileNavigationWrapper"> @RenderBlockList(subBlocks) </div> </nav> <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label> } @helper RenderMobileNavigationSignIn() { int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; string myProfilePageLink = linkStart + myProfilePageId; string userName = Model.CurrentUser.FirstName; if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(Model.CurrentUser.LastName)) { userName += " " + Model.CurrentUser.LastName; } if (string.IsNullOrEmpty(userName)) { userName = Model.CurrentUser.Name; } if (string.IsNullOrEmpty(userName)) { userName = Model.CurrentUser.UserName; } if (string.IsNullOrEmpty(userName)) { userName = Model.CurrentUser.Email; } <ul class="menu menu-mobile"> <li class="menu-mobile__item"> <a href="@myProfilePageLink" class="menu-mobile__link dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @userName</a> </li> </ul> } @helper RenderMobileNavigationMenu() { bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt"; string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3"; bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); int startLevel = 0; @RenderNavigation(new { id = "mobilenavigation", cssclass = "menu menu-mobile dwnavigation", startLevel = @startLevel, ecomStartLevel = @startLevel + 1, endlevel = @levels, expandmode = "all", template = @menuTemplate }) if (isSlidesDesign) { <script> function goToLevel(level) { document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%"; } document.addEventListener('DOMContentLoaded', function () { goToLevel(document.getElementById('mobileNavigationWrapper').querySelectorAll('input[type=radio]:checked').length); }); </script> } if (renderPagesInToolBar) { @RenderNavigation(new { id = "topToolsMobileNavigation", cssclass = "menu menu-mobile dwnavigation", template = "ToolsMenuForMobile.xslt" }) } } @helper RenderMobileNavigationActions() { List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ; <ul class="menu menu-mobile"> @RenderBlockList(subBlocks) </ul> } @helper RenderMobileNavigationSignInAction() { <li class="menu-mobile__item"> <label for="SignInModalTrigger" onclick="document.getElementById('MobileNavTrigger').checked = false;" class="menu-mobile__link dw-mod menu-mobile__link--highlighted"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("Sign in")</label> </li> } @helper RenderMobileNavigationCreateAccountAction() { int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); <li class="menu-mobile__item"> <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Default.aspx?ID=@createAccountPageId"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("Create account")</a> </li> } @helper RenderMobileNavigationProfileAction() { int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); string myProfilePageLink = linkStart + myProfilePageId; <li class="menu-mobile__item"> <a href="@myProfilePageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("My Profile")</a> </li> } @helper RenderMobileNavigationPreviouslyBought() { string link = "/Default.aspx?ID=" + GetPageIdByNavigationTag("CustomerPreviouslyBought"); <li class="menu-mobile__item"> <a href="@link" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("My previously bought")</a> </li> } @helper RenderMobileNavigationOrdersAction() { int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); string myOrdersPageLink = linkStart + myOrdersPageId; string ordersIcon = "fas fa-list"; <li class="menu-mobile__item"> <a href="@myOrdersPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@ordersIcon menu-mobile__link-icon"></i> @Translate("My Orders")</a> </li> } @helper RenderMobileNavigationFavoritesAction() { int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); string myFavoritesPageLink = linkStart + myFavoritesPageId; string favoritesIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue : "fa fa-star"; if (Pageview.User != null) { var favoriteList = Pageview.User.GetFavoriteListId(); if (favoriteList != null) { int productsPageId = GetPageIdByNavigationTag("ProductsPage"); myFavoritesPageLink = $"/Default.aspx?ID={productsPageId}&ListId={favoriteList.ListId}&ListName={favoriteList.Name}"; } } <li class="menu-mobile__item"> <a href="@myFavoritesPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@favoritesIcon menu-mobile__link-icon"></i> @Translate("My Favorites")</a> </li> } @helper RenderMobileNavigationSavedCardsAction() { int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); string mySavedCardsPageLink = linkStart + mySavedCardsPageId; string savedCardsIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SavedCards") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SavedCards").SelectedValue : "fas fa-credit-card"; <li class="menu-mobile__item"> <a href="@mySavedCardsPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@savedCardsIcon menu-mobile__link-icon"></i> @Translate("My Saved Cards")</a> </li> } @helper RenderMobileNavigationSignOutAction() { int pageId = Model.TopPage.ID; string signOutIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignOutIcon") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignOutIcon").SelectedValue : "far fa-sign-out-alt"; <li class="menu-mobile__item"> <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId" onclick="RememberState.SetCookie('useAnotherAddress', false)"><i class="@signOutIcon menu-mobile__link-icon"></i> @Translate("Sign out")</a> </li> } @helper RenderMobileNavigationLanguagesAction() { bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; string selectedLanguage = ""; foreach (var lang in Model.Languages) { if (lang.IsCurrent) { selectedLanguage = lang.Name; } } <li class="menu-mobile__item dw-mod"> @if (isSlidesDesign) { <input id="MobileMenuCheck_Language" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(1);"> } else { <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger"> } <div class="menu-mobile__link__wrap"> <label for="MobileMenuCheck_Language" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue menu-mobile__link-icon"></i> @selectedLanguage</label> <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label> </div> <ul class="menu-mobile menu-mobile__submenu expand-menu"> @if (isSlidesDesign) { <li class="menu-mobile__item dw-mod"> <div class="menu-mobile__link__wrap"> <input id="MobileMenuCheck_Language_back" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(0);" /> <label for="MobileMenuCheck_Language_back" class="menu-mobile__trigger menu-mobile__trigger--back"></label> <label for="MobileMenuCheck_Language_back" class="menu-mobile__link dw-mod ">@Translate("Back")</label> </div> </li> } @foreach (var lang in Model.Languages) { <li class="menu-mobile__item dw-mod"> <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod menu-mobile__link--level-1" href="/Default.aspx?ID=@lang.Page.ID">@lang.Name</a> </li> } </ul> </li> }</text> } else { <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @functions { BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master"); } @{ Block masterTools = new Block() { Id = "MasterDesktopTools", SortId = 10, Template = RenderDesktopTools(), SkipRenderBlocksList = true, BlocksList = new List<Block> { new Block { Id = "MasterDesktopToolsText", SortId = 10, Template = RenderDesktopToolsText(), Design = new Design { Size = "auto", HidePadding = true, RenderType = RenderType.Column } }, new Block { Id = "MasterDesktopToolsNavigation", SortId = 20, Template = RenderDesktopToolsNavigation(), Design = new Design { Size = "auto-width", HidePadding = true, RenderType = RenderType.Column } } } }; headerBlocksPage.Add("MasterHeader", masterTools); Block masterDesktopExtra = new Block() { Id = "MasterDesktopExtra", SortId = 10, Template = RenderDesktopExtra(), SkipRenderBlocksList = true }; headerBlocksPage.Add("MasterHeader", masterDesktopExtra); Block masterDesktopNavigation = new Block() { Id = "MasterDesktopNavigation", SortId = 20, Template = RenderDesktopNavigation(), SkipRenderBlocksList = true }; headerBlocksPage.Add("MasterHeader", masterDesktopNavigation); } @* Include the Blocks for the page *@ @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ Block masterDesktopLogo = new Block { Id = "MasterDesktopLogo", SortId = 10, Template = RenderDesktopLogo(), Design = new Design { Size = "auto-width", HidePadding = true, RenderType = RenderType.Column, CssClass = "grid--align-self-center" } }; BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo); } @helper RenderDesktopLogo() { string firstPageId = Model.Area.FirstActivePage.ID.ToString(); string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : ""; alignClass = topLayout == "splitted-center" ? "u-middle" : alignClass; string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png"; if (Path.GetExtension(logo).ToLower() != ".svg") { int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight"); logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40; logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&amp;crop=5&amp;Compression=75&amp;image=" + logo; } else { logo = HttpUtility.UrlDecode(logo); } <div class="logo @alignClass dw-mod"> <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block"> <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" /> </a> </div> } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @functions { bool isMegaMenu; } @{ isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false; Block masterDesktopMenu = new Block { Id = "MasterDesktopMenu", SortId = 10, Template = RenderDesktopMenu(), Design = new Design { Size = "auto", HidePadding = true, RenderType = RenderType.Column } }; if (isMegaMenu) { masterDesktopMenu.Design.CssClass = "u-reset-position"; } BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu); } @helper RenderDesktopMenu() { string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : ""; menuAlignment = topLayout == "minimal-center" ? "grid--align-self-center" : topLayout; string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders"); int startLevel = renderPagesInToolBar ? 1 : 0; string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"); <div class="grid__cell u-flex @(isMegaMenu ? "u-reset-position" : "") @menuAlignment"> @if (!isMegaMenu) { @RenderNavigation(new { id = "topnavigation", cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", startLevel = startLevel, ecomStartLevel = startLevel + 1, endlevel = 5, expandmode = "all", template = "BaseMenuWithDropdown.xslt" }); } else { @RenderNavigation(new { id = "topnavigation", cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", startLevel = startLevel, ecomStartLevel = startLevel + 1, endlevel = 5, promotionImage = megamenuPromotionImage, promotionLink = promotionLink, expandmode = "all", showOnlyHeaders = showOnlyHeaders.ToString().ToLower(), template = "BaseMegaMenu.xslt" }); } </div> } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ Block masterDesktopActionsMenu = new Block { Id = "MasterDesktopActionsMenu", SortId = 10, Template = RenderDesktopActionsMenu(), Design = new Design { CssClass = "u-flex" }, SkipRenderBlocksList = true }; BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu); if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"))) { Block masterDesktopActionsHeaderButton = new Block { Id = "MasterDesktopActionsHeaderButton", SortId = 60, Template = RenderHeaderButton() }; masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton); } } @helper RenderDesktopActionsMenu() { List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList(); <ul class="menu u-flex dw-mod"> @RenderBlockList(subBlocks) </ul> } @helper RenderHeaderButton() { string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText"); string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"); string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : ""; <li class="menu__item menu__item--horizontal menu--clean dw-mod"> <a class="btn @headerButtonType dw-mod u-no-margin u-margin-left" href="@headerButtonLink">@headerButtonText</a> </li> } @*@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Core; @using System.Text.RegularExpressions @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ Block masterDesktopActionsMenuLanguageSelector = new Block { Id = "MasterDesktopActionsMenuLanguageSelector", SortId = 40, Template = RenderLanguageSelector() }; BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector); } @helper RenderLanguageSelector() { string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; string languageViewType = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("LanguageSelector").SelectedValue) ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("LanguageSelector").SelectedValue.ToLower() : ""; if (Model.Languages.Count > 1) { <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod"> <div class="@menuLinkClass dw-mod" title="@Translate("Language")"> <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i> </div> <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell"> @foreach (var lang in Model.Languages) { string widthClass = "menu__item--fixed-width"; string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty); cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1); if (languageViewType == "flag-culture") { langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span> " + cultureName; } if (languageViewType == "flag") { langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span>"; widthClass = ""; } if (languageViewType == "name") { langInfo = lang.Name; } if (languageViewType == "culture") { langInfo = cultureName; widthClass = ""; } <div class="menu__item dw-mod @widthClass"> <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__link dw-mod">@langInfo</a> </div> } </div> </li> } }*@ @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Core; @using System.Text.RegularExpressions @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ var customSettings = Pageview.AreaSettings.GetItem("Custom").GetItem("CustomSettings"); bool showAreaAndLanguageNavigation = customSettings.GetBoolean("ShowSectionBar"); // do not show standard language selector if the custom navigation pane is enabled in website if (!showAreaAndLanguageNavigation) { Block masterDesktopActionsMenuLanguageSelector = new Block { Id = "MasterDesktopActionsMenuLanguageSelector", SortId = 40, Template = RenderLanguageSelector() }; BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector); } } @functions { public class LanguageLink { public string CountryCode { get; set; } public string LanguageName { get; set; } public string Link { get; set; } public bool OpenInNewTab { get; set; } } } @helper RenderLanguageSelector() { var languageLinks = new List<LanguageLink>(); string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; string languageViewType = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("LanguageSelector").SelectedValue) ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("LanguageSelector").SelectedValue.ToLower() : ""; IList<Dynamicweb.Frontend.ItemViewModel> customLanguageLinks = Model.Area.Item.GetItem("Custom").GetItem("CustomSettings").GetItems("LanguageLinks"); foreach (var lang in customLanguageLinks) { var languageLink = new LanguageLink { CountryCode = lang.GetString("CountryCode"), LanguageName = lang.GetString("Name"), Link = lang.GetString("Link"), OpenInNewTab = lang.GetBoolean("OpenInNewTab") }; languageLinks.Add(languageLink); } foreach (var lang in Model.Languages) { string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty); var languageLink = new LanguageLink { CountryCode = lang.Culture.Substring(3, 2), LanguageName = cultureName, Link = $"/Default.aspx?AreaID={Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID}", OpenInNewTab = false }; languageLinks.Add(languageLink); } foreach (var languageLink in languageLinks) { string cultureName = string.Empty; string langInfo = "<span class=\"flag-icon flag-icon-" + languageLink.CountryCode + " u-margin-right\"></span>" + languageLink.LanguageName; if (!string.IsNullOrEmpty(languageLink.LanguageName)) { cultureName = char.ToUpper(languageLink.LanguageName[0]) + languageLink.LanguageName.Substring(1); ; } if (languageViewType == "flag-culture") { langInfo = "<span class=\"flag-icon flag-icon-" + languageLink.CountryCode.ToLower() + " \"></span> " + cultureName; } if (languageViewType == "flag") { langInfo = "<span class=\"flag-icon flag-icon-" + languageLink.CountryCode.ToLower() + " \"></span>"; } if (languageViewType == "name") { langInfo = languageLink.LanguageName; } if (languageViewType == "culture") { langInfo = cultureName; } <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod"> <div class="@menuLinkClass dw-mod" title="@Translate("Language")"> <a href="@languageLink.Link" target="@(languageLink.OpenInNewTab ? "_blank" : "_self")" class="dw-mod">@langInfo</a> </div> </li> } } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @using S_DW_BKI.CustomModules.Extensions @{ Block masterDesktopActionsMenuSignIn = new Block { Id = "MasterDesktopActionsMenuSignIn", SortId = 20, Template = RenderSignIn() }; BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuSignIn); } @helper RenderSignIn() { bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); string userInitials = ""; int pageId = Model.TopPage.ID; int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard"); int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); int myOrderDraftsPageId = GetPageIdByNavigationTag("OrderDraft"); int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); bool hideMyOrderDraftsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrderDrafts"); bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink"); string linkStart = "/Default.aspx?ID="; if (Model.CurrentUser.ID <= 0) { linkStart += signInProfilePageId + "&RedirectPageId="; } string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; string myProfilePageLink = linkStart + myProfilePageId; string myOrdersPageLink = linkStart + myOrdersPageId; string myFavoritesPageLink = linkStart + myFavoritesPageId; string mySavedCardsPageLink = linkStart + mySavedCardsPageId; string myOrderDraftsLink = linkStart + myOrderDraftsPageId; string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user"; string favoritesIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue : "fa fa-star"; string orderDraftsIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon").SelectedValue : "fa fa-clipboard"; string previouslyBoughtIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-clipboard"; // START CUSTOM int myPreviouslyBoughtPageId = GetPageIdByNavigationTag("CustomerPreviouslyBought"); bool hideMyPreviouslyBought = Model.Area.Item.GetItem("Custom").GetItem("CustomSettings").GetBoolean("SignInHidePreviouslyBought"); string myPreviouslyBoughtLink = linkStart + myPreviouslyBoughtPageId; // END CUSTOM if (Model.CurrentUser.ID != 0) { userInitials = Dynamicweb.Rapido.Services.User.GetInitials(Model.CurrentUser.Name, Model.CurrentUser.FirstName, Model.CurrentUser.LastName, Model.CurrentUser.Email, Model.CurrentUser.UserName); } if (!navigationItemsHideSignIn) { string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean"; string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod"> <div class="@menuLinkClass dw-mod"> @if (Model.CurrentUser.ID <= 0) { <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x" title="@Translate("Sign in")"></i> } else { <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit" title="@Translate("Customer center")"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a> } </div> <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod"> <ul class="list list--clean dw-mod"> @if (Model.CurrentUser.ID <= 0) { <li> <label for="SignInModalTrigger" class="btn btn--primary btn--full u-no-margin sign-in-modal-trigger-button dw-mod" onclick="setTimeout(function () { document.getElementById('LoginUsername').focus() }, 10)">@Translate("Sign in")</label> </li> if (!hideCreateAccountLink) { @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account")); } if (!hideForgotPasswordLink) { @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?")) } if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) { @RenderSeparator() } } @if (!hideMyProfileLink) { @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon) } @if (!hideMyFavoritesLink) { // START CUSTOM if (Pageview.User != null) { var favoriteList = Pageview.User.GetFavoriteListId(); if (favoriteList != null) { int productsPageId = GetPageIdByNavigationTag("ProductsPage"); myFavoritesPageLink = $"/Default.aspx?ID={productsPageId}&ListId={favoriteList.ListId}&ListName={favoriteList.Name}"; } } @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon) // END CUSTOM } @* START CUSTOM *@ @if (!hideMyPreviouslyBought) { @RenderListItem(myPreviouslyBoughtLink, Translate("My previously bought"), "fas fa-th") } @* END CUSTOM *@ @if (!hideMyOrdersLink) { @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list") } @if (!hideMySavedCardsLink) { @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card") } @if (!hideMyOrderDraftsLink) { @RenderListItem(myOrderDraftsLink, Translate("My Order drafts"), orderDraftsIcon) } @if (Model.CurrentUser.ID > 0) { if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) { @RenderSeparator() } //Check if impersonation is on if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) { <li> <div class="list__link dw-mod" onclick="document.getElementById('StopImpersonationModalTrigger').checked = true;"> @Translate("Sign out") </div> </li> } else { @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out")) } } </ul> </div> </li> } } @helper RenderListItem(string link, string text, string icon = null) { <li> <a href="@link" class="list__link dw-mod" onclick="RememberState.SetCookie('useAnotherAddress', false)"> @if (!string.IsNullOrEmpty(icon)) {<i class="@icon u-margin-right"></i>}@text </a> </li> } @helper RenderSeparator() { <li class="list__seperator dw-mod"></li> } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); Block masterDesktopActionsMenuFavorites = new Block { Id = "MasterDesktopActionsMenuFavorites", SortId = 30, Template = RenderFavorites() }; if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0) { BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites); } } @helper RenderFavorites() { int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId; string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; string liClasses = topLayout != "normal" && topLayout != "splitted-center" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod" title="@Translate("Favorites")"> <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i> </a> </li> } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @using Dynamicweb.Rapido.Services @{ bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !hideCart) { Block masterDesktopActionsMenuMiniCart = new Block { Id = "MasterDesktopActionsMenuMiniCart", SortId = 60, Template = RenderMiniCart(miniCartLayout == "dropdown"), SkipRenderBlocksList = true, BlocksList = new List<Block>() }; Block miniCartCounterScriptTemplate = new Block { Id = "MiniCartCounterScriptTemplate", Template = RenderMiniCartCounterContent() }; //dropdown layout is default RazorEngine.Templating.TemplateWriter layoutTemplate; RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate; switch (miniCartLayout) { case "dropdown": layoutTemplate = RenderMiniCartDropdownLayout(); miniCartTriggerTemplate = RenderMiniCartTriggerLink(); break; case "panel": layoutTemplate = RenderMiniCartPanelLayout(); miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); break; case "modal": layoutTemplate = RenderMiniCartModalLayout(); miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); break; case "none": default: layoutTemplate = RenderMiniCartDropdownLayout(); miniCartTriggerTemplate = RenderMiniCartTriggerLink(); break; } masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block { Id = "MiniCartTrigger", Template = miniCartTriggerTemplate }); if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") { masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block { Id = "MiniCartLayout", Template = layoutTemplate }); } BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuMiniCart); BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); } if (hideCart && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) { BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block { Id = "CartInitialization" }); } } @helper RenderMiniCart(bool hasMouseEnterEvent) { List<Block> subBlocks = this.masterPage.GetBlockListById("MasterDesktopActionsMenuMiniCart").OrderBy(item => item.SortId).ToList(); string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; string liClasses = topLayout != "normal" ? "menu__item--top-level" : "menu--clean"; int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); string mouseEvent = ""; string id = "MiniCart"; if (hasMouseEnterEvent) { mouseEvent = "onmouseenter=\"Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=" + miniCartFeedPageId + "&feedType=MiniCart')\""; id = "miniCartTrigger"; } <li class="menu__item menu__item--horizontal menu__item--icon @liClasses dw-mod" id="@id" @mouseEvent> @RenderBlockList(subBlocks) </li> } @helper RenderMiniCartTriggerLabel() { int cartPageId = GetPageIdByNavigationTag("CartPage"); string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); <div class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')" title="@Translate("Cart")"> <div class="u-inline u-position-relative"> <i class="@cartIcon fa-1_5x"></i> @RenderMiniCartCounter() </div> </div> } @helper RenderMiniCartTriggerLink() { int cartPageId = GetPageIdByNavigationTag("CartPage"); string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button" title="@Translate("Cart")"> <span class="u-inline u-position-relative"> <i class="@cartIcon fa-1_5x"></i> @RenderMiniCartCounter() </span> </a> } @helper RenderMiniCartCounter() { int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); string cartProductsCount = Model.Cart.TotalProductsCount.ToString(); string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; if (showPrice && counterPosition == "right") { cartProductsCount = Translate("Cart") + " (" + cartProductsCount + ")"; } <span class="mini-cart__counter @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod"> <span class="js-handlebars-root js-mini-cart-counter" id="cartCounter" data-template="MiniCartCounterContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=Counter" data-init-onload="false" data-preloader="false"> <span class="js-mini-cart-counter-content" data-count="@Model.Cart.TotalProductsCount.ToString()"> @cartProductsCount @cartProductsTotalPrice </span> </span> </span> } @helper RenderMiniCartCounterContent() { bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice; <script id="MiniCartCounterContent" type="text/x-template"> {{#.}} <span class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> @if (showPriceInMiniCartCounter) { @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> } else { <text>{{numberofproducts}}</text> } </span> {{/.}} </script> } @helper RenderMiniCartDropdownLayout() { int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); <div class="mini-cart mini-cart-dropdown js-mini-cart grid__cell dw-mod" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="dropdown" data-cart-page-link="@cartPageLink"> <div class="mini-cart-dropdown__inner dw-mod"> <h3 class="u-ta-center dw-mod">@Translate("Shopping cart")</h3> <div class="mini-cart-dropdown__body u-flex dw-mod"> <div class="js-handlebars-root u-flex grid--direction-column u-full-width dw-mod" id="miniCartContent" data-template="MiniCartContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> </div> </div> </div> } @helper RenderMiniCartPanelLayout() { int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); <div class="mini-cart grid__cell dw-mod"> <input type="checkbox" id="miniCartTrigger" class="panel-trigger" /> <div class="panel panel--right panel--with-close-btn dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink"> <label for="miniCartTrigger" class="panel__close-btn" title="@Translate("Close panel")"><i class="fas fa-times"></i></label> <div class="panel__content u-full-width dw-mod"> <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3> <div class="panel__content-body panel__content-body--cart dw-mod"> <div class="js-handlebars-root u-flex grid--direction-column u-full-height dw-mod" id="miniCartContent" data-template="MiniCartContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> </div> </div> </div> </div> } @helper RenderMiniCartModalLayout() { int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); <div class="mini-cart grid__cell dw-mod"> <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" /> <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink"> <label for="miniCartTrigger" class="modal-overlay"></label> <div class="modal modal--md modal--top-right dw-mod"> <div class="modal__body u-flex grid--direction-column dw-mod"> <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3> <div class="js-handlebars-root u-flex grid--direction-column dw-mod" id="miniCartContent" data-template="MiniCartContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> </div> <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label> </div> </div> </div> } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ bool showOrderDraftLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOrderDraftIcon"); Block masterDesktopActionsMenuOrderDraft = new Block { Id = "MasterDesktopActionsMenuOrderDraft", SortId = 40, Template = RenderOrderDraft() }; if (showOrderDraftLink && Model.CurrentUser.ID > 0) { BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuOrderDraft); } } @helper RenderOrderDraft() { int OrderDraftPageId = GetPageIdByNavigationTag("OrderDraft"); string OrderDraftPageLink = "/Default.aspx?ID=" + OrderDraftPageId; string draftIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon").SelectedValue : "fa fa-clipboard"; string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> <a href="@OrderDraftPageLink" class="@menuLinkClass dw-mod" title="@Translate("My order drafts")"> <span class="u-inline u-position-relative"> <i class="@draftIcon fa-1_5x"></i> </span> </a> </li> } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart"); Block masterDesktopActionsMenuDownloadCart = new Block { Id = "MasterDesktopActionsMenuDownloadCart", SortId = 50, Template = RenderDownloadCart() }; if (showDownloadCartLink && Model.CurrentUser.ID > 0) { BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuDownloadCart); } } @helper RenderDownloadCart() { int downloadCartPageId = GetPageIdByNavigationTag("DownloadCart"); string downloadCartPageLink = "/Default.aspx?ID=" + downloadCartPageId; string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> <a href="@downloadCartPageLink" class="@menuLinkClass dw-mod" title="@Translate("Download cart")"> <span class="u-inline u-position-relative"> <i class="fas fa-cart-arrow-down fa-1_5x"></i> <span class="mini-cart__counter u-hidden @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod js-download-cart-counter"></span> </span> </a> </li> } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @functions { public class SearchConfiguration { public string searchFeedId { get; set; } public string searchSecondFeedId { get; set; } public int groupsFeedId { get; set; } public string resultPageLink { get; set; } public string searchPlaceholder { get; set; } public string searchType { get; set; } public string searchTemplate { get; set; } public string searchContentTemplate { get; set; } public string searchValue { get; set; } public bool showGroups { get; set; } public SearchConfiguration() { searchFeedId = ""; searchSecondFeedId = ""; searchType = "product-search"; searchContentTemplate = ""; showGroups = true; } } } @{ Block masterSearchBar = new Block { Id = "MasterSearchBar", SortId = 40, Template = RenderSearch("bar"), Design = new Design { Size = "auto", HidePadding = true, RenderType = RenderType.Column } }; Block masterSearchAction = new Block { Id = "MasterDesktopActionsMenuSearch", SortId = 10, Template = RenderSearch() }; BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar); BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction); } @helper RenderSearch(string type = "mini-search") { string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage")); string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch"; SearchConfiguration searchConfiguration = null; switch (searchType) { case "contentSearch": searchConfiguration = new SearchConfiguration() { searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", resultPageLink = contentSearchPageLink, searchPlaceholder = Translate("Search page"), groupsFeedId = 0, searchType = "content-search", searchTemplate = "SearchPagesTemplate", showGroups = false }; break; case "combinedSearch": searchConfiguration = new SearchConfiguration() { searchFeedId = productsPageId + "&feed=true", searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", resultPageLink = Converter.ToString(productsPageId), searchPlaceholder = Translate("Search products or pages"), groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), searchType = "combined-search", searchTemplate = "SearchProductsTemplateWrap", searchContentTemplate = "SearchPagesTemplateWrap", showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") }; break; default: //productSearch searchConfiguration = new SearchConfiguration() { resultPageLink = Converter.ToString(productsPageId), searchFeedId = productsPageId + "&feed=true", groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), searchPlaceholder = Translate("Search products"), searchTemplate = "SearchProductsTemplate", searchType = "product-search", showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") }; break; } searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; if (type == "mini-search") { @RenderMiniSearch(searchConfiguration) } else { @RenderSearchBar(searchConfiguration) } } @helper RenderSearchBar(SearchConfiguration options) { <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar" data-page-size="7" data-search-feed-id="@options.searchFeedId" data-search-second-feed-id="@options.searchSecondFeedId" data-result-page-id="@options.resultPageLink" data-groups-page-id="@options.groupsFeedId" data-search-type="@options.searchType"> @if (options.showGroups) { <button type="button" class="btn btn--condensed u-color-light-gray--bg typeahead-group-btn dw-mod js-typeahead-groups-btn" data-group-id="all">@Translate("All")</button> <ul class="dropdown dropdown--absolute-position u-min-w220px js-handlebars-root js-typeahead-groups-content dw-mod" id="ProductSearchBarGroupsContent" data-template="SearchGroupsTemplate" data-json-feed="/Default.aspx?ID=@options.groupsFeedId&feedType=productGroups" data-init-onload="false" data-preloader="minimal"></ul> } <div class="typeahead-search-field"> <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue"> @if (string.IsNullOrEmpty(options.searchSecondFeedId)) { <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></ul> } else { <div class="dropdown dropdown--absolute-position dropdown--combined grid"> <div class="js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-init-onload="false"></div> <div class="js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="ContentSearchBarContent" data-template="@options.searchContentTemplate" data-init-onload="false"></div> </div> } </div> <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn" title="@Translate("Search")"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button> </div> } @helper RenderMiniSearch(SearchConfiguration options) { string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; <li class="menu__item menu__item--horizontal menu__item--top-level menu__item--icon u-hidden-xxs is-dropdown is-dropdown--no-icon dw-mod" id="miniSearchIcon"> <div class="@menuLinkClass dw-mod" title="@Translate("Search")"> <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> </div> <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod"> <div class="typeahead js-typeahead" id="ProductSearchBar" data-page-size="7" data-search-feed-id="@options.searchFeedId" data-search-second-feed-id="@options.searchSecondFeedId" data-result-page-id="@options.resultPageLink" data-search-type="@options.searchType"> <div class="typeahead-search-field"> <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue"> @if (string.IsNullOrEmpty(options.searchSecondFeedId)) { <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></ul> } else { <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> <div class="js-handlebars-root js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></div> <div class="js-handlebars-root js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="ContentSearchBarContent" data-template="@options.searchContentTemplate" data-json-feed="/Default.aspx?ID=@options.searchSecondFeedId" data-init-onload="false"></div> </div> } </div> </div> </div> </li> } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ string headerConfigurationTopLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; bool headerConfigurationHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master"); Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo"); headerConfigurationPage.RemoveBlock(configDesktopLogo); Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu"); headerConfigurationPage.RemoveBlock(configDesktopMenu); Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar"); headerConfigurationPage.RemoveBlock(configSearchBar); Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch"); headerConfigurationPage.RemoveBlock(configSearchAction); Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu"); headerConfigurationPage.RemoveBlock(configDesktopActionsMenu); Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra"); switch (headerConfigurationTopLayout) { case "condensed": //2 configDesktopLogo.Design.Size = "auto-width"; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); configDesktopMenu.SortId = 20; configDesktopMenu.Design.Size = "auto"; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); configDesktopActionsMenu.SortId = 30; configDesktopActionsMenu.Design.Size = "auto-width"; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); if (!headerConfigurationHideSearch) { configSearchBar.SortId = 40; configSearchBar.Design.Size = "12"; configDesktopExtra.SortId = 50; headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); } break; case "splitted": //3 configDesktopLogo.Design.Size = "auto"; headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); if (!headerConfigurationHideSearch) { configSearchBar.SortId = 20; configSearchBar.Design.Size = "auto"; headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); } headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); configDesktopActionsMenu.SortId = 20; configDesktopActionsMenu.Design.Size = "auto-width"; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); break; case "splitted-center": //4 configDesktopLogo.Design.Size = "auto"; headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); configDesktopActionsMenu.SortId = 30; configDesktopActionsMenu.Design.Size = "auto-width"; headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu); if (!headerConfigurationHideSearch) { headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); } break; case "minimal": //5 configDesktopLogo.Design.Size = "auto-width"; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); configDesktopMenu.Design.Size = "auto"; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); configDesktopActionsMenu.SortId = 20; configDesktopActionsMenu.Design.Size = "auto-width"; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); if (!headerConfigurationHideSearch) { headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); } break; case "minimal-center": //6 configDesktopLogo.Design.Size = "auto-width"; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); configDesktopMenu.Design.Size = "auto"; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); configDesktopActionsMenu.SortId = 20; configDesktopActionsMenu.Design.Size = "auto-width"; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); if (!headerConfigurationHideSearch) { headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); } break; case "minimal-right": //7 configDesktopLogo.Design.Size = "auto-width"; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); configDesktopMenu.Design.Size = "auto"; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); configDesktopActionsMenu.SortId = 20; configDesktopActionsMenu.Design.Size = "auto-width"; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); if (!headerConfigurationHideSearch) { headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); } break; case "two-lines": //8 configDesktopLogo.Design.Size = "auto"; headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); configDesktopActionsMenu.SortId = 20; configDesktopActionsMenu.Design.Size = "auto-width"; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); if (!headerConfigurationHideSearch) { headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); } break; case "two-lines-centered": //9 configDesktopLogo.Design.Size = "auto"; headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); configDesktopMenu.Design.Size = "auto-width"; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); configDesktopActionsMenu.SortId = 20; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); if (!headerConfigurationHideSearch) { headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); } break; case "normal": //1 default: headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); if (!headerConfigurationHideSearch) { configSearchBar.SortId = 20; headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); } configDesktopActionsMenu.SortId = 30; headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu); configDesktopActionsMenu.Design.Size = "auto-width"; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); break; } } @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Frontend.PageViewModel> 2 3 @using System 4 @using System.Web 5 @using Dynamicweb.Rapido.Blocks.Extensibility 6 @using Dynamicweb.Rapido.Blocks 7 @using Dynamicweb 8 9 @{ 10 BlocksPage customBlocks = BlocksPage.GetBlockPage("Master"); 11 12 Block schemaMarkupBlock = new Block 13 { 14 Id = "SchemaMarkup", 15 SortId = 200, 16 Template = RenderSchemaMarkup() 17 }; 18 19 customBlocks.Add(schemaMarkupBlock); 20 21 Block loginModalCheck = new Block 22 { 23 Id = "loginModal", 24 SortId = 201, 25 Template = RenderLoginModal() 26 }; 27 28 customBlocks.Add(loginModalCheck); 29 } 30 31 @helper RenderSchemaMarkup() 32 { 33 //ItemViewModel settings 34 var settingsItem = Pageview.AreaSettings.GetItem("Settings"); 35 var layoutItem = Pageview.AreaSettings.GetItem("Layout"); 36 var addressItem = settingsItem.GetItem("Address"); 37 string logoSource = layoutItem.GetString("LogoImage"); 38 //string name = Pageview.AreaSettings.GetItem("Settings").GetString("BusinessName"); 39 string siteUrl = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Host; 40 //string city = Pageview.AreaSettings.GetItem("Settings"); 41 42 string businessPhotoPath = settingsItem.GetFile("BusinessPhoto") != null ? settingsItem.GetFile("BusinessPhoto").Path : ""; 43 string businessName = settingsItem.GetString("BusinessName"); 44 string streetAddress = addressItem.GetString("StreetAddress"); 45 string addressLocality = addressItem.GetString("City"); 46 string addressRegion = addressItem.GetString("Region"); 47 string postalCode = addressItem.GetString("PostalCode"); 48 string addressCountry = addressItem.GetString("Country"); 49 List<string> strings = new List<string>(); 50 51 string contactEmail = settingsItem.GetString("ContactEmail"); 52 string contactNumber = settingsItem.GetString("ContactNumber"); 53 string[] openingHours = settingsItem.GetString("OpeningHours").Split( 54 new[] { Environment.NewLine }, 55 StringSplitOptions.None 56 ); 57 58 var currency = Pageview.Area.EcomCountryCode; 59 string searchParameter = !String.IsNullOrEmpty(HttpContext.Current.Request["Search"]) ? HttpContext.Current.Request["Search"] : ""; 60 int areaId = Pageview.AreaID; 61 string pageType = Pageview.Page.ItemType; 62 int searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed"); 63 string siteUrlWithoutQuery = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Host; 64 var searchQuery = HttpContext.Current.Request.QueryString.Get("Search"); 65 66 <script type="application/ld+json"> 67 { 68 "@@context": "http://schema.org", 69 "@@type": ["Organization", "LocalBusiness"], 70 @if (!string.IsNullOrEmpty(businessPhotoPath)) 71 { 72 <text> 73 "image": [ 74 "@siteUrl/Admin/Public/GetImage.ashx?width=400&height=400&crop=0&Compression=75&DoNotUpscale=true&image=@businessPhotoPath", 75 "@siteUrl/Admin/Public/GetImage.ashx?width=400&height=300&crop=0&Compression=75&DoNotUpscale=true&image=@businessPhotoPath", 76 "@siteUrl/Admin/Public/GetImage.ashx?width=448&height=225&crop=0&Compression=75&DoNotUpscale=true&image=@businessPhotoPath" 77 ], 78 </text> 79 } 80 "url": "@siteUrl", 81 "name": "@businessName", 82 "logo": "@siteUrl@logoSource", 83 "address": { 84 "@@type": "PostalAddress", 85 "streetAddress": "@streetAddress", 86 "addressLocality": "@addressLocality", 87 "postalCode": "@postalCode", 88 "addressCountry": "@addressCountry" 89 }, 90 "contactPoint": [ 91 { 92 "@@type": "ContactPoint", 93 "telephone": "@contactNumber", 94 "email": "@contactEmail", 95 "contactType": "Customer service", 96 "areaServed": "DK", 97 "hoursAvailable": [ 98 { 99 "@@type": "OpeningHoursSpecification", 100 "opens": "08:00:00", 101 "closes": "16:00:00", 102 "dayOfWeek": [ 103 "http://schema.org/Monday", 104 "http://schema.org/Tuesday", 105 "http://schema.org/Wednesday", 106 "http://schema.org/Thursday" 107 ] 108 }, 109 { 110 "@@type": "OpeningHoursSpecification", 111 "opens": "08:00:00", 112 "closes": "15:30:00", 113 "dayOfWeek": [ 114 "http://schema.org/Friday" 115 ] 116 } 117 ] 118 } 119 ], 120 @if (!string.IsNullOrEmpty(contactEmail)) 121 { 122 <text>"email": "@contactEmail",</text> 123 } 124 @if (!string.IsNullOrEmpty(contactNumber)) 125 { 126 <text>"telephone": "@contactNumber"</text> 127 } 128 } 129 130 </script> 131 } 132 133 @helper RenderLoginModal() 134 { 135 <script> 136 @if (!Pageview.IsCurrentUserAllowed && Model.CurrentUser.ID <= 0) 137 { 138 <text> 139 document.getElementById('SignInModalTrigger').checked = !document.getElementById('SignInModalTrigger').checked 140 setTimeout(function() { document.getElementById('LoginUsername').focus() }, 10) 141 </text> 142 } 143 </script> 144 } @helper RenderDesktopTools() { List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList(); <div class="tools-navigation dw-mod"> <div class="center-container grid top-container__center-container dw-mod"> @RenderBlockList(subBlocks) </div> </div> } @helper RenderDesktopToolsText() { string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText"); if (!string.IsNullOrEmpty(toolsText)) { <div class="u-margin-top u-margin-bottom">@toolsText</div> } } @helper RenderDesktopToolsNavigation() { bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); if (renderPagesInToolBar) { @RenderNavigation(new { id = "topToolsNavigation", cssclass = "menu menu-tools dw-mod dwnavigation", template = "TopMenu.xslt" }) } } @helper RenderDesktopNavigation() { List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList(); string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : ""; <nav class="main-navigation dw-mod"> <div class="center-container top-container__center-container grid @alignClass dw-mod"> @RenderBlockList(subBlocks) </div> </nav> } @helper RenderDesktopExtra() { List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList(); if (subBlocks.Count > 0) { <div class="header header-top dw-mod"> <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod"> @RenderBlockList(subBlocks) </div> </div> } }</text> } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Frontend @functions { int impersonationPageId; string impersonationLayout; int impersonationFeed; Block impersonationBar; string getUserNameFromParams(string firstName, string middleName, string lastName, string name, string email, string userName) { string username = ""; if (!string.IsNullOrEmpty(firstName) && !string.IsNullOrEmpty(lastName)) { username = firstName + " " + (!string.IsNullOrEmpty(middleName) ? middleName + " " : "") + lastName; } else if (!string.IsNullOrEmpty(name)) { username = name; } else if (!string.IsNullOrEmpty(email)) { username = email; } else { username = userName; } return username; } string getUserName(UserViewModel user) { return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName); } string getUserName(Dynamicweb.Security.UserManagement.User user) { return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName); } } @{ impersonationPageId = GetPageIdByNavigationTag("Impersonation"); impersonationLayout = Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout") != null ? Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout").SelectedValue : "bar"; impersonationFeed = GetPageIdByNavigationTag("UsersFeed"); if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0) { impersonationBar = new Block { Id = "ImpersonationBar", SortId = 50, Template = RenderImpersonation(), SkipRenderBlocksList = true, Design = new Design { Size = "auto-width", HidePadding = true, RenderType = RenderType.Column } }; if (impersonationLayout == "top-bar") { impersonationBar.SortId = 9; } Block impersonationContent = new Block { Id = "ImpersonationContent", SortId = 20 }; if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) { //Render stop impersonation view impersonationContent.Template = RenderStopImpersonationView(); Modal stopImpersonation = new Modal { Id = "StopImpersonation", Heading = new Heading { Level = 2, Title = Translate("Sign out"), Icon = new Icon { Name = "fa-sign-out", Prefix = "fas", LabelPosition = IconLabelPosition.After } }, Width = ModalWidth.Sm, BodyTemplate = RenderStopImpersonationForm() }; Block stopImpersonationBlock = new Block { Id = "StopImpersonationBlock", SortId = 10, Component = stopImpersonation }; impersonationBar.BlocksList.Add(stopImpersonationBlock); } else { //Render main view switch (impersonationLayout) { case "right-lower-box": impersonationContent.BlocksList.Add( new Block { Id = "RightLowerBoxHeader", SortId = 10, Component = new Heading { Level = 5, Title = Translate("View the list of users you can sign in as"), CssClass = "impersonation-text" } } ); impersonationContent.BlocksList.Add( new Block { Id = "RightLowerBoxContent", SortId = 20, Template = RenderImpersonationControls() } ); break; case "right-lower-bar": impersonationContent.BlocksList.Add( new Block { Id = "RightLowerBarContent", SortId = 10, Template = RenderImpersonationControls() } ); break; case "bar": default: impersonationContent.BlocksList.Add( new Block { Id = "ViewListLink", SortId = 20, Template = RenderViewListLink() } ); impersonationContent.BlocksList.Add( new Block { Id = "BarTypeaheadSearch", SortId = 30, Template = RenderTypeaheadSearch() } ); break; } } impersonationBar.BlocksList.Add(impersonationContent); impersonationBar.BlocksList.Add( new Block { Id = "ImpersonationSearchTemplates", SortId = 30, Template = RenderSearchResultTemplate() } ); if (impersonationLayout != "bar" && impersonationLayout != "top-bar") { impersonationBar.BlocksList.Add( new Block { Id = "ImpersonationSearchScripts", SortId = 40, Template = RenderSearchScripts() } ); } BlocksPage.GetBlockPage("Master").Add("MasterHeader", impersonationBar); } } @helper RenderImpersonation() { List<Block> subBlocks = impersonationBar.BlocksList.OrderBy(item => item.SortId).ToList(); <input type="checkbox" class="impersonation-trigger js-remember-state" id="ImpersonationMinimizeTrigger" /> <div class="impersonation impersonation--@(impersonationLayout)-layout dw-mod" id="Impersonation"> @if (impersonationLayout == "right-lower-box") { @RenderRightLowerBoxHeader() } <div class="center-container top-container__center-container impersonation__container @(impersonationLayout != "bar" && impersonationLayout != "top-bar" ? "impersonation__container--box" : "") dw-mod"> @*Impersonation*@ @RenderBlockList(subBlocks) </div> </div> } @helper RenderRightLowerBoxHeader() { <div class="impersonation__header dw-mod"> <div class="impersonation__title">@Translate("Impersonation")</div> <label for="ImpersonationMinimizeTrigger" class="btn btn--impersonation impersonation__minimize-btn dw-mod" onclick="this.blur();"> @Render(new Icon { Prefix = "fas", Name = "fa-window-minimize" }) </label> </div> } @helper RenderStopImpersonationView() { string secondaryUserName = getUserName(Model.CurrentSecondaryUser); string userName = getUserName(Pageview.User); string impersonationText = "<span class=\"impersonation-light-text dw-mod\">" + Translate("Logged in as") + "</span> <b>" + secondaryUserName + "</b> <span class=\"impersonation-light-text dw-mod\">" + Translate("by") + "</span> <b>" + userName + "</b> "; impersonationText = Dynamicweb.Security.UserManagement.User.ImpersonationMode == Dynamicweb.Security.UserManagement.UserImpersonation.Full ? "<span class=\"impersonation-light-text dw-mod\">" + Translate("Logged in as") + "</span> <b>" + userName + "</b> <span class=\"impersonation-light-text dw-mod\">" + Translate("by") + "</span> <b>" + secondaryUserName + "</b> " : impersonationText; if (impersonationLayout == "right-lower-box") { <div class="u-margin-bottom--lg u-ta-center"> @impersonationText </div> <div class="u-margin-bottom--lg u-ta-center"> @RenderSwitchAccountButton() </div> @RenderStopImpersonationButton() } else { <div class="grid grid--align-center impersonation__stop-wrap"> <div class="impersonation-bar-item dw-mod"> @impersonationText </div> <div class="impersonation-bar-item dw-mod"> @RenderSwitchAccountButton() </div> <div class="impersonation-bar-item dw-mod"> @RenderStopImpersonationButton() </div> </div> } } @helper RenderSwitchAccountButton() { @Render(new Button { Href = "/Default.aspx?ID=" + impersonationPageId, ButtonType = ButtonType.Button, ButtonLayout = ButtonLayout.Clean, Title = Translate("Switch account"), Icon = new Icon { Name = "fa-users", Prefix = "fal", LabelPosition = IconLabelPosition.After }, CssClass = "u-no-margin u-color-inherit" }) } @helper RenderStopImpersonationForm() { string secondaryUserName = getUserName(Model.CurrentSecondaryUser); string userName = getUserName(Pageview.User); int pageId = Model.TopPage.ID; <form method="post" class="u-no-margin"> @Render(new Button { ButtonType = ButtonType.Submit, ButtonLayout = ButtonLayout.Secondary, Title = Translate("Sign out as") + " " + userName, Href = "/Default.aspx?ID=" + impersonationPageId, CssClass = "btn--full", Name = "DwExtranetRemoveSecondaryUser" }) @Render(new Button { ButtonType = ButtonType.Submit, ButtonLayout = ButtonLayout.Secondary, Title = Translate("Sign out as") + " " + secondaryUserName, Href = "/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, CssClass = "btn--full", Name = "DwExtranetRemoveSecondaryUser" }) </form> } @helper RenderStopImpersonationButton() { @Render(new Button { ButtonType = ButtonType.Button, ButtonLayout = ButtonLayout.Clean, Title = Translate("Sign out"), Icon = new Icon { Name = "fa-sign-out", Prefix = "fal", LabelPosition = IconLabelPosition.After }, OnClick = "document.getElementById('StopImpersonationModalTrigger').checked = true", CssClass = "u-no-margin" }) } @helper RenderImpersonationControls() { <div class="impersonation__controls"> @RenderViewListLink() @RenderSearchBox() </div> @RenderResultsList() } @helper RenderViewListLink() { string title = impersonationLayout == "right-lower-box" ? Translate("View the list") : Translate("View the list of users you can sign in as"); string buttonClasses = impersonationLayout == "right-lower-box" ? "impersonation__button btn btn--impersonation" : "impersonation__link impersonation__link"; @Render(new Link { ButtonLayout = ButtonLayout.None, Title = title, Href = "/Default.aspx?ID=" + impersonationPageId, CssClass = buttonClasses }) } @helper RenderSearchBox() { <div class="impersonation__search-wrap"> <input placeholder="@Translate("Search users")" type="text" class="impersonation__search-field dw-mod" onkeyup="searchKeyUpHandler(event)" id="ImpersonationBoxSearchField"> <div id="ImpersonationBoxSearchFind" class="impersonation__search-icon dw-mod" onclick="updateResults(document.getElementById('ImpersonationBoxSearchField').value)"> <i class="fal fa-search"></i> </div> <div id="ImpersonationBoxSearchClear" class="impersonation__search-icon u-hidden dw-mod" onclick="clearResults();"> <i class="fal fa-times"></i> </div> </div> } @helper RenderTypeaheadSearch() { <div class="typeahead u-ta-right impersonation__typeahead js-typeahead dw-mod" id="ImpersonationSearchBar" data-page-size="5" data-search-feed-id="@impersonationFeed" data-result-page-id="@impersonationPageId" data-search-type="user-search" data-search-parameter-name="q"> <div class="typeahead-search-field"> <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" placeholder="@Translate("Search users")"> <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ImpersonationSearchBarContent" data-template="ImpersonationSearchResult" data-json-feed="/Default.aspx?ID=@impersonationFeed" data-init-onload="false"></ul> </div> </div> } @helper RenderResultsList() { <ul id="ImpersonationBoxSearchResults" class="impersonation__search-results js-handlebars-root dw-mod" data-template="ImpersonationSearchResult" data-json-feed="/Default.aspx?ID=@impersonationFeed" data-init-onload="false" data-preloader="minimal"></ul> } @helper RenderSearchResultTemplate() { <script id="ImpersonationSearchResult" type="text/x-template"> {{#.}} {{#Users}} <li class="impersonation__search-results-item impersonation-user"> <form method="post" class="impersonation-user__form" name="account{{id}}"> <input type="hidden" id="DWExtranetSecondaryUserSelector" name="DWExtranetSecondaryUserSelector" value="{{id}}"> <div class="impersonation-user__info"> <div class="impersonation-user__name">{{userName}}</div> <div class="impersonation-user__number">{{customerNumber}}</div> </div> @Render(new Button { ButtonType = ButtonType.Submit, ButtonLayout = ButtonLayout.Secondary, Title = Translate("Sign in as"), CssClass = "impersonation-user__sign-in-btn" + (impersonationLayout != "bar" ? " btn--impersonation" : "") }) </form> </li> {{/Users}} {{#unless Users}} <li class="impersonation__search-results-item impersonation__search-results-item--not-found"> @Translate("Your search gave 0 results") </li> {{/unless}} {{/.}} </script> } @helper RenderSearchScripts() { <script> let inputDelayTimer; function searchKeyUpHandler(e) { clearTimeout(inputDelayTimer); let value = e.target.value; if (value != "") { inputDelayTimer = setTimeout(function () { updateResults(value); }, 500); } else { clearResults(); } }; function updateResults(value) { if (value == "") { return null; } HandlebarsBolt.UpdateContent("ImpersonationBoxSearchResults", "/Default.aspx?ID=@impersonationFeed&q=" + value); document.getElementById("ImpersonationBoxSearchFind").classList.add("u-hidden"); document.getElementById("ImpersonationBoxSearchClear").classList.remove("u-hidden"); } function clearResults() { document.getElementById("ImpersonationBoxSearchField").value = ""; HandlebarsBolt.CleanContainer("ImpersonationBoxSearchResults"); document.getElementById("ImpersonationBoxSearchFind").classList.remove("u-hidden"); document.getElementById("ImpersonationBoxSearchClear").classList.add("u-hidden"); } </script> } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table"; Block orderLines = new Block { Id = "MiniCartOrderLines", SkipRenderBlocksList = true, BlocksList = new List<Block> { new Block { Id = "MiniCartOrderLinesList", SortId = 20, Template = RenderMiniCartOrderLinesList() } } }; Block orderlinesScriptTemplates = new Block { Id = "OrderlinesScriptTemplates" }; if (orderlinesView == "table") { orderLines.Template = RenderMiniCartOrderLinesTable(); orderLines.BlocksList.Add( new Block { Id = "MiniCartOrderlinesTableHeader", SortId = 10, Template = RenderMiniCartOrderLinesHeader() } ); orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates(); } else { orderLines.Template = RenderMiniCartOrderLinesBlocks(); orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates(); } miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates); Block miniCartScriptTemplates = new Block() { Id = "MasterMiniCartTemplates", SortId = 1, Template = RenderMiniCartScriptTemplates(), SkipRenderBlocksList = true, BlocksList = new List<Block> { orderLines, new Block { Id = "MiniCartFooter", Template = RenderMiniCartFooter(), SortId = 50, SkipRenderBlocksList = true, BlocksList = new List<Block> { new Block { Id = "MiniCartSubTotal", Template = RenderMiniCartSubTotal(), SortId = 30 }, new Block { Id = "MiniCartFees", Template = RenderMiniCartFees(), SortId = 40 }, new Block { Id = "MiniCartOrderAmountDiscount", Template = RenderMiniCartOrderAmountDiscount(), SortId = 45 }, new Block { Id = "MiniCartPoints", Template = RenderMiniCartPoints(), SortId = 50 }, new Block { Id = "MiniCartTotal", Template = RenderMiniCartTotal(), SortId = 60 }, new Block { Id = "MiniCartDisclaimer", Template = RenderMiniCartDisclaimer(), SortId = 70 }, new Block { Id = "MiniCartActions", Template = RenderMiniCartActions(), SortId = 80 } } } } }; miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates); } @helper RenderMiniCartOrderAmountDiscount() { <text> {{#if coffeeAmountDiscount}} <div class="grid"> <div class="grid__col-6 grid__col--bleed-y">@Translate("Coffee amount discount")</div> <div class="grid__col-6 grid__col--bleed-y grid--align-end"> {{coffeeAmountDiscount}} </div> </div> {{/if}} </text> } @helper RenderMiniCartScriptsTableTemplates() { <script id="MiniCartOrderline" type="text/x-template"> {{#unless isEmpty}} <tr> <td class="u-w60px"><a href="{{link}}" class="{{hideimage}}"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=50&height=50&crop=5&Compression=75&image={{image}}" alt="{{name}}" title="{{name}}"></a></td> <td class="u-va-middle"> <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a> {{#if variantname}} <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a> {{/if}} {{#if unitname}} <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div> {{/if}} </td> <td class="u-ta-right u-va-middle">{{quantity}}</td> <td class="u-ta-right u-va-middle"> {{#if pointsTotal}} <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") {{else}} {{totalprice}} {{/if}} </td> </tr> {{/unless}} </script> <script id="MiniCartOrderlineDiscount" type="text/x-template"> {{#unless isEmpty}} <tr class="table__row--no-border"> <td class="u-w60px">&nbsp;</td> <td><div class="mini-cart-orderline__name dw-mod">@Translate("Order line discount")</div></td> @*<td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td>*@ <td class="u-ta-right">&nbsp;</td> <td class="u-ta-right">{{totalprice}}</td> </tr> {{/unless}} </script> } @helper RenderMiniCartScriptsListTemplates() { int cartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); <script id="MiniCartOrderline" type="text/x-template"> {{#unless isEmpty}} <div class="mini-cart-orderline grid dw-mod"> <div class="grid__col-4"> <a href="{{link}}" class="{{hideimage}}"> <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=100&height=100&crop=5&Compression=75&image={{image}}" alt="{{name}}" title="{{name}}"> </a> </div> <div class="grid__col-8"> <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--truncate mini-cart-orderline__name--md u-padding-right--lg" title="{{name}}">{{name}}</a> {{#if variantname}} <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div> {{/if}} {{#if unitname}} <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div> {{/if}} <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div> <div class="grid__cell-footer"> <div class="grid__cell"> <div class="u-pull--left mini-cart-orderline__price dw-mod"> {{#if pointsTotal}} <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") {{else}} {{totalprice}} {{/if}} </div> <button type="button" title="@Translate("Remove orderline")" class="btn btn--clean btn--condensed u-pull--right mini-cart-orderline__remove-btn dw-mod" onclick="{{#if googleImpression}}googleImpressionRemoveFromCart({{googleImpression}});{{/if}}Cart.UpdateCart('miniCartContent', '/Default.aspx?ID=@cartFeedPageId', 'CartCmd=DelOrderLine&key={{orderLineId}}&redirect=false', true);"> @Translate("Remove") </button> </div> </div> </div> </div> {{/unless}} </script> <script id="MiniCartOrderlineDiscount" type="text/x-template"> {{#unless isEmpty}} <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod"> <div class="grid__col-4"> <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div> </div> <div class="grid__col-8">{{totalprice}}</div> </div> {{/unless}} </script> } @helper RenderMiniCartScriptTemplates() { List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage")); bool miniCartUseGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); <script id="MiniCartContent" type="text/x-template"> {{#.}} {{#unless isEmpty}} @if (miniCartUseGoogleTagManager) { <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> } @RenderBlockList(subBlocks) {{/unless}} {{/.}} </script> } @helper RenderMiniCartOrderLinesTable() { List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); <div class="u-overflow-auto"> <table class="table mini-cart-table dw-mod"> @RenderBlockList(subBlocks) </table> </div> } @helper RenderMiniCartOrderLinesBlocks() { List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); <div class="u-overflow-auto"> @RenderBlockList(subBlocks) </div> } @helper RenderMiniCartOrderLinesHeader() { <thead> <tr> <td>&nbsp;</td> <td>@Translate("Product")</td> <td class="u-ta-right">@Translate("Qty")</td> <td class="u-ta-right" width="120">@Translate("Price")</td> </tr> </thead> } @helper RenderMiniCartOrderLinesList() { <text> {{#OrderLines}} {{#ifCond template "===" "CartOrderline"}} {{>MiniCartOrderline}} {{/ifCond}} {{#ifCond template "===" "CartOrderlineMobile"}} {{>MiniCartOrderline}} {{/ifCond}} {{#ifCond template "===" "CartOrderlineDiscount"}} {{>MiniCartOrderlineDiscount}} {{/ifCond}} {{/OrderLines}} </text> } @helper RenderMiniCartFees() { bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); if (!pointShop) { <text> {{#unless hidePaymentfee}} <div class="grid"> <div class="grid__col-6 grid__col--bleed-y"> {{paymentmethod}} </div> <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{paymentfee}}</div> </div> {{/unless}} </text> } <text> {{#unless hideShippingfee}} <div class="grid"> <div class="grid__col-6 grid__col--bleed-y"> {{shippingmethod}} </div> <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{shippingfee}}</div> </div> {{/unless}} </text> <text> {{#if hasTaxSettings}} <div class="grid"> <div class="grid__col-6 grid__col--bleed-y">@Translate("Sales Tax")</div> <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{totaltaxes}}</div> </div> {{/if}} </text> } @helper RenderMiniCartFooter() { List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList(); <div class="mini-cart__footer u-border-top u-padding-top dw-mod"> @RenderBlockList(subBlocks) </div> } @helper RenderMiniCartActions() { int cartPageId = GetPageIdByNavigationTag("CartPage"); <button type="button" title="@Translate("Empty cart")" class="btn btn--secondary u-full-width dw-mod u-no-margin u-margin-bottom" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event);">@Translate("Empty cart")</button> <a href="/Default.aspx?ID=@cartPageId" title="@Translate("Go to cart")" class="btn btn--primary u-full-width u-no-margin dw-mod">@Translate("Go to cart")</a> } @helper RenderMiniCartPoints() { <text> {{#if earnings}} <div class="grid"> <div class="grid__col-6 grid__col--bleed-y">@Translate("Earnings")</div> <div class="grid__col-6 grid__col--bleed-y grid--align-end"> <div> <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points") </div> </div> </div> {{/if}} </text> } @helper RenderMiniCartSubTotal() { bool hasTaxSettings = Dynamicweb.Rapido.Services.Countries.HasTaxSettings(Model.Cart.ID); bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); if (!pointShop) { <text> {{#unless hideSubTotal}} <div class="grid dw-mod u-bold"> <div class="grid__col-6 grid__col--bleed-y">@Translate("Subtotal")</div> <div class="grid__col-6 grid__col--bleed-y grid--align-end"> @if (hasTaxSettings) { <text>{{subtotalpricewithouttaxes}}</text> } else { <text>{{subtotalprice}}</text> } </div> </div> {{/unless}} </text> } } @helper RenderMiniCartTotal() { bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); <div class="mini-cart-totals grid u-border-top u-margin-top dw-mod"> <div class="grid__col-6">@Translate("Total")</div> <div class="grid__col-6 grid--align-end"> <div> @if (pointShop) { <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points") } else { <text>{{totalprice}}</text> } </div> </div> </div> } @helper RenderMiniCartDisclaimer() { <text> {{#if showCheckoutDisclaimer}} <div class="grid u-margin-bottom u-ta-right"> <small class="grid__col-12">{{checkoutDisclaimer}}</small> </div> {{/if}} </text> } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Services @{ string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; string addToCartNotificationMiniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !string.IsNullOrEmpty(addToCartNotificationType)) { if (addToCartNotificationType == "modal") { Block addToCartNotificationModal = new Block { Id = "AddToCartNotificationModal", Template = RenderAddToCartNotificationModal() }; Block addToCartNotificationScript = new Block { Id = "AddToCartNotificationScript", Template = RenderAddToCartNotificationModalScript() }; BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal); BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); } else if (addToCartNotificationType == "toggle" && addToCartNotificationMiniCartLayout != "none" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") { Block addToCartNotificationScript = new Block { Id = "AddToCartNotificationScript", Template = RenderAddToCartNotificationToggleScript() }; BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); } } } @helper RenderAddToCartNotificationModal() { <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> } @helper RenderAddToCartNotificationModalScript() { int cartPageId = GetPageIdByNavigationTag("CartPage"); <script id="LastAddedProductTemplate" type="text/x-template"> @{ Modal lastAddedProduct = new Modal { Id = "LastAddedProduct", Heading = new Heading { Level = 2, Title = Translate("Product is added to the cart") }, Width = ModalWidth.Md, BodyTemplate = RenderModalContent() }; lastAddedProduct.AddActions( new Button { ButtonType = ButtonType.Button, ButtonLayout = ButtonLayout.Secondary, Title = Translate("Continue shopping"), CssClass = "u-pull--left u-no-margin btn--sm", OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false" }, new Link { Href = "/Default.aspx?ID=" + cartPageId, ButtonLayout = ButtonLayout.Secondary, CssClass = "u-pull--right u-no-margin btn--sm", Title = Translate("Proceed to checkout"), OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false" } ); @Render(lastAddedProduct) } </script> <script> document.addEventListener('addToCart', function (event) { Cart.ShowLastAddedProductModal(event.detail); }); </script> } @helper RenderModalContent() { <div class="grid"> <div class="grid__col-2"> @Render(new Image { Path = "{{ productInfo.image }}", Link = "{{ productInfo.link }}", Title = "{{ productInfo.name }}", DisableImageEngine = true }) </div> <div class="u-padding grid--align-self-center"> <span>{{quantity}}</span> x </div> <div class="grid__col-auto grid--align-self-center"> <div>{{productInfo.name}}</div> {{#if productInfo.variantName}} <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> {{/if}} {{#if productInfo.unitName}} <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> {{/if}} </div> </div> } @helper RenderAddToCartNotificationToggleScript() { int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); <script> document.addEventListener('addToCart', function () { Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); }); </script> } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @using Dynamicweb.Rapido.Blocks.Components.General @functions { BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master"); } @{ string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content"); string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content"); string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content"); string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header"); string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header"); string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header"); Block masterFooterContent = new Block() { Id = "MasterFooterContent", SortId = 10, Template = RenderFooter(), SkipRenderBlocksList = true }; footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent); if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) { Block masterFooterColumnOne = new Block { Id = "MasterFooterColumnOne", SortId = 10, Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent), Design = new Design { Size = "auto", RenderType = RenderType.Column } }; footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne); } if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) { Block masterFooterColumnTwo = new Block { Id = "MasterFooterColumnTwo", SortId = 20, Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent), Design = new Design { Size = "auto", RenderType = RenderType.Column } }; footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo); } if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) { Block masterFooterColumnThree = new Block { Id = "MasterFooterColumnThree", SortId = 30, Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent), Design = new Design { Size = "auto", RenderType = RenderType.Column } }; footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree); } if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) { Block masterFooterNewsletterSignUp = new Block { Id = "MasterFooterNewsletterSignUp", SortId = 40, Template = RenderFooterNewsletterSignUp(), Design = new Design { Size = "auto", RenderType = RenderType.Column } }; footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp); } if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) { Block masterFooterSocialLinks = new Block { Id = "MasterFooterSocialLinks", SortId = 50, Template = RenderFooterSocialLinks(), Design = new Design { Size = "auto", RenderType = RenderType.Column } }; footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks); } if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) { Block masterFooterPayments = new Block { Id = "MasterFooterPayments", SortId = 60, Template = RenderFooterPayments(), Design = new Design { Size = "12", RenderType = RenderType.Column } }; footerBlocksPage.Add("MasterFooterContent", masterFooterPayments); } Block masterFooterCopyright = new Block { Id = "MasterFooterCopyright", SortId = 70, Template = RenderFooterCopyright(), Design = new Design { Size = "12", RenderType = RenderType.Column } }; footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright); } @helper RenderFooter() { List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); <footer class="footer no-print dw-mod"> <div class="center-container top-container__center-container dw-mod"> <div class="grid grid--external-bleed-x"> @RenderBlockList(subBlocks) </div> </div> </footer> } @helper RenderFooterColumn(string header, string content) { <h3 class="footer__heading dw-mod">@header</h3> <div class="footer__content dw-mod"> @content </div> } @helper RenderFooterNewsletterSignUp() { string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); Form form = new Form { Action = "/Default.aspx", Method = FormMethod.Get, Enctype = FormEnctype.multipart }; form.Add(new HiddenField { Name = "ID", Value = newsletterSignUpPageId }); form.Add(new Text { Content = "<p>" + Translate("Sign up if you would like to receive occasional treats from us") + "</p>" }); form.Add(new TextField { Id = "NewsletterEmail", Name = "NewsletterEmail", Placeholder = Translate("Your email address"), Type = TextFieldType.Email, ActionButton = new Button { ButtonType = ButtonType.Submit, Id="Submitter", Title = Translate("Go"), OnClick = "Buttons.LockButton(event)", CssClass = "btn--condensed" } }); <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> <div class="footer__content dw-mod"> @Render(form) </div> } @helper RenderFooterSocialLinks() { <h3 class="footer__heading dw-mod">@Translate("Social links")</h3> <div class="footer__content dw-mod"> <div class="collection dw-mod"> @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) { var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; string socialIconClass = socialIcon.SelectedValue; string socialIconTitle = socialIcon.SelectedName; string socialLink = socialitem.GetString("Link"); <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a> } </div> </div> } @helper RenderFooterPayments() { <div class="footer__content dw-mod"> <div class="collection dw-mod"> @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) { var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; string paymentImage = null; string paymentTitle = paymentItem.SelectedName; ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); if (selected != null) { paymentImage = selected.Icon; } <div class="footer__card-type"> <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=60&Compression=75&image=@paymentImage" alt="@paymentTitle" title="@paymentTitle" /> </div> } </div> </div> } @helper RenderFooterCopyright() { <div class="grid__col-12 footer__copyright dw-mod"> <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p> </div> } @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @using Dynamicweb.Ecommerce.Common @{ BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); Block masterScriptReferences = new Block() { Id = "MasterScriptReferences", SortId = 1, Template = RenderMasterScriptReferences() }; referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); } @helper RenderMasterScriptReferences() { <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script> <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script> <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script> <script src="/Files/Templates/Designs/Rapido/js/nz/main.js"></script> if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript")) { <script src="/Files/Templates/Designs/Rapido/js/custom.min.js"></script> PushPromise("/Files/Templates/Designs/Rapido/js/custom.min.js"); } PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"); PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js"); } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @using Dynamicweb.Rapido.Blocks.Components.Ecommerce @using Dynamicweb.Rapido.Services @{ BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID")); if (!navigationItemsHideSearch || isFavoriteList) { Block masterSearchScriptTemplates = new Block() { Id = "MasterSearchScriptTemplates", SortId = 1, Template = RenderSearchScriptTemplates() }; searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); } } @helper RenderSearchScriptTemplates() { int productsPageId = Pageview.User == null ? GetPageIdByNavigationTag("ProductsPageBeforeLogin") > 0 ? GetPageIdByNavigationTag("ProductsPageBeforeLogin") : GetPageIdByNavigationTag("ProductsPage") : GetPageIdByNavigationTag("ProductsPage"); string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults"); bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton"); bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton"); bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton"); bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); <script id="SearchGroupsTemplate" type="text/x-template"> {{#.}} <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> {{/.}} </script> <script id="SearchProductsTemplate" type="text/x-template"> {{#each .}} {{#Product}} {{#ifCond template "!==" "SearchMore"}} <li class="dropdown__item dropdown__item--seperator dw-mod"> @if (useFacebookPixel) { <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> } @if (useGoogleTagManager) { <text>{{{googleEnchantImpression googleImpression}}}</text> } <div> <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}" title="{{name}}{{#if variantName}}, {{variantName}}{{/if}}"> <div class="u-margin-right u-pull--left {{noimage}} u-hidden-xs u-hidden-xxs"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=45&height=36&crop=5&FillCanvas=True&Compression=75&image={{image}}" alt="{{name}}{{#if variantName}}, {{variantName}}{{/if}}"></div> <div class="u-pull--left"> <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}{{#if variantName}}, {{variantName}}{{/if}}</div> @if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed()) { if (pointShopOnly) { <text> {{#if havePointPrice}} <div> <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") </div> {{else}} <small class="help-text u-no-margin">@Translate("Not available")</small> {{/if}} {{#unless canBePurchasedWithPoints}} {{#if havePointPrice}} <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> {{/if}} {{/unless}} </text> } else { <div>{{price}}</div> } } </div> </a> <div class="u-margin-left u-pull--right"> @{ var viewBtn = new Link { Href = "{{link}}", OnClick = "{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}", ButtonLayout = ButtonLayout.Secondary, CssClass = "btn--condensed u-no-margin u-w80px js-ignore-click-outside", Title = Translate("View") }; } @if (showAddToCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) { <text>{{#if hideAddToCartButton}}</text> @Render(viewBtn) <text>{{else}}</text> @Render(new AddToCartButton { HideTitle = true, ProductId = "{{productId}}", ProductInfo = "{{productInfo}}", BuyForPoints = pointShopOnly, OnClick = "{{facebookPixelAction}}", CssClass = "u-w80px u-no-margin js-ignore-click-outside", Icon = new Icon { CssClass = "js-ignore-click-outside" }, ExtraAttributes = new Dictionary<string, string> { { "{{disabledBuyButton}}", "" } } }) <text>{{/if}}</text> } else if (showViewButton) { @Render(viewBtn) } @if (showAddToDownloadButton) { <button type="button" class="btn btn--primary u-no-margin btn--condensed dw-mod js-add-to-downloads" title="@Translate("Add")" data-product-id="{{productId}}"> <i class="fas fa-plus js-button-icon"></i> </button> } </div> </div> </li> {{/ifCond}} {{#ifCond template "===" "SearchMore"}} {{>SearchMoreProducts}} {{/ifCond}} {{/Product}} {{else}} <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> @Translate("Your search gave 0 results") </li> {{/each}} </script> <script id="SearchMoreProducts" type="text/x-template"> <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> @Translate("View all") </a> </li> </script> <script id="SearchMorePages" type="text/x-template"> <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> @Translate("View all") </a> </li> </script> <script id="SearchPagesTemplate" type="text/x-template"> {{#each .}} {{#ifCond template "!==" "SearchMore"}} <li class="dropdown__item dropdown__item--seperator dropdown__item--no-padding dw-mod"> <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link dropdown__link u-color-inherit"> <div class="u-margin-right u-inline"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> <div class="u-inline u-va-middle"><div class="u-bold u-truncate-text u-max-w210px u-inline-block js-typeahead-name">{{name}}</div></div> </a> </li> {{/ifCond}} {{#ifCond template "===" "SearchMore"}} {{>SearchMorePages}} {{/ifCond}} {{else}} <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> @Translate("Your search gave 0 results") </li> {{/each}} </script> <script id="SearchPagesTemplateWrap" type="text/x-template"> <div class="dropdown__column-header">@Translate("Pages")</div> <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> {{>SearchPagesTemplate}} </ul> </script> <script id="SearchProductsTemplateWrap" type="text/x-template"> <div class="dropdown__column-header">@Translate("Products")</div> <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> {{>SearchProductsTemplate}} </ul> </script> } @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks @using System.IO @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components.Ecommerce @* Component *@ @helper RenderVariantMatrix(VariantMatrix settings) { if (settings != null) { int productLoopCounter = 0; int groupCount = 0; List<VariantOption> firstDimension = new List<VariantOption>(); List<VariantOption> secondDimension = new List<VariantOption>(); List<VariantOption> thirdDimension = new List<VariantOption>(); foreach (VariantGroup variantGroup in settings.GetVariantGroups()) { foreach (VariantOption variantOptions in variantGroup.GetVariantOptions()) { if (groupCount == 0) { firstDimension.Add(variantOptions); } if (groupCount == 1) { secondDimension.Add(variantOptions); } if (groupCount == 2) { thirdDimension.Add(variantOptions); } } groupCount++; } int rowCount = 0; int columnCount = 0; <script> var variantsCollection = []; </script> <table class="table table--compact js-variants-matrix dw-mod" id="VariantMatrixTable_@settings.ProductId"> @if (groupCount == 1) { <tbody> @foreach (VariantOption firstVariantOption in firstDimension) { var variantId = firstVariantOption.Id; <tr> <td class="u-bold"> @firstVariantOption.Name </td> <td> @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) </td> </tr> productLoopCounter++; } <tr> <td>&nbsp;</td> <td> <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> </td> </tr> </tbody> } @if (groupCount == 2) { <thead> <tr> <td>&nbsp;</td> @foreach (VariantOption variant in secondDimension) { <td>@variant.Name</td> } </tr> </thead> <tbody> @foreach (VariantOption firstVariantOption in firstDimension) { string variantId = ""; columnCount = 0; <tr> <td class="u-min-w120px">@firstVariantOption.Name</td> @foreach (VariantOption secondVariantOption in secondDimension) { variantId = firstVariantOption.Id + "." + secondVariantOption.Id; <td> @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) </td> columnCount++; productLoopCounter++; } <td> <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> </td> </tr> rowCount++; } @{ columnCount = 0; } <tr> <td>&nbsp;</td> @foreach (VariantOption secondVariantOption in secondDimension) { <td> <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> </td> columnCount++; } <td>&nbsp;</td> </tr> </tbody> } @if (groupCount == 3) { <thead> <tr> <td>&nbsp;</td> @foreach (VariantOption thirdVariantOption in thirdDimension) { <td>@thirdVariantOption.Name</td> } </tr> </thead> <tbody> @foreach (VariantOption firstVariantOption in firstDimension) { int colspan = (thirdDimension.Count + 1); <tr> <td colspan="@colspan" class="u-color-light-gray--bg u-bold">@firstVariantOption.Name</td> </tr> foreach (VariantOption secondVariantOption in secondDimension) { string variantId = ""; columnCount = 0; <tr> <td class="u-min-w120px">@secondVariantOption.Name</td> @foreach (VariantOption thirdVariantOption in thirdDimension) { variantId = firstVariantOption.Id + "." + secondVariantOption.Id + "." + thirdVariantOption.Id; <td> @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) </td> columnCount++; productLoopCounter++; } <td> <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> </td> </tr> rowCount++; } } @{ columnCount = 0; } <tr> <td>&nbsp;</td> @foreach (VariantOption thirdVariantOption in thirdDimension) { <td> <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> </td> columnCount++; } <td>&nbsp;</td> </tr> </tbody> } </table> <script> document.addEventListener("DOMContentLoaded", function (event) { MatrixUpdateQuantity("@settings.ProductId"); }); MatrixUpdateQuantity = function (productId) { var currentMatrix = document.getElementById("VariantMatrixTable_" + productId); var allQtyFields = currentMatrix.getElementsByClassName("js-qty"); var qtyRowArr = []; var qtyColumnArr = []; var totalQty = 0; for (var i = 0; i < allQtyFields.length; i++) { qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] = 0; qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] = 0; } for (var i = 0; i < allQtyFields.length; i++) { qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] += parseFloat(allQtyFields[i].value); qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] += parseFloat(allQtyFields[i].value); totalQty += parseFloat(allQtyFields[i].value); } //Update row counters for (var i = 0; i < qtyRowArr.length; i++) { var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; if (qtyRowArr[i] != undefined && qtyCounter != null) { var currentCount = qtyCounter.innerHTML; qtyCounter.innerHTML = qtyRowArr[i]; if (currentCount != qtyCounter.innerHTML) { qtyCounter.classList.add("qty-field--active"); } } } //Update column counters for (var i = 0; i < qtyColumnArr.length; i++) { var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; if (qtyColumnArr[i] != undefined && qtyCounter != null) { var currentCount = qtyCounter.innerHTML; qtyCounter.innerHTML = qtyColumnArr[i]; if (currentCount != qtyCounter.innerHTML) { qtyCounter.classList.add("qty-field--active"); } } } if (document.getElementById("TotalQtyCount_" + productId)) { document.getElementById("TotalQtyCount_" + productId).innerHTML = totalQty; } //Clean up animations setTimeout(function () { for (var i = 0; i < qtyRowArr.length; i++) { var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; if (qtyCounter != null) { qtyCounter.classList.remove("qty-field--active"); } } for (var i = 0; i < qtyColumnArr.length; i++) { var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; if (qtyCounter != null) { qtyCounter.classList.remove("qty-field--active"); } } }, 1000); } </script> } } @helper RenderVariantMatrixQuantityField(string variantId, VariantMatrix settings, int productLoopCounter, int rowCount, int columnCount) { string loopCount = productLoopCounter.ToString(); bool combinationFound = false; double stock = 0; double quantityValue = 0; string note = ""; VariantProduct variantProduct = null; if (settings.GetVariantProducts().TryGetValue(variantId, out variantProduct)) { stock = variantProduct.Stock; quantityValue = variantProduct.Quantity; combinationFound = true; } if (combinationFound) { <input type="hidden" name="ProductLoopCounter@(loopCount)" value="@loopCount" /> <input type="hidden" name="ProductID@(loopCount)" value="@settings.ProductId" /> <input type="hidden" name="VariantID@(loopCount)" value="@variantId" /> <input type="hidden" name="CurrentNote@(loopCount)" id="CurrentNote_@(settings.ProductId)_@variantId" value="@note" /> <input type="number" name="Quantity@(loopCount)" id="Quantity_@(settings.ProductId)_@variantId" value="@quantityValue" min="0" class="js-qty u-no-margin u-full-max-width" style="width: 100%; max-width: 100%" onkeyup="MatrixUpdateQuantity('@settings.ProductId')" onmouseup="MatrixUpdateQuantity('@settings.ProductId')" data-qty-row-group="@rowCount" data-qty-column-group="@columnCount"> if (stock != 0) { <small>@Translate("Stock") @stock</small> } <script> var variants = '{ "ProductId" :' + '"@settings.ProductId"' + ', "VariantId": ' + '"@variantId"' +'}'; variantsCollection.push(variants); document.getElementById("Quantity_@(settings.ProductId)_@variantId").closest(".js-variants-matrix").setAttribute("data-variants-collection", "[" + variantsCollection + "]" ); </script> } else { <div class="use-btn-height" style="background-color: #a8a8a8"></div> } } @using Dynamicweb.Rapido.Blocks.Components.Ecommerce @* Component *@ @helper RenderAddToCart(AddToCart settings) { //set Id for quantity selector to get it's value from button if (settings.QuantitySelector != null) { if (string.IsNullOrEmpty(settings.QuantitySelector.Id)) { settings.QuantitySelector.Id = Guid.NewGuid().ToString("N"); } settings.AddButton.QuantitySelectorId = settings.QuantitySelector.Id; if (settings.Disabled) { settings.QuantitySelector.Disabled = true; } if (string.IsNullOrEmpty(settings.QuantitySelector.Name)) { settings.QuantitySelector.Name = settings.QuantitySelector.Id; } } if (settings.Disabled) { settings.AddButton.Disabled = true; } settings.AddButton.CssClass += " btn--condensed"; //unitsSelector if (settings.UnitSelector != null) { if (settings.Disabled) { settings.QuantitySelector.Disabled = true; } } if (Pageview.Device.ToString() == "Mobile") { if (settings.UnitSelector != null) { <div class="margin-sm margin-position-bottom"> @Render(settings.UnitSelector) </div> } } <div class="buttons-collection @settings.WrapperCssClass" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> @if (Pageview.Device.ToString() != "Mobile") { if (settings.UnitSelector != null) { @Render(settings.UnitSelector) } } @if (settings.QuantitySelector != null) { @Render(settings.QuantitySelector) } @Render(settings.AddButton) </div> } @using Dynamicweb.Rapido.Blocks.Components.Ecommerce @* Component *@ @helper RenderAddToCartButton(AddToCartButton settings) { if (!settings.HideTitle) { if (string.IsNullOrEmpty(settings.Title)) { if (settings.BuyForPoints) { settings.Title = Translate("Buy with points"); } else { settings.Title = Translate("Add to cart"); } } } else { settings.Title = ""; } if (settings.Icon == null) { settings.Icon = new Icon(); settings.Icon.LabelPosition = Dynamicweb.Rapido.Blocks.Components.General.IconLabelPosition.After; } if (string.IsNullOrEmpty(settings.Icon.Name)) { settings.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue; } settings.OnClick = "Cart.AddToCart(event, { " + "id: '" + settings.ProductId + "'," + (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") + (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") + (settings.BuyForPoints ? "buyForPoints: true," : "") + (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") + "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value)") + "});" + settings.OnClick; @RenderButton(settings) } @using Dynamicweb.Rapido.Blocks.Components.Ecommerce @* Component *@ @helper RenderUnitSelector(UnitSelector settings) { if (string.IsNullOrEmpty(settings.Id)) { settings.Id = Guid.NewGuid().ToString("N"); } var disabledClass = settings.Disabled ? "disabled" : ""; <input type="checkbox" id="@settings.Id" class="dropdown-trigger" /> <div class="dropdown unit-selector @settings.CssClass @disabledClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> <label class="dropdown__header dropdown__btn dropdown__btn--unit-selector dw-mod" for="@settings.Id">@settings.SelectedOption</label> <div class="dropdown__content dw-mod"> @settings.OptionsContent </div> <label class="dropdown-trigger-off" for="@settings.Id"></label> </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.Ecommerce @* Component *@ @helper RenderQuantitySelector(QuantitySelector 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*/ 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) { settings.Min = 1; } attributes.Add("min", settings.Min.ToString()); if (settings.Step != null && !string.IsNullOrEmpty(settings.Step.ToString())) { attributes.Add("step", settings.Step.ToString()); } if (settings.Value == null) { settings.Value = 1; } 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); <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> } @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Frontend @using Dynamicweb.Frontend.Devices @using Dynamicweb.Rapido.Blocks.Components.Ecommerce @using Dynamicweb.Rapido.Blocks.Components.General @using System.Collections.Generic; @* Component *@ @helper RenderCustomerCenterList(CustomerCenterList settings) { bool isTouchDevice = Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet" ? true : false; string hideActions = isTouchDevice ? "u-block" : ""; <table class="table data-list dw-mod"> @if (settings.GetHeaders().Length > 0) { <thead> <tr class="u-bold"> @foreach (CustomerCenterListHeaderItem header in settings.GetHeaders()) { var attributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(header.Id)) { attributes.Add("id", header.Id); } if (!string.IsNullOrEmpty(header.CssClass)) { attributes.Add("class", header.CssClass); } attributes.Add("align", header.Align.ToString()); attributes = attributes.Concat(header.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); <td @ComponentMethods.AddAttributes(attributes)>@header.Title</td> } </tr> </thead> } @foreach (CustomerCenterListItem listItem in settings.GetItems()) { int columnCount = 0; int totalColumns = listItem.GetInfoItems().Length; string rowHasActions = listItem.GetActions().Length > 0 ? "data-list__item--has-actions" : ""; listItem.Id = !string.IsNullOrEmpty(listItem.Id) ? listItem.Id : Guid.NewGuid().ToString("N"); var attributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(listItem.Title)) { attributes.Add("title", listItem.Title); }; attributes = attributes.Concat(listItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); <tbody class="data-list__item @rowHasActions @listItem.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes)> <tr> @if (!string.IsNullOrEmpty(listItem.Title) || !string.IsNullOrEmpty(listItem.Description)) { string onClick = !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : ""; <td rowspan="2" @onClick class="data-list__main-item dw-mod"> @if (!string.IsNullOrEmpty(listItem.Title)) { <div class="u-bold">@listItem.Title</div> } @if (!string.IsNullOrEmpty(listItem.Description)) { <div>@listItem.Description</div> } </td> } @foreach (CustomerCenterListInfoItem infoItem in listItem.GetInfoItems()) { var infoAttributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(infoItem.Id)) { infoAttributes.Add("id", infoItem.Id); }; if (!string.IsNullOrEmpty(infoItem.OnClick)) { infoAttributes.Add("onclick", infoItem.OnClick); }; infoAttributes.Add("align", infoItem.Align.ToString()); infoAttributes = infoAttributes.Concat(infoItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); string columnClick = columnCount < (totalColumns-1) && !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : ""; <td @ComponentMethods.AddAttributes(infoAttributes) @columnClick class="data-list__info-item dw-mod"> @if (!string.IsNullOrEmpty(infoItem.Title)) { <div>@infoItem.Title</div> } @if (!string.IsNullOrEmpty(infoItem.Subtitle)) { <div><small>@infoItem.Subtitle</small></div> } </td> columnCount++; } </tr> <tr> <td colspan="7" align="right" class="u-va-bottom u-no-border"> <div class="data-list__actions @hideActions dw-mod" id="ActionsMenu_@listItem.Id"> @foreach (ButtonBase action in listItem.GetActions()) { action.ButtonLayout = ButtonLayout.LinkClean; action.Icon.CssClass += " u-full-height"; action.CssClass += " data-list__action-button link"; @Render(action) } </div> </td> </tr> </tbody> } </table> } @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); Block primaryBottomSnippets = new Block() { Id = "MasterJavascriptInitializers", SortId = 100, Template = RenderPrimaryBottomSnippets() }; bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) { Block miniCartPageId = new Block { Id = "MiniCartPageId", Template = RenderMiniCartPageId() }; bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, miniCartPageId); } } @helper RenderPrimaryBottomSnippets() { bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode"); bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); if (isWireframeMode) { <script> Wireframe.Init(true); </script> } if (useGoogleTagManager) { <script> document.addEventListener('addToCart', function(event) { var googleImpression = JSON.parse(event.detail.productInfo.googleImpression); if (typeof googleImpression == "string") { googleImpression = JSON.parse(event.detail.productInfo.googleImpression); } dataLayer.push({ 'event': 'addToCart', 'ecommerce': { 'currencyCode': googleImpression.currency, 'add': { 'products': [{ 'name': googleImpression.name, 'id': googleImpression.id, 'price': googleImpression.price, 'brand': googleImpression.brand, 'category': googleImpression.category, 'variant': googleImpression.variant, 'quantity': event.detail.quantity }] } } }); }); </script> } //if digitalwarehouse if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart")) { string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]); if (string.IsNullOrEmpty(cartContextId)) { var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2"); var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps); cartContextId = cartSettings.OrderContextID; HttpContext.Current.Application["DownloadCartContext"] = cartContextId; } <script> let downloadCart = new DownloadCart({ cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"), contextId: "@cartContextId", addButtonText: "@Translate("Add")", removeButtonText: "@Translate("Remove")" }); </script> } <!--$$Javascripts--> } @helper RenderMiniCartPageId() { int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); <script> window.cartId = "@miniCartFeedPageId"; </script> } @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Frontend.PageViewModel> @using Dynamicweb.Rapido.Blocks @using S_DW_BKI.CustomModules.Extensions @using S_DW_BKI.CustomModules.Helpers @{ BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master"); Block headerScripts = new Block { Id = "HeadScripts", SortId = 22, Template = RenderHeaderScripts() }; masterCustomBlocksPage.Add("Head", headerScripts); Block bodyScripts = new Block { Id = "BodyScripts", SortId = 21, Template = RenderBodyScripts() }; masterCustomBlocksPage.Add("Body", bodyScripts); Block headerCss = new Block { Id = "HeaderCss", SortId = 21, Template = RenderHeaderCss() }; masterCustomBlocksPage.Add("Head", headerCss); Block headerCanonical = new Block { Id = "Canonical", SortId = 40, Template = RenderHeaderCanonical() }; masterCustomBlocksPage.Add("Head", headerCanonical); Block headerHrefLang = new Block { Id = "HrefLang", SortId = 50, Template = RenderHeaderHrefLang() }; masterCustomBlocksPage.Add("Head", headerHrefLang); bool showSectionBar = Pageview.AreaSettings.GetItem("Custom").GetItem("CustomSettings").GetBoolean("ShowSectionBar"); if (showSectionBar) { Block areaNavigationBlock = new Block { Id = "AreaNavigation", SortId = 5, Template = RenderAreaNavigation() }; masterCustomBlocksPage.Add("MasterHeader", areaNavigationBlock); } } @helper RenderHeaderScripts() { //Custom Global Scripts string headerScripts = Pageview.AreaSettings.GetItem("Custom").GetItem("CustomSettings").GetString("HeaderScripts") != null ? Pageview.AreaSettings.GetItem("Custom").GetItem("CustomSettings").GetString("HeaderScripts") : ""; if (!String.IsNullOrEmpty(headerScripts)) { @headerScripts } } @helper RenderBodyScripts() { //Custom Global Scripts string bodyScripts = Pageview.AreaSettings.GetItem("Custom").GetItem("CustomSettings").GetString("BodyScripts") != null ? Pageview.AreaSettings.GetItem("Custom").GetItem("CustomSettings").GetString("BodyScripts") : ""; if (!String.IsNullOrEmpty(bodyScripts)) { @bodyScripts } if (!string.IsNullOrEmpty(Pageview.Area.EcomShopId)) { <script> var CustomScripts = window.CustomScripts || function () { }; CustomScripts.prototype.Init = function() { this.constants = { }; this.constants.shopId = '@Pageview.Area.EcomShopId'; } var CustomScripts = new CustomScripts(); CustomScripts.Init(); </script> } } @helper RenderHeaderCss() { <link href="/Files/Templates/Designs/Rapido/css/nz/main.css" rel="stylesheet" /> } @helper RenderHeaderCanonical() { string canonicalUrl = Pageview.GetCanonical(); <link rel="canonical" href="@canonicalUrl" /> } @helper RenderHeaderHrefLang() { var languageLinks = Pageview.GetLanguageLinks(); foreach (var languageLink in languageLinks) { <link rel="alternate" href="@languageLink.Link" hreflang="@languageLink.CultureCode" /> } } @helper RenderAreaNavigation() { var customSettings = Pageview.AreaSettings.GetItem("Custom").GetItem("CustomSettings"); var areas = customSettings.GetItems("Areas"); var currentAreaName = customSettings.GetString("CurrentAreaName"); var extraLanguageLinks = customSettings.GetItems("LanguageLinks"); var showLanguages = customSettings.GetBoolean("ShowLanguages"); <div class="area-navigation"> <div class="center-container grid top-container__center-container dw-mod"> <div class="menu"> @if (showLanguages && (Model.Languages.Where(x => TemplateHelper.ShowLanguageVersionInNavigation(x.Page.ID)).Any() || extraLanguageLinks.Any())) { <div class="menu__item dw-mod menu__item--horizontal menu__item--top-level dw-navbar-button is-dropdown"> <a class="menu__link"><span class="flag-icon flag-icon-dk "></span> <i class="fas fa-chevron-down"></i></a> <ul class="menu menu--dropdown"> @foreach (var item in Model.Languages.Where(x => TemplateHelper.ShowLanguageVersionInNavigation(x.Page.ID))) { if (item.IsCurrent) { continue; } var languageName = new System.Globalization.CultureInfo(item.Culture).DisplayName; if (languageName.IndexOf(" (") > -1) { languageName = languageName.Substring(0, languageName.IndexOf(" (")); } <li class="menu__item dw-mod"> <a href="@Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(item.Page.ID)" class="menu-dropdown__link"><span class="flag-icon flag-icon-@item.Culture.Substring(3).ToLower()"></span> @languageName.ToUpper()</a> </li> } @foreach (var item in extraLanguageLinks) { bool openInNewTab = item.GetBoolean("OpenInNewTab"); <li class="menu__item dw-mod"> <a href="@item.GetString("Link")" class="menu-dropdown__link" target="@(openInNewTab ? "_blank" : "_self")"><span class="flag-icon flag-icon-@item.GetString("CountryCode").ToLower()"></span> @item.GetString("Name").ToUpper()</a> </li> } </ul> </div> } @if (areas.Any()) { <div class="menu__item dw-mod menu__item--horizontal menu__item--top-level dw-navbar-button is-dropdown"> <a class="menu__link">@currentAreaName <i class="fas fa-chevron-down"></i></a> <ul class="menu menu--dropdown"> @foreach (var item in areas) { <li class="menu__item dw-mod"> <a href="@item.GetString("Link")" class="menu-dropdown__link">@item.GetString("Title")</a> </li> } </ul> </div> } </div> </div> </div> } @functions { public class ManifestIcon { public string src { get; set; } public string type { get; set; } public string sizes { get; set; } } public class Manifest { public string name { get; set; } public string short_name { get; set; } public string start_url { get; set; } public string display { get; set; } public string background_color { get; set; } public string theme_color { get; set; } public List<ManifestIcon> icons { get; set; } } } <!DOCTYPE html> <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ @RenderBlockList(masterPage.BlocksRoot.BlocksList) @helper RenderMasterHead() { List<Block> subBlocks = this.masterPage.GetBlockListById("Head").OrderBy(item => item.SortId).ToList(); <head> <!-- Rapido version 3.4.3 --> @RenderBlockList(subBlocks) </head> } @helper RenderMasterMetadata() { var swatches = new Dynamicweb.Content.Items.ColorSwatchService(); var brandColors = swatches.GetColorSwatch(Model.Area.ID); string brandColorOne = brandColors.Palette["BrandColor1"]; if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) { Manifest manifest = new Manifest { name = Model.Area.Item.GetItem("Settings").GetString("AppName"), short_name = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppShortName")) ? Model.Area.Item.GetItem("Settings").GetString("AppShortName") : Model.Area.Item.GetItem("Settings").GetString("AppName"), start_url = "/", display = "standalone", background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"), theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor") }; manifest.icons = new List<ManifestIcon> { new ManifestIcon { src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, sizes = "192x192", type = "image/png" }, new ManifestIcon { src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, sizes = "512x512", type = "image/png" }, new ManifestIcon { src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, sizes = "1024x1024", type = "image/png" } }; string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json"); string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest); string currentManifest = File.ReadAllText(manifestFilePath); if (manifestJSON != currentManifest) { File.WriteAllText(manifestFilePath, manifestJSON); } } <meta charset="utf-8" /> <title>@Model.Title</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="theme-color" content="@brandColorOne" /> if (Model.MetaTags != null && !Model.MetaTags.Contains("og:image") && Model.PropertyItem != null && Model.PropertyItem.GetFile("OpenGraphImage") != null) { Pageview.Meta.AddTag("og:image", string.Format("{0}://{1}{2}", Dynamicweb.Context.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, Model.PropertyItem.GetFile("OpenGraphImage"))); } if (!Model.MetaTags.Contains("og:description") && !string.IsNullOrEmpty(Model.Description)) { Pageview.Meta.AddTag("og:description", Model.Description); } Pageview.Meta.AddTag("og:title", Model.Title); Pageview.Meta.AddTag("og:site_name", Model.Name); Pageview.Meta.AddTag("og:url", HttpContext.Current.Request.Url.ToString()); Pageview.Meta.AddTag("og:type", "Website"); if (!string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("FacebookAppID"))) { Pageview.Meta.AddTag("fb:app_id", Model.Area.Item.GetItem("Settings").GetString("FacebookAppID")); } string metaTags = Model.MetaTags; if (Pageview.SearchFriendlyUrl.IndexOf("?") > -1 && Pageview.Page.NavigationTag.Equals("ProductsPage") && metaTags.IndexOf("canonical") > -1) { string pageUrlWithoutQuery = Pageview.SearchFriendlyUrl.Substring(0, Pageview.SearchFriendlyUrl.IndexOf("?")); <!-- @pageUrlWithoutQuery @Pageview.Page.NavigationTag @Pageview.SearchFriendlyUrl @Pageview.SearchFriendlyUrl.IndexOf("?") --> metaTags = metaTags.Replace($"<link rel=\"canonical\" href=\"{pageUrlWithoutQuery}\">", ""); } @metaTags } @helper RenderMasterCss() { var fonts = new string[] { getFontFamily("Layout", "HeaderFont"), getFontFamily("Layout", "SubheaderFont"), getFontFamily("Layout", "TertiaryHeaderFont"), getFontFamily("Layout", "BodyText"), getFontFamily("Layout", "Header", "ToolsFont"), getFontFamily("Layout", "Header", "NavigationFont"), getFontFamily("Layout", "MobileNavigation", "Font"), getFontFamily("ProductList", "Facets", "HeaderFont"), getFontFamily("ProductPage", "PriceFontDesign"), getFontFamily("Ecommerce", "SaleSticker", "Font"), getFontFamily("Ecommerce", "NewSticker", "Font"), getFontFamily("Ecommerce", "CustomSticker", "Font") }; string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks; string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png"; bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro"); string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css"; if (useFontAwesomePro) { fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css"; } //Favicon <link href="@favicon" rel="icon" type="image/png"> //Base (Default, wireframe) styles <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css"> //Rapido Css from Website Settings <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css"> //Ignite Css (Custom site specific styles) <link rel="stylesheet" id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css"> //Font awesome <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css"> //Flag icon <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css"> //Google fonts var family = string.Join("%7C", fonts.Where(x => !string.IsNullOrEmpty(x)).Distinct().Select(x => string.Format("{0}:100,200,300,400,500,600,700,800,900", x))); <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> PushPromise(favicon); PushPromise(fontAwesomeCssLink); PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css"); PushPromise(autoCssLink); PushPromise("/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css"); PushPromise("/Files/Images/placeholder.gif"); PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css"); } @helper RenderMasterManifest() { if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName"))) { <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json"> PushPromise("/Files/Templates/Designs/Rapido/manifest.json"); } } @helper RenderMasterBody() { List<Block> subBlocks = this.masterPage.GetBlockListById("Body").OrderBy(item => item.SortId).ToList(); string designLayout = Model.PropertyItem.GetItem("CustomSettings") != null ? Model.PropertyItem.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.PropertyItem.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : ""; if (!String.IsNullOrEmpty(designLayout)) { designLayout = "class=\"" + designLayout + "\""; } <body @designLayout> @RenderBlockList(subBlocks) </body> } @helper RenderMasterHeader() { List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; <header class="top-container @stickyTop no-print dw-mod" id="Top"> @RenderBlockList(subBlocks) </header> } @helper RenderMain() { List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); <main class="site dw-mod"> @RenderBlockList(subBlocks) </main> } @helper RenderPageContent() { bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; <div id="Page" class="page @pagePos"> <div id="content"> @RenderSnippet("Content") </div> </div> } @* Hack to support nested helpers *@ @SnippetStart("Content") @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @* Render the grid *@ @Model.Grid("Grid", "Grid", "default:true;sort:1", "Pages") @SnippetEnd("Content") @helper RenderIosTabletFix() { if (Pageview.Device != Dynamicweb.Frontend.Devices.DeviceType.Tablet && Pageview.Platform != Dynamicweb.Frontend.Devices.PlatformType.Ios) { <script> let isIpadIOS = (/iPad/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) && !window.MSStream; if (isIpadIOS) { var separator = (window.location.href.indexOf("?") === -1) ? "?" : "&"; window.location.href = window.location.href + separator + "DeviceType=Tablet&PlatformType=Ios"; } </script> } } </html>