Error executing template "Designs/Rapido/_parsed/ContentPage.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_4ae5a914a6784f75962b75e4364a71ef.<RenderMasterBody>b__206_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_Korsholm\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8379
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_4ae5a914a6784f75962b75e4364a71ef.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_Korsholm\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 255
   at CompiledRazorTemplates.Dynamic.RazorEngine_4ae5a914a6784f75962b75e4364a71ef.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_Korsholm\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 165
   at CompiledRazorTemplates.Dynamic.RazorEngine_4ae5a914a6784f75962b75e4364a71ef.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_Korsholm\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 293
   at CompiledRazorTemplates.Dynamic.RazorEngine_4ae5a914a6784f75962b75e4364a71ef.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_Korsholm\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 165
   at CompiledRazorTemplates.Dynamic.RazorEngine_4ae5a914a6784f75962b75e4364a71ef.Execute() in D:\dynamicweb.net\Solutions\S_DW_Korsholm\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8152
   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> 2 3 @using System.Web; 4 @using Dynamicweb 5 @using Dynamicweb.Frontend 6 @using Dynamicweb.Frontend.Devices 7 @using Dynamicweb.Extensibility 8 @using Dynamicweb.Content 9 @using Dynamicweb.Security 10 @using Dynamicweb.Core 11 @using System 12 @using System.Web 13 @using System.IO 14 @using Dynamicweb.Rapido.Blocks 15 @using System.Net 16 @using S_DW_Korsholm.CustomCode.Helpers 17 18 19 @functions { 20 BlocksPage masterPage = BlocksPage.GetBlockPage("Master"); 21 22 string getFontFamily(params string[] items) 23 { 24 var itemParent = Pageview.AreaSettings; 25 foreach (var item in items) 26 { 27 itemParent = itemParent.GetItem(item); 28 if (itemParent == null) 29 { 30 return null; 31 } 32 } 33 34 var googleFont = itemParent.GetGoogleFont("FontFamily"); 35 if (googleFont == null) 36 { 37 return null; 38 } 39 return googleFont.Family.Replace(" ", "+"); 40 } 41 } 42 43 @{ 44 Block root = new Block 45 { 46 Id = "Root", 47 SortId = 10, 48 BlocksList = new List<Block> 49 { 50 new Block { 51 Id = "Head", 52 SortId = 10, 53 SkipRenderBlocksList = true, 54 Template = RenderMasterHead(), 55 BlocksList = new List<Block> 56 { 57 new Block { 58 Id = "HeadMetadata", 59 SortId = 10, 60 Template = RenderMasterMetadata(), 61 }, 62 new Block { 63 Id = "HeadCss", 64 SortId = 20, 65 Template = RenderMasterCss(), 66 }, 67 new Block { 68 Id = "HeadManifest", 69 SortId = 30, 70 Template = RenderMasterManifest(), 71 } 72 } 73 }, 74 new Block { 75 Id = "Body", 76 SortId = 20, 77 SkipRenderBlocksList = true, 78 Template = RenderMasterBody(), 79 BlocksList = new List<Block> 80 { 81 new Block() 82 { 83 Id = "Master", 84 SortId = 10, 85 BlocksList = new List<Block> { 86 new Block { 87 Id = "MasterTopSnippets", 88 SortId = 10 89 }, 90 new Block { 91 Id = "MasterMain", 92 SortId = 20, 93 Template = RenderMain(), 94 SkipRenderBlocksList = true, 95 BlocksList = new List<Block> { 96 new Block { 97 Id = "MasterHeader", 98 SortId = 10, 99 Template = RenderMasterHeader(), 100 SkipRenderBlocksList = true 101 }, 102 new Block { 103 Id = "MasterPageContent", 104 SortId = 20, 105 Template = RenderPageContent() 106 } 107 } 108 }, 109 new Block { 110 Id = "MasterFooter", 111 SortId = 30 112 }, 113 new Block { 114 Id = "MasterReferences", 115 SortId = 40 116 }, 117 new Block { 118 Id = "MasterBottomSnippets", 119 SortId = 50, 120 BlocksList = new List<Block> { 121 new Block { 122 Id = "iOsTabletFix", 123 SortId = 10, 124 Template = RenderIosTabletFix() 125 } 126 } 127 } 128 } 129 } 130 } 131 } 132 } 133 }; 134 135 masterPage.Add(root); 136 } 137 138 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ 139 @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 ---*@ 140 141 @* Include the components *@ 142 @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 143 @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> } } 144 145 146 @* Include the Blocks for the page *@ 147 @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> } } 148 @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> } } 149 150 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 151 { 152 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 153 154 @using System 155 @using System.Web 156 @using System.Collections.Generic 157 @using Dynamicweb.Rapido.Blocks.Extensibility 158 @using Dynamicweb.Rapido.Blocks 159 @using Dynamicweb.Rapido.Services 160 @using S_DW_Korsholm.CustomCode.Constants 161 162 163 @functions { 164 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 165 } 166 167 @{ 168 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"; 169 bool mobileHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 170 bool mobileHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart") || !Dynamicweb.Rapido.Services.User.IsBuyingAllowed(); 171 172 Block mobileHeader = new Block() 173 { 174 Id = "MobileTop", 175 SortId = 10, 176 Template = RenderMobileTop(), 177 SkipRenderBlocksList = true 178 }; 179 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader); 180 181 Block mobileHeaderNavigation = new Block() 182 { 183 Id = "MobileHeaderNavigation", 184 SortId = 10, 185 Template = RenderMobileHeaderNavigation(), 186 SkipRenderBlocksList = true, 187 BlocksList = new List<Block> { 188 new Block { 189 Id = "MobileHeaderNavigationTrigger", 190 SortId = 10, 191 Template = RenderMobileHeaderNavigationTrigger() 192 } 193 } 194 }; 195 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation); 196 197 Block mobileHeaderLogo = new Block() 198 { 199 Id = "MobileHeaderLogo", 200 SortId = 20, 201 Template = RenderMobileHeaderLogo(), 202 SkipRenderBlocksList = true 203 }; 204 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo); 205 206 Block mobileHeaderActions = new Block() 207 { 208 Id = "MobileHeaderActions", 209 SortId = 30, 210 Template = RenderMobileTopActions(), 211 SkipRenderBlocksList = true 212 }; 213 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions); 214 215 if (!mobileHideSearch) 216 { 217 Block mobileHeaderSearch = new Block 218 { 219 Id = "MobileHeaderSearch", 220 SortId = 10, 221 Template = RenderMobileTopSearch() 222 }; 223 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch); 224 } 225 226 Block mobileHeaderMiniCart; 227 228 if (!mobileHideCart) 229 { 230 mobileHeaderMiniCart = new Block 231 { 232 Id = "MobileHeaderMiniCart", 233 SortId = 20, 234 Template = RenderMobileTopMiniCart() 235 }; 236 237 Block miniCartCounterScriptTemplate = new Block 238 { 239 Id = "MiniCartCounterScriptTemplate", 240 Template = RenderMobileMiniCartCounterContent() 241 }; 242 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 243 } 244 else 245 { 246 mobileHeaderMiniCart = new Block 247 { 248 Id = "MobileHeaderMiniCart", 249 SortId = 20 250 }; 251 } 252 253 if (!mobileHideSearch) 254 { 255 Block mobileHeaderSearchBar = new Block() 256 { 257 Id = "MobileHeaderSearchBar", 258 SortId = 30, 259 Template = RenderMobileTopSearchBar() 260 }; 261 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar); 262 } 263 264 switch (mobileTopLayout) 265 { 266 case "nav-left": 267 mobileHeaderNavigation.SortId = 10; 268 mobileHeaderLogo.SortId = 20; 269 mobileHeaderActions.SortId = 30; 270 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 271 break; 272 case "nav-right": 273 mobileHeaderLogo.SortId = 10; 274 mobileHeaderActions.SortId = 20; 275 mobileHeaderNavigation.SortId = 30; 276 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 277 break; 278 case "nav-search-left": 279 mobileHeaderNavigation.SortId = 10; 280 mobileHeaderLogo.SortId = 20; 281 mobileHeaderActions.SortId = 30; 282 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 283 break; 284 case "search-left": 285 mobileHeaderActions.SortId = 10; 286 mobileHeaderLogo.SortId = 20; 287 mobileHeaderNavigation.SortId = 30; 288 mobileHeaderMiniCart.SortId = 0; 289 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 290 break; 291 } 292 } 293 294 295 @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"); } 296 297 298 299 300 @helper RenderMobileTop() 301 { 302 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList(); 303 <nav class="main-navigation-mobile dw-mod"> 304 <div class="center-container top-container__center-container dw-mod"> 305 <div class="grid grid--align-center"> 306 @RenderBlockList(subBlocks) 307 </div> 308 </div> 309 </nav> 310 } 311 312 @helper RenderMobileHeaderNavigation() 313 { 314 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList(); 315 316 <div class="grid__col-auto-width"> 317 <ul class="menu dw-mod"> 318 @RenderBlockList(subBlocks) 319 </ul> 320 </div> 321 } 322 323 @helper RenderMobileHeaderNavigationTrigger() 324 { 325 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 326 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label> 327 </li> 328 } 329 330 @helper RenderMobileHeaderLogo() 331 { 332 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList(); 333 334 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"; 335 string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : ""; 336 string logoHref = System.Web.HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority); 337 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName"); 338 339 string mobileLogo = "/Files/Images/logo-dynamicweb.png"; 340 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null) 341 { 342 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded; 343 } 344 345 if (Path.GetExtension(mobileLogo).ToLower() != ".svg") 346 { 347 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&amp;width=100&amp;crop=5&amp;Compression=75&amp;image=" + mobileLogo; 348 } 349 else 350 { 351 mobileLogo = HttpUtility.UrlDecode(mobileLogo); 352 } 353 354 <div class="grid__col-auto grid__col--bleed"> 355 <div class="grid__cell @centeredLogo"> 356 <a href="@logoHref" class="logo logo--mobile u-inline-block dw-mod"> 357 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" /> 358 </a> 359 </div> 360 361 @RenderBlockList(subBlocks) 362 </div> 363 } 364 365 @helper RenderMobileTopActions() 366 { 367 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList(); 368 369 <div class="grid__col-auto-width"> 370 <ul class="menu dw-mod"> 371 @RenderBlockList(subBlocks) 372 </ul> 373 </div> 374 } 375 376 @helper RenderMobileTopSearch() 377 { 378 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 379 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 380 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 381 </label> 382 </li> 383 } 384 385 @helper RenderMobileTopMiniCart() 386 { 387 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 388 int cartPageId = GetPageIdByNavigationTag("CartPage"); 389 double cartProductsCount = Model.Cart.TotalProductsCount; 390 391 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper"> 392 <div class="mini-cart dw-mod"> 393 <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"> 394 <div class="u-inline u-position-relative"> 395 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 396 <div class="mini-cart__counter dw-mod"> 397 <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"> 398 <div class="js-mini-cart-counter-content" data-count="@cartProductsCount"> 399 @cartProductsCount 400 </div> 401 </div> 402 </div> 403 </div> 404 </a> 405 </div> 406 </li> 407 } 408 409 @helper RenderMobileTopSearchBar() 410 { 411 string searchFeedId = ""; 412 string searchSecondFeedId = ""; 413 int groupsFeedId; 414 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 415 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 416 string resultPageLink; 417 string searchPlaceholder; 418 string searchType = "product-search"; 419 string searchTemplate; 420 string searchContentTemplate = ""; 421 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 422 bool showGroups = true; 423 string onKeyPressEvent = ""; 424 if (Shops.KorsholmShopId == Pageview.Area.EcomShopId) 425 { 426 onKeyPressEvent = "onkeypress=\"if (event.key === 'Enter') { event.preventDefault(); ClerkActions.ShowResultsPage(); }\""; 427 } 428 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 429 { 430 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 431 resultPageLink = contentSearchPageLink; 432 searchPlaceholder = Translate("Search page"); 433 groupsFeedId = 0; 434 searchType = "content-search"; 435 searchTemplate = "SearchPagesTemplate"; 436 showGroups = false; 437 } 438 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 439 { 440 searchFeedId = productsPageId + "&feed=true"; 441 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 442 resultPageLink = Converter.ToString(productsPageId); 443 searchPlaceholder = Translate("Search products or pages"); 444 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 445 searchType = "combined-search"; 446 searchTemplate = "SearchProductsTemplateWrap"; 447 searchContentTemplate = "SearchPagesTemplateWrap"; 448 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 449 } 450 else 451 { 452 resultPageLink = Converter.ToString(productsPageId); 453 searchFeedId = productsPageId + "&feed=true"; 454 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 455 searchPlaceholder = Translate("Search products"); 456 searchTemplate = "SearchProductsTemplate"; 457 searchType = "product-search"; 458 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 459 } 460 461 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" /> 462 463 <div class="main-navigation-mobile typeahead-mobile dw-mod"> 464 <div class="center-container top-container__center-container dw-mod"> 465 <div class="grid"> 466 <div class="grid__col-auto"> 467 <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"> 468 <input type="text" class="typeahead-mobile__search-field-input js-typeahead-search-field u-w160px u-no-margin" id="clerk-instant-search" placeholder="@searchPlaceholder" value="@searchValue" @onKeyPressEvent> 469 @if (string.IsNullOrEmpty(searchSecondFeedId)) 470 { 471 <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> 472 } 473 else 474 { 475 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid @(Pageview.Area.EcomShopId == Shops.KorsholmShopId ? "d-none" : "")"> 476 <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> 477 <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> 478 </div> 479 } 480 481 @if (Pageview.Area.EcomShopId == Shops.KorsholmShopId) 482 { 483 <div id="instant-search" 484 class="clerk clerk-mobile" 485 data-template="@@instant-search" 486 data-instant-search="#clerk-instant-search" 487 data-instant-search-suggestions="6" 488 data-instant-search-pages="6" 489 data-instant-search-categories="6" 490 data-instant-search-positioning="below" 491 data-autofill="false" 492 data-search-page="@GetPageIdByNavigationTag("ProductsPage")"></div> 493 <!-- Bind the different event handlers --> 494 <script type="text/javascript"> 495 const instantSearch = document.querySelector('#instant-search') 496 const options = { 497 attributes: true 498 } 499 500 function callback(mutationList, observer) { 501 mutationList.forEach(function (mutation) { 502 if (mutation.type === 'attributes' && mutation.attributeName === 'class') { 503 // handle class change 504 const htmlElement = document.querySelector('html'); 505 const typeaheadMobile = document.querySelector('.typeahead-mobile'); 506 if (instantSearch.classList.contains('clerk-instant-search-visible')) { 507 htmlElement.classList.add('overflow-hidden'); 508 htmlElement.style.setProperty("--instant-search-top-position", typeaheadMobile.clientHeight + 'px'); 509 typeaheadMobile.classList.add('search-active'); 510 } else { 511 htmlElement.classList.remove('overflow-hidden'); 512 typeaheadMobile.classList.remove('search-active'); 513 } 514 } 515 }) 516 } 517 518 const myobserver = new MutationObserver(callback) 519 myobserver.observe(instantSearch, options) 520 </script> 521 } 522 <button type="button" class="typeahead-search-button 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> 523 </div> 524 </div> 525 <div class="grid__col-auto-width"> 526 <ul class="menu dw-mod"> 527 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 528 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 529 <i class="fas fa-times fa-1_5x"></i> 530 </label> 531 </li> 532 </ul> 533 </div> 534 </div> 535 </div> 536 </div> 537 } 538 539 @helper RenderMobileMiniCartCounterContent() 540 { 541 <script id="MiniCartCounterContent" type="text/x-template"> 542 {{#.}} 543 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> 544 {{numberofproducts}} 545 </div> 546 {{/.}} 547 </script> 548 } 549 </text> 550 <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 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 = 20, Template = RenderMobileNavigationOrdersAction() }; mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction); } if (!mobileHideMyFavoritesLink) { Block mobileNavigationFavoritesAction = new Block { Id = "MobileNavigationFavoritesAction", SortId = 30, Template = RenderMobileNavigationFavoritesAction() }; mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction); } if (!mobileHideMySavedCardsLink) { Block mobileNavigationSavedCardsAction = new Block { Id = "MobileNavigationFavoritesAction", SortId = 30, Template = RenderMobileNavigationSavedCardsAction() }; mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction); } 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 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"; <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> 551 } 552 else 553 { 554 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 555 556 @using System 557 @using System.Web 558 @using System.Collections.Generic 559 @using Dynamicweb.Rapido.Blocks.Extensibility 560 @using Dynamicweb.Rapido.Blocks 561 562 @functions { 563 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master"); 564 } 565 566 @{ 567 Block masterTools = new Block() 568 { 569 Id = "MasterDesktopTools", 570 SortId = 10, 571 Template = RenderDesktopTools(), 572 SkipRenderBlocksList = true, 573 BlocksList = new List<Block> 574 { 575 new Block { 576 Id = "MasterDesktopToolsText", 577 SortId = 10, 578 Template = RenderDesktopToolsText(), 579 Design = new Design 580 { 581 Size = "auto", 582 HidePadding = true, 583 RenderType = RenderType.Column 584 } 585 }, 586 new Block { 587 Id = "MasterDesktopToolsNavigation", 588 SortId = 20, 589 Template = RenderDesktopToolsNavigation(), 590 Design = new Design 591 { 592 Size = "auto-width", 593 HidePadding = true, 594 RenderType = RenderType.Column 595 } 596 } 597 } 598 }; 599 headerBlocksPage.Add("MasterHeader", masterTools); 600 601 Block masterDesktopExtra = new Block() 602 { 603 Id = "MasterDesktopExtra", 604 SortId = 10, 605 Template = RenderDesktopExtra(), 606 SkipRenderBlocksList = true 607 }; 608 headerBlocksPage.Add("MasterHeader", masterDesktopExtra); 609 610 Block masterDesktopNavigation = new Block() 611 { 612 Id = "MasterDesktopNavigation", 613 SortId = 20, 614 Template = RenderDesktopNavigation(), 615 SkipRenderBlocksList = true 616 }; 617 headerBlocksPage.Add("MasterHeader", masterDesktopNavigation); 618 } 619 620 @* Include the Blocks for the page *@ 621 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 622 623 @using System 624 @using System.Web 625 @using Dynamicweb.Rapido.Blocks.Extensibility 626 @using Dynamicweb.Rapido.Blocks 627 628 @{ 629 Block masterDesktopLogo = new Block 630 { 631 Id = "MasterDesktopLogo", 632 SortId = 10, 633 Template = RenderDesktopLogo(), 634 Design = new Design 635 { 636 Size = "auto-width", 637 HidePadding = true, 638 RenderType = RenderType.Column, 639 CssClass = "grid--align-self-center" 640 } 641 }; 642 643 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo); 644 } 645 646 647 @helper RenderDesktopLogo() 648 { 649 string logoHref = System.Web.HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority); 650 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 651 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : ""; 652 alignClass = topLayout == "splitted-center" ? "u-middle" : alignClass; 653 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png"; 654 if (Path.GetExtension(logo).ToLower() != ".svg") 655 { 656 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight"); 657 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40; 658 logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&amp;crop=5&amp;Compression=75&amp;image=" + logo; 659 } 660 else 661 { 662 logo = HttpUtility.UrlDecode(logo); 663 } 664 665 <div class="logo @alignClass dw-mod"> 666 <a href="@logoHref" class="logo__img dw-mod u-block"> 667 <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" /> 668 </a> 669 </div> 670 } 671 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 672 673 @using System 674 @using System.Web 675 @using Dynamicweb.Rapido.Blocks.Extensibility 676 @using Dynamicweb.Rapido.Blocks 677 678 @functions { 679 bool isMegaMenu; 680 } 681 682 @{ 683 isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false; 684 Block masterDesktopMenu = new Block 685 { 686 Id = "MasterDesktopMenu", 687 SortId = 10, 688 Template = RenderDesktopMenu(), 689 Design = new Design 690 { 691 Size = "auto", 692 HidePadding = true, 693 RenderType = RenderType.Column 694 } 695 }; 696 697 if (isMegaMenu) 698 { 699 masterDesktopMenu.Design.CssClass = "u-reset-position"; 700 } 701 702 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu); 703 } 704 705 @helper RenderDesktopMenu() 706 { 707 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 708 string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : ""; 709 menuAlignment = topLayout == "minimal-center" ? "grid--align-self-center" : topLayout; 710 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; 711 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 712 bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders"); 713 int startLevel = renderPagesInToolBar ? 1 : 0; 714 715 string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"); 716 717 bool useGuntexTheme = Model.Area.Item.GetItem("Layout").GetBoolean("Guntex_Theme"); 718 719 <div class="grid__cell u-flex u-justify-content--between @(isMegaMenu ? "u-reset-position" : "") @menuAlignment"> 720 @if (!isMegaMenu) 721 { 722 @RenderNavigation(new 723 { 724 id = "topnavigation", 725 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 726 startLevel = startLevel, 727 ecomStartLevel = startLevel + 1, 728 endlevel = 5, 729 expandmode = "all", 730 template = "BaseMenuWithDropdown.xslt" 731 }); 732 } 733 else 734 { 735 @RenderNavigation(new 736 { 737 id = "topnavigation", 738 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 739 startLevel = startLevel, 740 ecomStartLevel = startLevel + 1, 741 endlevel = 5, 742 promotionImage = megamenuPromotionImage, 743 promotionLink = promotionLink, 744 expandmode = "all", 745 showOnlyHeaders = showOnlyHeaders.ToString().ToLower(), 746 template = "BaseMegaMenu.xslt" 747 }); 748 } 749 @if(useGuntexTheme && Pageview.Device.ToString() != "Mobile") 750 { 751 <div class="grid--align-self-end dw-mod header-some"> 752 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 753 { 754 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 755 string socialIconClass = socialIcon.SelectedValue; 756 string socialIconTitle = socialIcon.SelectedName; 757 string socialLink = socialitem.GetString("Link"); 758 759 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-left--lg menu__link dw-mod" rel="noopener"><i class="@socialIconClass fa-2x"></i></a> 760 } 761 </div> 762 } 763 </div> 764 } 765 @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> } 766 @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> } } 767 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ 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"; 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 (!hideMyOrdersLink) { @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list") } @if (!hideMyFavoritesLink) { @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon) } @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> } 768 @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> } 769 @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> } 770 @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> } 771 @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> } 772 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 773 774 @using System 775 @using System.Web 776 @using Dynamicweb.Rapido.Blocks.Extensibility 777 @using Dynamicweb.Rapido.Blocks 778 @using S_DW_Korsholm.CustomCode.Constants 779 780 @functions { 781 public class SearchConfiguration 782 { 783 public string searchFeedId { get; set; } 784 public string searchSecondFeedId { get; set; } 785 public int groupsFeedId { get; set; } 786 public string resultPageLink { get; set; } 787 public string searchPlaceholder { get; set; } 788 public string searchType { get; set; } 789 public string searchTemplate { get; set; } 790 public string searchContentTemplate { get; set; } 791 public string searchValue { get; set; } 792 public bool showGroups { get; set; } 793 794 public SearchConfiguration() 795 { 796 searchFeedId = ""; 797 searchSecondFeedId = ""; 798 searchType = "product-search"; 799 searchContentTemplate = ""; 800 showGroups = true; 801 } 802 } 803 } 804 @{ 805 Block masterSearchBar = new Block 806 { 807 Id = "MasterSearchBar", 808 SortId = 40, 809 Template = RenderSearch("bar"), 810 Design = new Design 811 { 812 Size = "auto", 813 HidePadding = true, 814 RenderType = RenderType.Column 815 } 816 }; 817 818 Block masterSearchAction = new Block 819 { 820 Id = "MasterDesktopActionsMenuSearch", 821 SortId = 10, 822 Template = RenderSearch() 823 }; 824 825 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar); 826 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction); 827 } 828 829 @helper RenderSearch(string type = "mini-search") 830 { 831 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage")); 832 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 833 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch"; 834 835 SearchConfiguration searchConfiguration = null; 836 837 switch (searchType) 838 { 839 case "contentSearch": 840 searchConfiguration = new SearchConfiguration() 841 { 842 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 843 resultPageLink = contentSearchPageLink, 844 searchPlaceholder = Translate("Search page"), 845 groupsFeedId = 0, 846 searchType = "content-search", 847 searchTemplate = "SearchPagesTemplate", 848 showGroups = false 849 }; 850 break; 851 case "combinedSearch": 852 searchConfiguration = new SearchConfiguration() 853 { 854 searchFeedId = productsPageId + "&feed=true", 855 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 856 resultPageLink = Converter.ToString(productsPageId), 857 searchPlaceholder = Translate("Search products or pages"), 858 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 859 searchType = "combined-search", 860 searchTemplate = "SearchProductsTemplateWrap", 861 searchContentTemplate = "SearchPagesTemplateWrap", 862 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 863 }; 864 break; 865 default: //productSearch 866 searchConfiguration = new SearchConfiguration() 867 { 868 resultPageLink = Converter.ToString(productsPageId), 869 searchFeedId = productsPageId + "&feed=true", 870 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 871 searchPlaceholder = Translate("Search products"), 872 searchTemplate = "SearchProductsTemplate", 873 searchType = "product-search", 874 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 875 }; 876 break; 877 } 878 searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 879 880 if (type == "mini-search") 881 { 882 @RenderMiniSearch(searchConfiguration) 883 } 884 else 885 { 886 @RenderSearchBar(searchConfiguration) 887 } 888 } 889 890 @helper RenderSearchBar(SearchConfiguration options) 891 { 892 string onKeyPressEvent = ""; 893 if (Shops.KorsholmShopId == Pageview.Area.EcomShopId) 894 { 895 onKeyPressEvent = "onkeypress=\"if (event.key === 'Enter') { event.preventDefault(); ClerkActions.ShowResultsPage(); }\""; 896 } 897 <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar" 898 data-page-size="7" 899 data-search-feed-id="@options.searchFeedId" 900 data-search-second-feed-id="@options.searchSecondFeedId" 901 data-result-page-id="@options.resultPageLink" 902 data-groups-page-id="@options.groupsFeedId" 903 data-search-type="@options.searchType"> 904 @if (options.showGroups) 905 { 906 <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> 907 <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> 908 } 909 <div class="typeahead-search-field"> 910 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" @onKeyPressEvent id="clerk-instant-search" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 911 912 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 913 { 914 <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> 915 } 916 else 917 { 918 <div class="dropdown dropdown--absolute-position dropdown--combined grid @(Pageview.Area.EcomShopId == Shops.KorsholmShopId ? "d-none" : "")"> 919 <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> 920 <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> 921 </div> 922 } 923 924 @if (Pageview.Area.EcomShopId == Shops.KorsholmShopId) 925 { 926 <div id="instant-search" 927 class="clerk clerk-desktop" 928 data-template="@@instant-search" 929 data-instant-search="#clerk-instant-search" 930 data-instant-search-suggestions="6" 931 data-instant-search-pages="6" 932 data-instant-search-positioning="below" 933 data-autofill="false" 934 data-search-page="@GetPageIdByNavigationTag("ProductsPage")"> 935 </div> 936 <!-- Bind the different event handlers --> 937 <script type="text/javascript"> 938 const instantSearch = document.querySelector('#instant-search') 939 const options = { 940 attributes: true 941 } 942 943 function callback(mutationList, observer) { 944 mutationList.forEach(function (mutation) { 945 if (mutation.type === 'attributes' && mutation.attributeName === 'class') { 946 // handle class change 947 const htmlElement = document.querySelector('html'); 948 const headerElement = document.querySelector('header'); 949 if (instantSearch.classList.contains('clerk-instant-search-visible')) { 950 htmlElement.classList.add('overflow-hidden'); 951 htmlElement.style.setProperty("--instant-search-top-position", headerElement.clientHeight + 'px'); 952 headerElement.classList.add('search-active'); 953 } else { 954 htmlElement.classList.remove('overflow-hidden'); 955 headerElement.classList.remove('search-active'); 956 } 957 } 958 }) 959 } 960 961 const myobserver = new MutationObserver(callback) 962 myobserver.observe(instantSearch, options) 963 </script> 964 } 965 </div> 966 <button type="button" class="typeahead-search-button 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> 967 </div> 968 } 969 970 @helper RenderMiniSearch(SearchConfiguration options) 971 { 972 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 973 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 974 975 <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"> 976 <div class="@menuLinkClass dw-mod" title="@Translate("Search")"> 977 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 978 </div> 979 <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod"> 980 <div class="typeahead js-typeahead" id="ProductSearchBar" 981 data-page-size="7" 982 data-search-feed-id="@options.searchFeedId" 983 data-search-second-feed-id="@options.searchSecondFeedId" 984 data-result-page-id="@options.resultPageLink" 985 data-search-type="@options.searchType"> 986 <div class="typeahead-search-field"> 987 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 988 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 989 { 990 <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> 991 } 992 else 993 { 994 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> 995 <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> 996 <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> 997 </div> 998 } 999 </div> 1000 </div> 1001 </div> 1002 </li> 1003 } 1004 @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; } } 1005 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ } 1006 1007 1008 @helper RenderDesktopTools() 1009 { 1010 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList(); 1011 1012 <div class="tools-navigation dw-mod"> 1013 <div class="center-container grid top-container__center-container dw-mod"> 1014 @RenderBlockList(subBlocks) 1015 </div> 1016 </div> 1017 } 1018 1019 @helper RenderDesktopToolsText() 1020 { 1021 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText"); 1022 if (!string.IsNullOrEmpty(toolsText)) 1023 { 1024 <div class="u-margin-top u-margin-bottom">@toolsText</div> 1025 } 1026 } 1027 1028 @helper RenderDesktopToolsNavigation() 1029 { 1030 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 1031 1032 if (renderPagesInToolBar) 1033 { 1034 @RenderNavigation(new 1035 { 1036 id = "topToolsNavigation", 1037 cssclass = "menu menu-tools dw-mod dwnavigation", 1038 template = "TopMenu.xslt" 1039 }) 1040 } 1041 } 1042 1043 @helper RenderDesktopNavigation() 1044 { 1045 bool useGuntexTheme = Model.Area.Item.GetItem("Layout").GetBoolean("Guntex_Theme"); 1046 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList(); 1047 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1048 string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : ""; 1049 <nav class="main-navigation dw-mod"> 1050 <div class="center-container top-container__center-container grid @alignClass dw-mod"> 1051 @RenderBlockList(subBlocks) 1052 @if (useGuntexTheme == false) 1053 { 1054 <!-- Custom code --> 1055 <!-- TrustBox widget - Micro Combo --> 1056 <div class="header-trustpilot-widget trustpilot-widget" data-locale="da-DK" data-template-id="5419b6ffb0d04a076446a9af" data-businessunit-id="46a16878000064000500737d" data-style-height="20px" data-style-width="100%" data-theme="dark"> 1057 <a href="https://dk.trustpilot.com/review/www.korsholm.dk" target="_blank" rel="noopener">Trustpilot</a> 1058 </div> 1059 <!-- End TrustBox widget --> 1060 <!-- TrustBox script --> 1061 <script type="text/javascript" src="//widget.trustpilot.com/bootstrap/v5/tp.widget.bootstrap.min.js" async></script> 1062 <!-- End TrustBox script --> 1063 <!-- End Custom code --> 1064 } 1065 </div> 1066 </nav> 1067 } 1068 1069 @helper RenderDesktopExtra() 1070 { 1071 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList(); 1072 1073 if (subBlocks.Count > 0) 1074 { 1075 <div class="header header-top dw-mod"> 1076 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod"> 1077 @RenderBlockList(subBlocks) 1078 </div> 1079 </div> 1080 } 1081 }</text> 1082 } 1083 1084 @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> } 1085 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 1086 1087 @using System 1088 @using System.Web 1089 @using System.Collections.Generic 1090 @using Dynamicweb.Rapido.Blocks.Extensibility 1091 @using Dynamicweb.Rapido.Blocks 1092 1093 @{ 1094 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 1095 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table"; 1096 1097 Block orderLines = new Block 1098 { 1099 Id = "MiniCartOrderLines", 1100 SkipRenderBlocksList = true, 1101 BlocksList = new List<Block> 1102 { 1103 new Block { 1104 Id = "MiniCartOrderLinesList", 1105 SortId = 20, 1106 Template = RenderMiniCartOrderLinesList() 1107 } 1108 } 1109 }; 1110 1111 Block orderlinesScriptTemplates = new Block 1112 { 1113 Id = "OrderlinesScriptTemplates" 1114 }; 1115 1116 if (orderlinesView == "table") 1117 { 1118 orderLines.Template = RenderMiniCartOrderLinesTable(); 1119 orderLines.BlocksList.Add( 1120 new Block 1121 { 1122 Id = "MiniCartOrderlinesTableHeader", 1123 SortId = 10, 1124 Template = RenderMiniCartOrderLinesHeader() 1125 } 1126 ); 1127 1128 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates(); 1129 } 1130 else 1131 { 1132 orderLines.Template = RenderMiniCartOrderLinesBlocks(); 1133 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates(); 1134 } 1135 1136 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates); 1137 1138 Block miniCartScriptTemplates = new Block() 1139 { 1140 Id = "MasterMiniCartTemplates", 1141 SortId = 1, 1142 Template = RenderMiniCartScriptTemplates(), 1143 SkipRenderBlocksList = true, 1144 BlocksList = new List<Block> 1145 { 1146 orderLines, 1147 new Block { 1148 Id = "MiniCartFooter", 1149 Template = RenderMiniCartFooter(), 1150 SortId = 50, 1151 SkipRenderBlocksList = true, 1152 BlocksList = new List<Block> 1153 { 1154 new Block { 1155 Id = "MiniCartSubTotal", 1156 Template = RenderMiniCartSubTotal(), 1157 SortId = 30 1158 }, 1159 new Block { 1160 Id = "MiniCartFees", 1161 Template = RenderMiniCartFees(), 1162 SortId = 40 1163 }, 1164 new Block { 1165 Id = "MiniCartPoints", 1166 Template = RenderMiniCartPoints(), 1167 SortId = 50 1168 }, 1169 new Block { 1170 Id = "MiniCartTotal", 1171 Template = RenderMiniCartTotal(), 1172 SortId = 60 1173 }, 1174 new Block { 1175 Id = "MiniCartDisclaimer", 1176 Template = RenderMiniCartDisclaimer(), 1177 SortId = 70 1178 }, 1179 new Block { 1180 Id = "MiniCartActions", 1181 Template = RenderMiniCartActions(), 1182 SortId = 80 1183 } 1184 } 1185 } 1186 } 1187 }; 1188 1189 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates); 1190 } 1191 1192 @helper RenderMiniCartScriptsTableTemplates() 1193 { 1194 <script id="MiniCartOrderline" type="text/x-template"> 1195 {{#unless isEmpty}} 1196 <tr> 1197 <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> 1198 <td class="u-va-middle"> 1199 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a> 1200 {{#if variantname}} 1201 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a> 1202 {{/if}} 1203 {{#if unitname}} 1204 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div> 1205 {{/if}} 1206 </td> 1207 <td class="u-ta-right u-va-middle">{{quantity}}</td> 1208 <td class="u-ta-right u-va-middle"> 1209 {{#if pointsTotal}} 1210 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 1211 {{else}} 1212 {{totalprice}} 1213 {{/if}} 1214 </td> 1215 </tr> 1216 {{/unless}} 1217 </script> 1218 1219 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 1220 {{#unless isEmpty}} 1221 <tr class="table__row--no-border"> 1222 <td class="u-w60px">&nbsp;</td> 1223 <td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td> 1224 <td class="u-ta-right">&nbsp;</td> 1225 <td class="u-ta-right">{{totalprice}}</td> 1226 </tr> 1227 {{/unless}} 1228 </script> 1229 } 1230 1231 @helper RenderMiniCartScriptsListTemplates() 1232 { 1233 int cartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 1234 1235 <script id="MiniCartOrderline" type="text/x-template"> 1236 {{#unless isEmpty}} 1237 <div class="mini-cart-orderline grid dw-mod"> 1238 <div class="grid__col-4"> 1239 <a href="{{link}}" class="{{hideimage}}"> 1240 <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}}"> 1241 </a> 1242 </div> 1243 <div class="grid__col-8"> 1244 <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> 1245 {{#if variantname}} 1246 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div> 1247 {{/if}} 1248 {{#if unitname}} 1249 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div> 1250 {{/if}} 1251 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div> 1252 1253 <div class="grid__cell-footer"> 1254 <div class="grid__cell"> 1255 <div class="u-pull--left mini-cart-orderline__price dw-mod"> 1256 {{#if pointsTotal}} 1257 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 1258 {{else}} 1259 {{totalprice}} 1260 {{/if}} 1261 </div> 1262 <button type="button" 1263 title="@Translate("Remove orderline")" 1264 class="btn btn--clean btn--condensed u-pull--right mini-cart-orderline__remove-btn dw-mod" 1265 onclick="{{#if googleImpression}}googleImpressionRemoveFromCart({{googleImpression}});{{/if}}Cart.UpdateCart('miniCartContent', '/Default.aspx?ID=@cartFeedPageId', 'CartCmd=DelOrderLine&key={{orderLineId}}&redirect=false', true);">@Translate("Remove")</button> 1266 </div> 1267 </div> 1268 </div> 1269 </div> 1270 {{/unless}} 1271 </script> 1272 1273 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 1274 {{#unless isEmpty}} 1275 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod"> 1276 <div class="grid__col-4"> 1277 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div> 1278 </div> 1279 <div class="grid__col-8">{{totalprice}}</div> 1280 </div> 1281 {{/unless}} 1282 </script> 1283 } 1284 1285 @helper RenderMiniCartScriptTemplates() 1286 { 1287 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 1288 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 1289 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage")); 1290 bool miniCartUseGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 1291 1292 <script id="MiniCartContent" type="text/x-template"> 1293 {{#.}} 1294 {{#unless isEmpty}} 1295 @if (miniCartUseGoogleTagManager) 1296 { 1297 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> 1298 } 1299 @RenderBlockList(subBlocks) 1300 {{/unless}} 1301 {{/.}} 1302 </script> 1303 } 1304 1305 @helper RenderMiniCartOrderLinesTable() 1306 { 1307 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 1308 1309 <div class="u-overflow-auto"> 1310 <table class="table mini-cart-table dw-mod"> 1311 @RenderBlockList(subBlocks) 1312 </table> 1313 </div> 1314 } 1315 1316 @helper RenderMiniCartOrderLinesBlocks() 1317 { 1318 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 1319 1320 <div class="u-overflow-auto"> 1321 @RenderBlockList(subBlocks) 1322 </div> 1323 } 1324 1325 @helper RenderMiniCartOrderLinesHeader() 1326 { 1327 <thead> 1328 <tr> 1329 <td>&nbsp;</td> 1330 <td>@Translate("Product")</td> 1331 <td class="u-ta-right">@Translate("Qty")</td> 1332 <td class="u-ta-right" width="120">@Translate("Price")</td> 1333 </tr> 1334 </thead> 1335 } 1336 1337 @helper RenderMiniCartOrderLinesList() 1338 { 1339 <text> 1340 {{#OrderLines}} 1341 {{#ifCond template "===" "CartOrderline"}} 1342 {{>MiniCartOrderline}} 1343 {{/ifCond}} 1344 {{#ifCond template "===" "CartOrderlineMobile"}} 1345 {{>MiniCartOrderline}} 1346 {{/ifCond}} 1347 {{#ifCond template "===" "CartOrderlineDiscount"}} 1348 {{>MiniCartOrderlineDiscount}} 1349 {{/ifCond}} 1350 {{/OrderLines}} 1351 </text> 1352 } 1353 1354 @helper RenderMiniCartFees() 1355 { 1356 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 1357 if (!pointShop) 1358 { 1359 <text> 1360 {{#unless hidePaymentfee}} 1361 <div class="grid"> 1362 <div class="grid__col-6 grid__col--bleed-y"> 1363 {{paymentmethod}} 1364 </div> 1365 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{paymentfee}}</div> 1366 </div> 1367 {{/unless}} 1368 </text> 1369 } 1370 <text> 1371 {{#unless hideShippingfee}} 1372 <div class="grid"> 1373 <div class="grid__col-6 grid__col--bleed-y"> 1374 {{shippingmethod}} 1375 </div> 1376 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{shippingfee}}</div> 1377 </div> 1378 {{/unless}} 1379 </text> 1380 <text> 1381 {{#if hasTaxSettings}} 1382 <div class="grid"> 1383 <div class="grid__col-6 grid__col--bleed-y">@Translate("Sales Tax")</div> 1384 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{totaltaxes}}</div> 1385 </div> 1386 {{/if}} 1387 </text> 1388 } 1389 1390 @helper RenderMiniCartFooter() 1391 { 1392 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList(); 1393 1394 <div class="mini-cart__footer u-border-top u-padding-top dw-mod"> 1395 @RenderBlockList(subBlocks) 1396 </div> 1397 } 1398 1399 @helper RenderMiniCartActions() 1400 { 1401 int cartPageId = GetPageIdByNavigationTag("CartPage"); 1402 bool useGuntexTheme = Model.Area.Item.GetItem("Layout").GetBoolean("Guntex_Theme"); 1403 1404 <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> 1405 if (useGuntexTheme) 1406 { 1407 <button type="button" title="@Translate("Empty cart")" class="btn btn--secondary btn--transparent u-full-width dw-mod u-no-margin u-margin-bottom" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event);">@Translate("Empty cart")</button> 1408 } 1409 } 1410 1411 @helper RenderMiniCartPoints() 1412 { 1413 <text> 1414 {{#if earnings}} 1415 <div class="grid"> 1416 <div class="grid__col-6 grid__col--bleed-y">@Translate("Earnings")</div> 1417 <div class="grid__col-6 grid__col--bleed-y grid--align-end"> 1418 <div> 1419 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points") 1420 </div> 1421 </div> 1422 </div> 1423 {{/if}} 1424 </text> 1425 } 1426 1427 @helper RenderMiniCartSubTotal() 1428 { 1429 bool hasTaxSettings = Dynamicweb.Rapido.Services.Countries.HasTaxSettings(Model.Cart.ID); 1430 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 1431 if (!pointShop) 1432 { 1433 <text> 1434 {{#unless hideSubTotal}} 1435 <div class="grid dw-mod u-bold"> 1436 <div class="grid__col-6 grid__col--bleed-y">@Translate("Subtotal")</div> 1437 <div class="grid__col-6 grid__col--bleed-y grid--align-end"> 1438 @if (hasTaxSettings) 1439 { 1440 <text>{{subtotalpricewithouttaxes}}</text> 1441 } 1442 else 1443 { 1444 <text>{{subtotalprice}}</text> 1445 } 1446 </div> 1447 </div> 1448 {{/unless}} 1449 </text> 1450 } 1451 } 1452 1453 @helper RenderMiniCartTotal() 1454 { 1455 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 1456 1457 <div class="mini-cart-totals grid u-border-top u-margin-top dw-mod"> 1458 <div class="grid__col-6">@Translate("Total")</div> 1459 <div class="grid__col-6 grid--align-end"> 1460 <div> 1461 @if (pointShop) 1462 { 1463 <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points") 1464 } 1465 else 1466 { 1467 <text>{{totalprice}}</text> 1468 } 1469 </div> 1470 </div> 1471 </div> 1472 } 1473 1474 @helper RenderMiniCartDisclaimer() 1475 { 1476 <text> 1477 {{#if showCheckoutDisclaimer}} 1478 <div class="grid u-margin-bottom u-ta-right"> 1479 <small class="grid__col-12">{{checkoutDisclaimer}}</small> 1480 </div> 1481 {{/if}} 1482 </text> 1483 } 1484 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 1485 1486 @using Dynamicweb.Rapido.Blocks.Extensibility 1487 @using Dynamicweb.Rapido.Blocks 1488 @using Dynamicweb.Rapido.Blocks.Components.General 1489 @using Dynamicweb.Rapido.Blocks.Components 1490 @using Dynamicweb.Rapido.Services 1491 1492 @{ 1493 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 1494 string addToCartNotificationMiniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 1495 bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 1496 1497 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !string.IsNullOrEmpty(addToCartNotificationType)) 1498 { 1499 if (addToCartNotificationType == "modal") 1500 { 1501 Block addToCartNotificationModal = new Block 1502 { 1503 Id = "AddToCartNotificationModal", 1504 Template = RenderAddToCartNotificationModal() 1505 }; 1506 1507 Block addToCartNotificationScript = new Block 1508 { 1509 Id = "AddToCartNotificationScript", 1510 Template = RenderAddToCartNotificationModalScript() 1511 }; 1512 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal); 1513 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 1514 } 1515 else if (addToCartNotificationType == "toggle" && addToCartNotificationMiniCartLayout != "none" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 1516 { 1517 Block addToCartNotificationScript = new Block 1518 { 1519 Id = "AddToCartNotificationScript", 1520 Template = RenderAddToCartNotificationToggleScript() 1521 }; 1522 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 1523 } 1524 } 1525 } 1526 1527 @helper RenderAddToCartNotificationModal() 1528 { 1529 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 1530 } 1531 1532 @helper RenderAddToCartNotificationModalScript() 1533 { 1534 int cartPageId = GetPageIdByNavigationTag("CartPage"); 1535 1536 <script id="LastAddedProductTemplate" type="text/x-template"> 1537 @{ 1538 1539 Modal lastAddedProduct = new Modal 1540 { 1541 Id = "LastAddedProduct", 1542 Heading = new Heading 1543 { 1544 Level = 2, 1545 Title = Translate("Product is added to the cart") 1546 }, 1547 Width = ModalWidth.Md, 1548 BodyTemplate = RenderModalContent() 1549 }; 1550 1551 lastAddedProduct.AddActions( 1552 new Button 1553 { 1554 ButtonType = ButtonType.Button, 1555 ButtonLayout = ButtonLayout.Secondary, 1556 Title = Translate("Continue shopping"), 1557 CssClass = "u-pull--left u-no-margin btn--sm", 1558 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false" 1559 }, 1560 new Link 1561 { 1562 Href = "/Default.aspx?ID=" + cartPageId, 1563 ButtonLayout = ButtonLayout.Secondary, 1564 CssClass = "u-pull--right u-no-margin btn--sm", 1565 Title = Translate("Proceed to checkout"), 1566 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false" 1567 } 1568 ); 1569 1570 @Render(lastAddedProduct) 1571 } 1572 </script> 1573 <script> 1574 document.addEventListener('addToCart', function (event) { 1575 Cart.ShowLastAddedProductModal(event.detail); 1576 }); 1577 </script> 1578 } 1579 1580 @helper RenderModalContent() 1581 { 1582 <div class="grid"> 1583 <div class="grid__col-2"> 1584 @Render(new Image { Path = "{{ productInfo.image }}", Link = "{{ productInfo.link }}", Title = "{{ productInfo.name }}", DisableImageEngine = true }) 1585 </div> 1586 <div class="u-padding grid--align-self-center"> 1587 <span>{{quantity}}</span> x 1588 </div> 1589 <div class="grid__col-auto grid--align-self-center"> 1590 <div>{{productInfo.name}}</div> 1591 {{#if productInfo.variantName}} 1592 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 1593 {{/if}} 1594 {{#if productInfo.unitName}} 1595 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 1596 {{/if}} 1597 </div> 1598 </div> 1599 } 1600 1601 @helper RenderAddToCartNotificationToggleScript() 1602 { 1603 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 1604 1605 <script> 1606 document.addEventListener('addToCart', function () { 1607 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 1608 }); 1609 document.addEventListener('click', function (event) { 1610 var ignoreClickOnMeElement = document.getElementById('miniCart'); 1611 var ignoreClickOnMeElement2 = document.getElementById('MiniCart'); 1612 var isClickInsideElement = ignoreClickOnMeElement.contains(event.target); 1613 var isClickInsideElement2 = ignoreClickOnMeElement2.contains(event.target); 1614 var isOpened = document.getElementsByClassName("panel-trigger")[0].checked; 1615 if (!isClickInsideElement && !isClickInsideElement2 && isOpened) { 1616 document.getElementsByClassName("panel-trigger")[0].checked = false; 1617 } 1618 }); 1619 </script> 1620 } 1621 @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> } 1622 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 1623 1624 @using System 1625 @using System.Web 1626 @using System.Collections.Generic 1627 @using Dynamicweb.Rapido.Blocks.Extensibility 1628 @using Dynamicweb.Rapido.Blocks 1629 @using Dynamicweb.Ecommerce.Common 1630 1631 @{ 1632 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); 1633 1634 Block masterScriptReferences = new Block() 1635 { 1636 Id = "MasterScriptReferences", 1637 SortId = 1, 1638 Template = RenderMasterScriptReferences() 1639 }; 1640 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); 1641 1642 string profitMetricsId = Model.Area.Item.GetItem("Settings").GetString("ProfitMetricsId"); 1643 if (!string.IsNullOrEmpty(profitMetricsId)) 1644 { 1645 Block profitMetricsReference = new Block() 1646 { 1647 Id = "MasterScriptReferences", 1648 SortId = 1, 1649 Template = RenderProfitMetricsScriptReference(profitMetricsId) 1650 }; 1651 referencesBlocksPage.Add(MasterBlockId.MasterReferences, profitMetricsReference); 1652 } 1653 } 1654 1655 @helper RenderMasterScriptReferences() 1656 { 1657 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script> 1658 <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script> 1659 string noZebraJsLink = "/Files/Templates/Designs/Rapido/js/nz/main.js"; 1660 var noZebraCssStyleFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath(noZebraJsLink)); 1661 <script src="@noZebraJsLink?@noZebraCssStyleFileInfo.LastWriteTime.Ticks" defer></script> 1662 if (Pageview.Area.EcomShopId == S_DW_Korsholm.CustomCode.Constants.Shops.KorsholmShopId) 1663 { 1664 <script src="https://www.googleoptimize.com/optimize.js?id=GTM-WC7J8SW"></script> 1665 } 1666 1667 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript")) 1668 { 1669 string customJsLink = "/Files/Templates/Designs/Rapido/js/custom.js"; 1670 var customJsFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath(customJsLink)); 1671 <script src="@customJsLink?@customJsFileInfo.LastWriteTime.Ticks"></script> 1672 PushPromise("/Files/Templates/Designs/Rapido/js/custom.min.js"); 1673 } 1674 1675 PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"); 1676 PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js"); 1677 PushPromise("/Files/Templates/Designs/Rapido/js/nz/main.js"); 1678 } 1679 1680 @helper RenderProfitMetricsScriptReference(string profitMetricsId) 1681 { 1682 <!-- ProfitMetrics hybrid script for korsholm.dk --> 1683 <script> 1684 window.profitMetrics = { 1685 pid: "@profitMetricsId", 1686 }; 1687 </script> 1688 <script src="https://cdn1.profitmetrics.io/@profitMetricsId/bundle.js" defer></script> 1689 1690 } 1691 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 1692 1693 @using System 1694 @using System.Web 1695 @using System.Collections.Generic 1696 @using Dynamicweb.Rapido.Blocks.Extensibility 1697 @using Dynamicweb.Rapido.Blocks 1698 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 1699 @using Dynamicweb.Rapido.Services 1700 1701 @{ 1702 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); 1703 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 1704 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID")); 1705 1706 if (!navigationItemsHideSearch || isFavoriteList) 1707 { 1708 Block masterSearchScriptTemplates = new Block() 1709 { 1710 Id = "MasterSearchScriptTemplates", 1711 SortId = 1, 1712 Template = RenderSearchScriptTemplates() 1713 }; 1714 1715 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); 1716 } 1717 } 1718 1719 @helper RenderSearchScriptTemplates() 1720 { 1721 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 1722 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 1723 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 1724 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 1725 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults"); 1726 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton"); 1727 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton"); 1728 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton"); 1729 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 1730 1731 <script id="SearchGroupsTemplate" type="text/x-template"> 1732 {{#.}} 1733 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 1734 {{/.}} 1735 </script> 1736 1737 <script id="SearchProductsTemplate" type="text/x-template"> 1738 {{#each .}} 1739 {{#Product}} 1740 {{#ifCond template "!==" "SearchMore"}} 1741 <li class="dropdown__item dropdown__item--seperator dw-mod"> 1742 @if (useFacebookPixel) 1743 { 1744 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 1745 } 1746 @if (useGoogleTagManager) 1747 { 1748 <text>{{{googleEnchantImpression googleImpression}}}</text> 1749 } 1750 <div> 1751 <a href="{{link}}" 1752 class="js-typeahead-link u-color-inherit u-pull--left" 1753 onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}" 1754 title="{{name}}{{#if variantName}}, {{variantName}}{{/if}}"> 1755 <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> 1756 <div class="u-pull--left"> 1757 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}{{#if variantName}}, {{variantName}}{{/if}}</div> 1758 @if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 1759 { 1760 if (pointShopOnly) 1761 { 1762 <text> 1763 {{#if havePointPrice}} 1764 <div> 1765 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 1766 </div> 1767 {{else}} 1768 <small class="help-text u-no-margin">@Translate("Not available")</small> 1769 {{/if}} 1770 {{#unless canBePurchasedWithPoints}} 1771 {{#if havePointPrice}} 1772 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 1773 {{/if}} 1774 {{/unless}} 1775 </text> 1776 } 1777 else 1778 { 1779 <div>{{price}}</div> 1780 } 1781 } 1782 </div> 1783 </a> 1784 <div class="u-margin-left u-pull--right"> 1785 @{ 1786 var viewBtn = new Link 1787 { 1788 Href = "{{link}}", 1789 OnClick = "{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}", 1790 ButtonLayout = ButtonLayout.Secondary, 1791 CssClass = "btn--condensed u-no-margin u-w80px js-ignore-click-outside", 1792 Title = Translate("View") 1793 }; 1794 } 1795 @if (showAddToCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 1796 { 1797 <text>{{#if hideAddToCartButton}}</text> 1798 @Render(viewBtn) 1799 <text>{{else}}</text> 1800 @Render(new AddToCartButton 1801 { 1802 HideTitle = true, 1803 ProductId = "{{productId}}", 1804 VariantId = "{{variantid}}", 1805 ProductInfo = "{{productInfo}}", 1806 BuyForPoints = pointShopOnly, 1807 OnClick = "{{facebookPixelAction}}", 1808 CssClass = "u-w80px u-no-margin js-ignore-click-outside", 1809 Icon = new Icon { 1810 CssClass = "js-ignore-click-outside" 1811 }, 1812 ExtraAttributes = new Dictionary<string, string> 1813 { 1814 { "{{disabledBuyButton}}", "" } 1815 } 1816 }) 1817 <text>{{/if}}</text> 1818 } 1819 else if (showViewButton) 1820 { 1821 @Render(viewBtn) 1822 } 1823 @if (showAddToDownloadButton) 1824 { 1825 <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}}"> 1826 <i class="fas fa-plus js-button-icon"></i> 1827 </button> 1828 } 1829 </div> 1830 </div> 1831 </li> 1832 {{/ifCond}} 1833 {{#ifCond template "===" "SearchMore"}} 1834 {{>SearchMoreProducts}} 1835 {{/ifCond}} 1836 {{/Product}} 1837 {{else}} 1838 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 1839 @Translate("Your search gave 0 results") 1840 </li> 1841 {{/each}} 1842 </script> 1843 1844 <script id="SearchMoreProducts" type="text/x-template"> 1845 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 1846 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 1847 @Translate("View all") 1848 </a> 1849 </li> 1850 </script> 1851 1852 <script id="SearchMorePages" type="text/x-template"> 1853 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 1854 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 1855 @Translate("View all") 1856 </a> 1857 </li> 1858 </script> 1859 1860 <script id="SearchPagesTemplate" type="text/x-template"> 1861 {{#each .}} 1862 {{#ifCond template "!==" "SearchMore"}} 1863 <li class="dropdown__item dropdown__item--seperator dropdown__item--no-padding dw-mod"> 1864 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link dropdown__link u-color-inherit"> 1865 <div class="u-margin-right u-inline"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 1866 <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> 1867 </a> 1868 </li> 1869 {{/ifCond}} 1870 {{#ifCond template "===" "SearchMore"}} 1871 {{>SearchMorePages}} 1872 {{/ifCond}} 1873 {{else}} 1874 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 1875 @Translate("Your search gave 0 results") 1876 </li> 1877 {{/each}} 1878 </script> 1879 1880 <script id="SearchPagesTemplateWrap" type="text/x-template"> 1881 <div class="dropdown__column-header">@Translate("Pages")</div> 1882 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 1883 {{>SearchPagesTemplate}} 1884 </ul> 1885 </script> 1886 1887 <script id="SearchProductsTemplateWrap" type="text/x-template"> 1888 <div class="dropdown__column-header">@Translate("Products")</div> 1889 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 1890 {{>SearchProductsTemplate}} 1891 </ul> 1892 </script> 1893 } 1894 1895 @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 1896 1897 @* Component *@ 1898 1899 @helper RenderAddToCartButton(AddToCartButton settings) 1900 { 1901 if (!settings.HideTitle) 1902 { 1903 if (string.IsNullOrEmpty(settings.Title)) 1904 { 1905 if (settings.BuyForPoints) 1906 { 1907 settings.Title = Translate("Buy with points"); 1908 } 1909 else 1910 { 1911 settings.Title = Translate("Add to cart"); 1912 } 1913 } 1914 } 1915 else 1916 { 1917 settings.Title = ""; 1918 } 1919 1920 if (settings.Icon == null) 1921 { 1922 settings.Icon = new Icon(); 1923 settings.Icon.LabelPosition = Dynamicweb.Rapido.Blocks.Components.General.IconLabelPosition.After; 1924 } 1925 1926 if (string.IsNullOrEmpty(settings.Icon.Name)) 1927 { 1928 settings.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue; 1929 } 1930 1931 string customAttributes = ""; 1932 if (settings.ExtraAttributes.TryGetValue("Amount", out string amount)) 1933 { 1934 customAttributes += amount; 1935 } 1936 1937 settings.OnClick = "CustomCart.AddToCart(event, { " + 1938 "id: '" + settings.ProductId + "'," + 1939 (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") + 1940 (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") + 1941 (settings.BuyForPoints ? "buyForPoints: true," : "") + 1942 (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") + 1943 "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value)") + 1944 (!string.IsNullOrEmpty(customAttributes) ? ", amount: " + customAttributes: "") + 1945 "});" + settings.OnClick; 1946 1947 @RenderButton(settings) 1948 } @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> } 1949 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 1950 1951 @using System 1952 @using System.Web 1953 @using System.Collections.Generic 1954 @using Dynamicweb.Rapido.Blocks.Extensibility 1955 @using Dynamicweb.Rapido.Blocks 1956 1957 @{ 1958 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 1959 1960 Block primaryBottomSnippets = new Block() 1961 { 1962 Id = "MasterJavascriptInitializers", 1963 SortId = 100, 1964 Template = RenderPrimaryBottomSnippets() 1965 }; 1966 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); 1967 1968 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 1969 { 1970 Block miniCartPageId = new Block 1971 { 1972 Id = "MiniCartPageId", 1973 Template = RenderMiniCartPageId() 1974 }; 1975 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, miniCartPageId); 1976 } 1977 } 1978 1979 @helper RenderPrimaryBottomSnippets() 1980 { 1981 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode"); 1982 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 1983 1984 if (isWireframeMode) 1985 { 1986 <script> 1987 Wireframe.Init(true); 1988 </script> 1989 } 1990 1991 1992 if (useGoogleTagManager) 1993 { 1994 <script> 1995 document.addEventListener('addToCart', function(event) { 1996 var googleImpression = JSON.parse(event.detail.productInfo.googleImpression); 1997 if (typeof googleImpression == "string") { 1998 googleImpression = JSON.parse(event.detail.productInfo.googleImpression); 1999 } 2000 dataLayer.push({ 2001 'event': 'addToCart', 2002 'ecommerce': { 2003 'currencyCode': googleImpression.currency, 2004 'add': { 2005 'products': [{ 2006 'name': googleImpression.name, 2007 'id': googleImpression.id, 2008 'price': googleImpression.price, 2009 'brand': googleImpression.brand, 2010 'category': googleImpression.category, 2011 'variant': googleImpression.variant, 2012 'quantity': event.detail.quantity 2013 }] 2014 } 2015 } 2016 }); 2017 }); 2018 </script> 2019 } 2020 2021 //if digitalwarehouse 2022 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart")) 2023 { 2024 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]); 2025 2026 if (string.IsNullOrEmpty(cartContextId)) 2027 { 2028 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2"); 2029 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps); 2030 cartContextId = cartSettings.OrderContextID; 2031 HttpContext.Current.Application["DownloadCartContext"] = cartContextId; 2032 } 2033 2034 <script> 2035 let downloadCart = new DownloadCart({ 2036 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"), 2037 contextId: "@cartContextId", 2038 addButtonText: "@Translate("Add")", 2039 removeButtonText: "@Translate("Remove")" 2040 }); 2041 </script> 2042 } 2043 2044 <!--$$Javascripts--> 2045 } 2046 2047 @helper RenderMiniCartPageId() 2048 { 2049 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 2050 <script> 2051 window.cartId = "@miniCartFeedPageId"; 2052 </script> 2053 } 2054 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2055 @using Dynamicweb.Rapido.Blocks 2056 2057 @{ 2058 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master"); 2059 2060 Block topBar = new Block 2061 { 2062 Id = "TopBar", 2063 SortId = 1, 2064 Template = RenderTopBar() 2065 }; 2066 masterCustomBlocksPage.Add(MasterBlockId.MasterHeader, topBar); 2067 } 2068 2069 @helper RenderTopBar() 2070 { 2071 var topBarItems = Model.Area.Item.GetItem("Custom")?.GetItem("CustomSettings")?.GetItems("TopBar"); 2072 2073 if (topBarItems != null && topBarItems.Any()) 2074 { 2075 <div class="toolbox-top-bar dw-mod" id="toolboxCustom"> 2076 <div class="center-container header-nav grid top-container__center-container dw-mod"> 2077 <div class="grid grid--align-center grid--justify-space-between toolbox-top-bar__container"> 2078 @for (var i = 0; i < topBarItems.Count; i++) 2079 { 2080 var item = topBarItems[i]; 2081 string title = item.GetString("Title"); 2082 string image = item.GetFile("Icon")?.PathUrlEncoded; 2083 string link = !string.IsNullOrEmpty(item.GetString("Link")) ? item.GetString("Link") : ""; 2084 string linkTarget = link.Contains("http") ? "_blank" : "_self"; 2085 2086 <div class="grid__cell--align-middle-left @(i > 1 ? "u-hidden-sm" : "")"> 2087 @if (!string.IsNullOrWhiteSpace(link)) 2088 { 2089 <a class="grid__cell--align-middle-left u-color-inherit" href="@link" target="@linkTarget"> 2090 @RenderItemContent(image, title) 2091 </a> 2092 } 2093 else 2094 { 2095 @RenderItemContent(image, title) 2096 } 2097 </div> 2098 } 2099 </div> 2100 </div> 2101 </div> 2102 } 2103 } 2104 2105 @helper RenderItemContent(string imageSrc, string title) 2106 { 2107 if (!string.IsNullOrWhiteSpace(imageSrc)) 2108 { 2109 if (Path.GetExtension(imageSrc).ToLower() != ".svg") 2110 { 2111 imageSrc = "/Admin/Public/GetImage.ashx?height=24px&amp;crop=5&amp;Compression=75&amp;image=" + imageSrc; 2112 } 2113 else 2114 { 2115 imageSrc = HttpUtility.UrlDecode(imageSrc); 2116 } 2117 2118 <img src="@imageSrc" class="grid__cell-img" alt="@title" style="width: 16px; height: 12px;"> 2119 } 2120 if (!string.IsNullOrWhiteSpace(title)) 2121 { 2122 <span class="u-margin-left toolbox-top-bar__title">@title</span> 2123 } 2124 } 2125 2126 2127 @functions { 2128 public class ManifestIcon 2129 { 2130 public string src { get; set; } 2131 public string type { get; set; } 2132 public string sizes { get; set; } 2133 } 2134 2135 public class Manifest 2136 { 2137 public string name { get; set; } 2138 public string short_name { get; set; } 2139 public string start_url { get; set; } 2140 public string display { get; set; } 2141 public string background_color { get; set; } 2142 public string theme_color { get; set; } 2143 public List<ManifestIcon> icons { get; set; } 2144 } 2145 } 2146 2147 <!DOCTYPE html> 2148 2149 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> 2150 2151 2152 2153 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 2154 @RenderBlockList(masterPage.BlocksRoot.BlocksList) 2155 2156 2157 2158 @helper RenderMasterHead() 2159 { 2160 List<Block> subBlocks = this.masterPage.GetBlockListById("Head").OrderBy(item => item.SortId).ToList(); 2161 2162 <head> 2163 <!-- Rapido version 3.4.3 --> 2164 2165 @RenderBlockList(subBlocks) 2166 </head> 2167 2168 } 2169 2170 @helper RenderMasterMetadata() 2171 { 2172 var swatches = new Dynamicweb.Content.Items.ColorSwatchService(); 2173 var brandColors = swatches.GetColorSwatch(1); 2174 string brandColorOne = brandColors.Palette["BrandColor1"]; 2175 2176 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) 2177 { 2178 Manifest manifest = new Manifest 2179 { 2180 name = Model.Area.Item.GetItem("Settings").GetString("AppName"), 2181 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"), 2182 start_url = "/", 2183 display = "standalone", 2184 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"), 2185 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor") 2186 }; 2187 2188 manifest.icons = new List<ManifestIcon> { 2189 new ManifestIcon { 2190 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 2191 sizes = "192x192", 2192 type = "image/png" 2193 }, 2194 new ManifestIcon { 2195 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 2196 sizes = "512x512", 2197 type = "image/png" 2198 }, 2199 new ManifestIcon { 2200 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 2201 sizes = "1024x1024", 2202 type = "image/png" 2203 } 2204 }; 2205 2206 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json"); 2207 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest); 2208 string currentManifest = File.ReadAllText(manifestFilePath); 2209 2210 if (manifestJSON != currentManifest) 2211 { 2212 File.WriteAllText(manifestFilePath, manifestJSON); 2213 } 2214 } 2215 2216 <meta charset="utf-8" /> 2217 <title>@Model.Title</title> 2218 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 2219 <meta name="theme-color" content="@brandColorOne" /> 2220 2221 if (Pageview.Page.Nofollow && Pageview.Page.Noindex) 2222 { 2223 <meta name="robots" content="noindex, nofollow"> 2224 } 2225 else if (Dynamicweb.Context.Current.Request.Url.Host.EndsWith("nozebrahosting.dk") || Dynamicweb.Context.Current.Request.Url.Host.EndsWith("dynamicweb.dk")) 2226 { 2227 <meta name="robots" content="noindex, nofollow"> 2228 } 2229 else 2230 { 2231 <meta name="robots" content="index, follow"> 2232 } 2233 2234 if (Model.MetaTags != null && !Model.MetaTags.Contains("og:image") && Model.PropertyItem != null && Model.PropertyItem.GetFile("OpenGraphImage") != null) 2235 { 2236 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"))); 2237 } 2238 2239 if (!Model.MetaTags.Contains("og:description") && !string.IsNullOrEmpty(Model.Description)) 2240 { 2241 Pageview.Meta.AddTag("og:description", Model.Description); 2242 } 2243 2244 Pageview.Meta.AddTag("og:title", Model.Title); 2245 Pageview.Meta.AddTag("og:site_name", Model.Name); 2246 Pageview.Meta.AddTag("og:url", HttpContext.Current.Request.Url.ToString()); 2247 Pageview.Meta.AddTag("og:type", "Website"); 2248 2249 if (!string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("FacebookAppID"))) 2250 { 2251 Pageview.Meta.AddTag("fb:app_id", Model.Area.Item.GetItem("Settings").GetString("FacebookAppID")); 2252 } 2253 2254 string domainUrl = Dynamicweb.Context.Current.Request.Url.Scheme + "://" + Dynamicweb.Context.Current.Request.Url.Host; 2255 string canonical = ProductHelper.Canonical(Pageview, domainUrl, Dynamicweb.Context.Current.Request.Url.ToString()); 2256 int queryIndex = canonical.IndexOf("?"); 2257 if (queryIndex > 0 && !canonical.ToLower().Contains("pagesize")) 2258 { 2259 canonical = canonical.Substring(0, queryIndex); 2260 } 2261 2262 @Model.MetaTags 2263 <link rel="canonical" href="@canonical" /> 2264 } 2265 2266 @helper RenderMasterCss() 2267 { 2268 var fonts = new string[] { 2269 getFontFamily("Layout", "HeaderFont"), 2270 getFontFamily("Layout", "SubheaderFont"), 2271 getFontFamily("Layout", "TertiaryHeaderFont"), 2272 getFontFamily("Layout", "BodyText"), 2273 getFontFamily("Layout", "Header", "ToolsFont"), 2274 getFontFamily("Layout", "Header", "NavigationFont"), 2275 getFontFamily("Layout", "MobileNavigation", "Font"), 2276 getFontFamily("ProductList", "Facets", "HeaderFont"), 2277 getFontFamily("ProductPage", "PriceFontDesign"), 2278 getFontFamily("Ecommerce", "SaleSticker", "Font"), 2279 getFontFamily("Ecommerce", "NewSticker", "Font"), 2280 getFontFamily("Ecommerce", "CustomSticker", "Font") 2281 }; 2282 2283 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks; 2284 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png"; 2285 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro"); 2286 string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css"; 2287 bool useGuntexTheme = Model.Area.Item.GetItem("Layout").GetBoolean("Guntex_Theme"); 2288 string cookiebotId = Model.Area.Item.GetItem("Settings").GetString("Cookiebot_ID"); 2289 string klaviyoCompanyId = Model.Area.Item.GetItem("Settings").GetString("Klaviyo_Company_ID"); 2290 string clerkId = Model.Area.Item.GetItem("Settings").GetString("Clerk_ID"); 2291 2292 if (useFontAwesomePro) 2293 { 2294 fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css"; 2295 } 2296 2297 //Favicon 2298 <link href="@favicon" rel="icon" type="image/png"> 2299 2300 //Base (Default, wireframe) styles 2301 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css"> 2302 2303 //Rapido Css from Website Settings 2304 <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css"> 2305 2306 //NZ Custom stylesheet 2307 if (useGuntexTheme) 2308 { 2309 string guntexCssLink = "/Files/Templates/Designs/Rapido/css/nz/main-guntex.css"; 2310 var guntexCssStyleFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath(guntexCssLink)); 2311 <link rel="stylesheet" id="igniteCss" type="text/css" href="@guntexCssLink?@guntexCssStyleFileInfo.LastWriteTime.Ticks"> 2312 } 2313 else 2314 { 2315 string noZebraCssLink = "/Files/Templates/Designs/Rapido/css/nz/main.css"; 2316 var noZebraCssStyleFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath(noZebraCssLink)); 2317 <link rel="stylesheet" id="igniteCss" type="text/css" href="@noZebraCssLink?@noZebraCssStyleFileInfo.LastWriteTime.Ticks"> 2318 } 2319 2320 //Ignite Css (Custom site specific styles) 2321 <link rel="stylesheet" id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css"> 2322 2323 //Font awesome 2324 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css"> 2325 2326 //Flag icon 2327 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css"> 2328 2329 //Google fonts 2330 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))); 2331 2332 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> 2333 2334 if (!String.IsNullOrEmpty(cookiebotId)) 2335 { 2336 <script id="Cookiebot" src="https://consent.cookiebot.com/uc.js" data-cbid="@cookiebotId" data-blockingmode="auto" type="text/javascript"></script> 2337 } 2338 2339 if (!String.IsNullOrEmpty(klaviyoCompanyId)) 2340 { 2341 <script type="text/javascript" async="" src="https://static.klaviyo.com/onsite/js/klaviyo.js?company_id=@klaviyoCompanyId"></script> 2342 } 2343 2344 if (!String.IsNullOrEmpty(clerkId)) 2345 { 2346 <script type="text/javascript"> 2347 (function (w, d) { 2348 var e = d.createElement('script'); e.type = 'text/javascript'; e.async = true; 2349 e.src = (d.location.protocol == 'https:' ? 'https' : 'http') + '://cdn.clerk.io/clerk.js'; 2350 var s = d.getElementsByTagName('script')[0]; s.parentNode.insertBefore(e, s); 2351 w.__clerk_q = w.__clerk_q || []; w.Clerk = w.Clerk || function () { w.__clerk_q.push(arguments) }; 2352 })(window, document); 2353 2354 Clerk('config', { 2355 key: '@clerkId' 2356 }); 2357 </script> 2358 } 2359 2360 PushPromise(favicon); 2361 PushPromise(fontAwesomeCssLink); 2362 PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css"); 2363 PushPromise(autoCssLink); 2364 PushPromise("/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css"); 2365 PushPromise("/Files/Images/placeholder.gif"); 2366 PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css"); 2367 } 2368 2369 @helper RenderMasterManifest() 2370 { 2371 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName"))) 2372 { 2373 <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json"> 2374 PushPromise("/Files/Templates/Designs/Rapido/manifest.json"); 2375 } 2376 } 2377 2378 @helper RenderMasterBody() 2379 { 2380 List<Block> subBlocks = this.masterPage.GetBlockListById("Body").OrderBy(item => item.SortId).ToList(); 2381 string designLayout = Model.PropertyItem.GetItem("CustomSettings") != null ? Model.PropertyItem.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.PropertyItem.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : ""; 2382 if (!String.IsNullOrEmpty(designLayout)) 2383 { 2384 designLayout = "class=\"" + designLayout + "\""; 2385 } 2386 2387 <body @designLayout> 2388 @RenderBlockList(subBlocks) 2389 </body> 2390 2391 } 2392 2393 @helper RenderMasterHeader() 2394 { 2395 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); 2396 bool isItemStickyTop = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 2397 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && isItemStickyTop; 2398 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; 2399 string isSemiStickyTop = !isItemStickyTop ? "top-container--semi-sticky" : ""; 2400 bool useGuntexTheme = Model.Area.Item.GetItem("Layout").GetBoolean("Guntex_Theme"); 2401 string themeClass = useGuntexTheme ? "guntex-theme" : ""; 2402 2403 <header class="top-container @stickyTop @isSemiStickyTop @themeClass no-print dw-mod" id="Top"> 2404 @RenderBlockList(subBlocks) 2405 </header> 2406 } 2407 2408 @helper RenderMain() 2409 { 2410 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); 2411 2412 <main class="site dw-mod"> 2413 @RenderBlockList(subBlocks) 2414 </main> 2415 } 2416 2417 @helper RenderPageContent() 2418 { 2419 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 2420 string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; 2421 2422 <div id="Page" class="page @pagePos"> 2423 <div id="content"> 2424 @RenderSnippet("Content") 2425 </div> 2426 </div> 2427 } 2428 2429 @* Hack to support nested helpers *@ 2430 @SnippetStart("Content") 2431 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @* Render the grid *@ @Model.Grid("Grid", "Grid", "default:true;sort:1", "Pages") 2432 @SnippetEnd("Content") 2433 2434 @helper RenderIosTabletFix() 2435 { 2436 if (Pageview.Device != Dynamicweb.Frontend.Devices.DeviceType.Tablet && Pageview.Platform != Dynamicweb.Frontend.Devices.PlatformType.Ios) 2437 { 2438 <script> 2439 let isIpadIOS = (/iPad/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) && !window.MSStream; 2440 if (isIpadIOS) { 2441 var separator = (window.location.href.indexOf("?") === -1) ? "?" : "&"; 2442 window.location.href = window.location.href + separator + "DeviceType=Tablet&PlatformType=Ios"; 2443 } 2444 </script> 2445 } 2446 } 2447 2448 </html> 2449 2450