Error executing template "Designs/Rapido/_parsed/Page.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_6198343aac3649eea44700ef6d3799d7.<RenderMasterMetadata>b__203_0(TextWriter __razor_helper_writer) in f:\Domains\Sites\asibrake.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7983
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_6198343aac3649eea44700ef6d3799d7.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in f:\Domains\Sites\asibrake.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 246
   at CompiledRazorTemplates.Dynamic.RazorEngine_6198343aac3649eea44700ef6d3799d7.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in f:\Domains\Sites\asibrake.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_6198343aac3649eea44700ef6d3799d7.<RenderMasterHead>b__202_0(TextWriter __razor_helper_writer) in f:\Domains\Sites\asibrake.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7928
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_6198343aac3649eea44700ef6d3799d7.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in f:\Domains\Sites\asibrake.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 246
   at CompiledRazorTemplates.Dynamic.RazorEngine_6198343aac3649eea44700ef6d3799d7.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in f:\Domains\Sites\asibrake.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_6198343aac3649eea44700ef6d3799d7.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in f:\Domains\Sites\asibrake.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 279
   at CompiledRazorTemplates.Dynamic.RazorEngine_6198343aac3649eea44700ef6d3799d7.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in f:\Domains\Sites\asibrake.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_6198343aac3649eea44700ef6d3799d7.Execute() in f:\Domains\Sites\asibrake.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7918
   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.Frontend 5 @using Dynamicweb.Frontend.Devices 6 @using Dynamicweb.Extensibility 7 @using Dynamicweb.Content 8 @using Dynamicweb.Security 9 @using Dynamicweb.Core 10 @using System 11 @using System.Web 12 @using System.IO 13 @using Dynamicweb.Rapido.Blocks 14 @using System.Net 15 16 17 @functions { 18 BlocksPage masterPage = BlocksPage.GetBlockPage("Master"); 19 20 string getFontFamily(params string[] items) 21 { 22 var itemParent = Pageview.AreaSettings; 23 foreach (var item in items) 24 { 25 itemParent = itemParent.GetItem(item); 26 if (itemParent == null) 27 { 28 return null; 29 } 30 } 31 32 var googleFont = itemParent.GetGoogleFont("FontFamily"); 33 if (googleFont == null) 34 { 35 return null; 36 } 37 return googleFont.Family.Replace(" ", "+"); 38 } 39 } 40 41 @{ 42 Block root = new Block 43 { 44 Id = "Root", 45 SortId = 10, 46 BlocksList = new List<Block> 47 { 48 new Block { 49 Id = "Head", 50 SortId = 10, 51 SkipRenderBlocksList = true, 52 Template = RenderMasterHead(), 53 BlocksList = new List<Block> 54 { 55 new Block { 56 Id = "HeadMetadata", 57 SortId = 10, 58 Template = RenderMasterMetadata(), 59 }, 60 new Block { 61 Id = "HeadCss", 62 SortId = 20, 63 Template = RenderMasterCss(), 64 }, 65 new Block { 66 Id = "HeadManifest", 67 SortId = 30, 68 Template = RenderMasterManifest(), 69 } 70 } 71 }, 72 new Block { 73 Id = "Body", 74 SortId = 20, 75 SkipRenderBlocksList = true, 76 Template = RenderMasterBody(), 77 BlocksList = new List<Block> 78 { 79 new Block() 80 { 81 Id = "Master", 82 SortId = 10, 83 BlocksList = new List<Block> { 84 new Block { 85 Id = "MasterTopSnippets", 86 SortId = 10 87 }, 88 new Block { 89 Id = "MasterMain", 90 SortId = 20, 91 Template = RenderMain(), 92 SkipRenderBlocksList = true, 93 BlocksList = new List<Block> { 94 new Block { 95 Id = "MasterHeader", 96 SortId = 10, 97 Template = RenderMasterHeader(), 98 SkipRenderBlocksList = true 99 }, 100 new Block { 101 Id = "MasterPageContent", 102 SortId = 20, 103 Template = RenderPageContent() 104 } 105 } 106 }, 107 new Block { 108 Id = "MasterFooter", 109 SortId = 30 110 }, 111 new Block { 112 Id = "MasterReferences", 113 SortId = 40 114 }, 115 new Block { 116 Id = "MasterBottomSnippets", 117 SortId = 50 118 } 119 } 120 } 121 } 122 } 123 } 124 }; 125 126 masterPage.Add(root); 127 } 128 129 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ 130 @using System.Text.RegularExpressions @using System.Collections.Generic @using System.Reflection @using System.Web @using System.Web.UI.HtmlControls @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.Articles @using Dynamicweb.Rapido.Blocks.Components.Documentation @using Dynamicweb.Rapido.Blocks @*--- START: Base block renderers ---*@ @helper RenderBlockList(List<Block> blocks) { bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; blocks = blocks.OrderBy(item => item.SortId).ToList(); foreach (Block item in blocks) { if (debug) { <!-- Block START: @item.Id --> } if (item.Design == null) { @RenderBlock(item) } else if (item.Design.RenderType == RenderType.None) { string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; <div class="@cssClass dw-mod"> @RenderBlock(item) </div> } else if (item.Design.RenderType != RenderType.Hide) { string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; if (!item.SkipRenderBlocksList) { if (item.Design.RenderType == RenderType.Row) { <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id"> @RenderBlock(item) </div> } if (item.Design.RenderType == RenderType.Column) { string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; string size = item.Design.Size ?? "12"; size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; <div class="grid__col-lg-@item.Design.Size grid__col-md-@item.Design.Size grid__col-sm-12 grid__col-xs-12 @hidePadding @cssClass dw-mod" id="Block__@item.Id"> @RenderBlock(item) </div> } if (item.Design.RenderType == RenderType.Table) { <table class="table @cssClass dw-mod" id="Block__@item.Id"> @RenderBlock(item) </table> } if (item.Design.RenderType == RenderType.TableRow) { <tr class="@cssClass dw-mod" id="Block__@item.Id"> @RenderBlock(item) </tr> } if (item.Design.RenderType == RenderType.TableColumn) { <td class="@cssClass dw-mod" id="Block__@item.Id"> @RenderBlock(item) </td> } if (item.Design.RenderType == RenderType.CardHeader) { <div class="card-header @cssClass dw-mod"> @RenderBlock(item) </div> } if (item.Design.RenderType == RenderType.CardBody) { <div class="card @cssClass dw-mod"> @RenderBlock(item) </div> } if (item.Design.RenderType == RenderType.CardFooter) { <div class="card-footer @cssClass dw-mod"> @RenderBlock(item) </div> } } else { @RenderBlock(item) } } if (debug) { <!-- Block END: @item.Id --> } } } @helper RenderBlock(Block item) { bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; if (item.Template != null) { @BlocksPage.RenderTemplate(item.Template) } if (item.Component != null) { string customSufix = "Custom"; string methodName = item.Component.HelperName; ComponentBase[] methodParameters = new ComponentBase[1]; methodParameters[0] = item.Component; Type methodType = this.GetType(); MethodInfo customMethod = methodType.GetMethod(methodName + customSufix); MethodInfo generalMethod = methodType.GetMethod(methodName); try { if (debug) { <!-- Component: @methodName.Replace("Render", "") --> } @customMethod.Invoke(this, methodParameters).ToString(); } catch { try { @generalMethod.Invoke(this, methodParameters).ToString(); } catch(Exception ex) { throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked", ex); } } } if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList) { @RenderBlockList(item.BlocksList) } } @*--- END: Base block renderers ---*@ 131 132 @* Include the components *@ 133 @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks @using System.IO @* Required *@ @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks @helper Render(ComponentBase component) { if (component != null) { @component.Render(this) } } @* Components *@ @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @* Component *@ @helper RenderIcon(Icon settings) { if (settings != null) { string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; if (settings.Name != null) { if (string.IsNullOrEmpty(settings.Label)) { <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> } else { if (settings.LabelPosition == IconLabelPosition.Before) { <span>@settings.Label <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i></span> } else { <span><i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> @settings.Label</span> } } } else if (!string.IsNullOrEmpty(settings.Label)) { @settings.Label } } } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Core @* Component *@ @helper RenderButton(Button settings) { if (settings != null && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) { Dictionary<string, string> attributes = new Dictionary<string, string>(); List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); if (settings.Disabled) { attributes.Add("disabled", "true"); classList.Add("disabled"); } if (!string.IsNullOrEmpty(settings.ConfirmText) || !string.IsNullOrEmpty(settings.ConfirmTitle)) { settings.Id = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); @RenderConfirmDialog(settings); settings.OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = true"; } if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } if (!string.IsNullOrEmpty(settings.AltText)) { attributes.Add("title", settings.AltText); } else if (!string.IsNullOrEmpty(settings.Title)) { attributes.Add("title", settings.Title); } var onClickEvents = new List<string>(); if (!string.IsNullOrEmpty(settings.OnClick)) { onClickEvents.Add(settings.OnClick); } if (!string.IsNullOrEmpty(settings.Href)) { onClickEvents.Add("location.href='" + settings.Href + "'"); } if (onClickEvents.Count > 0) { attributes.Add("onClick", string.Join(";", onClickEvents)); } if (settings.ButtonLayout != ButtonLayout.None) { classList.Add("btn"); string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); if (btnLayout == "linkclean") { btnLayout = "link-clean"; //fix } classList.Add("btn--" + btnLayout); } if (settings.Icon == null) { settings.Icon = new Icon(); } settings.Icon.Label = settings.Title; attributes.Add("type", Enum.GetName(typeof(ButtonType), settings.ButtonType).ToLower()); <button class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</button> } } @helper RenderConfirmDialog(Button settings) { Modal confirmDialog = new Modal { Id = settings.Id, Width = ModalWidth.Sm, Heading = new Heading { Level = 2, Title = settings.ConfirmTitle }, BodyText = settings.ConfirmText }; confirmDialog.AddAction(new Button { Title = Translate("Cancel"), ButtonLayout = ButtonLayout.Secondary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false"}); confirmDialog.AddAction(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false;" + settings.OnClick }); @Render(confirmDialog) } @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Core @helper RenderDashboard(Dashboard settings) { var widgets = settings.GetWidgets(); if (!string.IsNullOrEmpty(settings.WidgetsBaseBackgroundColor)) { //set bg color for them System.Drawing.Color color = System.Drawing.ColorTranslator.FromHtml(settings.WidgetsBaseBackgroundColor); int r = Convert.ToInt16(color.R); int g = Convert.ToInt16(color.G); int b = Convert.ToInt16(color.B); var count = widgets.Length; var max = Math.Max(r, Math.Max(g, b)); double step = 255.0 / (max * count); var i = 0; foreach (var widget in widgets) { i++; var shade = "rgb(" + Converter.ToString(r * step * i).Replace(",", ".") + ", " + Converter.ToString(g * step * i).Replace(",", ".") + ", " + Converter.ToString(b * step * i).Replace(",", ".") + ")"; widget.BackgroundColor = shade; } } <div class="dashboard @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> @foreach (var widget in widgets) { <div class="dashboard__widget"> @Render(widget) </div> } </div> } @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @helper RenderDashboardWidgetLink(DashboardWidgetLink settings) { if (!string.IsNullOrEmpty(settings.Link)) { var backgroundStyles = ""; if (!string.IsNullOrEmpty(settings.BackgroundColor)) { backgroundStyles = "style=\"background-color:" + settings.BackgroundColor + "\""; } <a href="@settings.Link" class="widget widget--link @settings.CssClass dw-mod" @backgroundStyles title="@settings.Title" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> <div class="u-center-middle u-color-light"> @if (settings.Icon != null) { settings.Icon.CssClass += "widget__icon"; @Render(settings.Icon) } <div class="widget__title">@settings.Title</div> </div> </a> } } @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @helper RenderDashboardWidgetCounter(DashboardWidgetCounter settings) { var backgroundStyles = ""; if (!string.IsNullOrEmpty(settings.BackgroundColor)) { backgroundStyles = "style='background-color:" + settings.BackgroundColor + "'"; } <div class="widget @settings.CssClass dw-mod" @backgroundStyles @ComponentMethods.AddAttributes(settings.ExtraAttributes)> <div class="u-center-middle u-color-light"> @if (settings.Icon != null) { settings.Icon.CssClass += "widget__icon"; @Render(settings.Icon) } <div class="widget__counter">@settings.Count</div> <div class="widget__title">@settings.Title</div> </div> </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Core @* Component *@ @helper RenderLink(Link settings) { if (settings != null && !string.IsNullOrEmpty(settings.Href) && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) { Dictionary<string, string> attributes = new Dictionary<string, string>(); List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); if (settings.Disabled) { attributes.Add("disabled", "true"); classList.Add("disabled"); } if (!string.IsNullOrEmpty(settings.AltText)) { attributes.Add("title", settings.AltText); } else if (!string.IsNullOrEmpty(settings.Title)) { attributes.Add("title", settings.Title); } if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onClick", settings.OnClick); } attributes.Add("href", settings.Href); if (settings.ButtonLayout != ButtonLayout.None) { classList.Add("btn"); string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); if (btnLayout == "linkclean") { btnLayout = "link-clean"; //fix } classList.Add("btn--" + btnLayout); } if (settings.Icon == null) { settings.Icon = new Icon(); } settings.Icon.Label = settings.Title; if (settings.Target == LinkTargetType.Blank && settings.Rel == LinkRelType.None) { settings.Rel = LinkRelType.Noopener; } if (settings.Target != LinkTargetType.None) { attributes.Add("target", "_" + Enum.GetName(typeof(LinkTargetType), settings.Target).ToLower()); } if (settings.Download) { attributes.Add("download", "true"); } if (settings.Rel != LinkRelType.None) { attributes.Add("rel", Enum.GetName(typeof(LinkRelType), settings.Rel).ToLower()); } <a class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</a> } } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks @* Component *@ @helper RenderRating(Rating settings) { if (settings.Score > 0) { int rating = settings.Score; string iconType = "fa-star"; switch (settings.Type.ToString()) { case "Stars": iconType = "fa-star"; break; case "Hearts": iconType = "fa-heart"; break; case "Lemons": iconType = "fa-lemon"; break; case "Bombs": iconType = "fa-bomb"; break; } <div class="u-ta-right"> @for (int i = 0; i < settings.OutOf; i++) { <i class="@(rating > i ? "fas" : "far") @iconType"></i> } </div> } } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderSelectFieldOption(SelectFieldOption settings) { Dictionary<string, string> attributes = new Dictionary<string, string>(); if (settings.Checked) { attributes.Add("selected", "true"); } if (settings.Disabled) { attributes.Add("disabled", "true"); } if (settings.Value != null) { attributes.Add("value", settings.Value); } if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } <option @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Label</option> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderNavigation(Navigation settings) { @RenderNavigation(new { id = settings.Id, cssclass = settings.CssClass, startLevel = settings.StartLevel, endlevel = settings.EndLevel, expandmode = settings.Expandmode, sitemapmode = settings.SitemapMode, template = settings.Template }) } @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) { settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; settings.SitemapMode = false; @RenderNavigation(settings) } @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderLeftNavigation(LeftNavigation settings) { settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; <div class="grid__cell"> @RenderNavigation(settings) </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Core @* Component *@ @helper RenderHeading(Heading settings) { if (settings != null && !string.IsNullOrEmpty(settings.Title)) { string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; string tagName = settings.Level != 0 ? "h" + settings.Level.ToString() : "div"; @("<" + tagName + " class=\"" + settings.CssClass + " dw-mod\" " + color + ">") if (!string.IsNullOrEmpty(settings.Link)) { @Render(new Link { Href = settings.Link, Icon = settings.Icon, Title = settings.Title, ButtonLayout = ButtonLayout.None }) } else { if (settings.Icon == null) { settings.Icon = new Icon(); } settings.Icon.Label = settings.Title; @Render(settings.Icon) } @("</" + tagName + ">"); } } @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks @* Component *@ @helper RenderImage(Image settings) { if (settings.FilterPrimary != ImageFilter.None || settings.FilterSecondary != ImageFilter.None) { Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(settings.FilterColor)) { optionalAttributes.Add("style", "background-color: " + settings.FilterColor); } if (settings.Caption != null) { @:<div> } var primaryFilterClass = settings.FilterPrimary.ToString().ToLower(); var secondaryFilterClass = settings.FilterSecondary.ToString().ToLower(); <div class="image-filter image-filter--@primaryFilterClass u-position-relative dw-mod" @ComponentMethods.AddAttributes(optionalAttributes)> <div class="image-filter image-filter--@secondaryFilterClass dw-mod"> @if (settings.Link != null) { <a href="@settings.Link"> @RenderTheImage(settings) </a> } else { @RenderTheImage(settings) } </div> </div> if (settings.Caption != null) { <span class="image-caption dw-mod">@settings.Caption</span> @:</div> } } else { if (settings.Caption != null) { @:<div> } if (!string.IsNullOrEmpty(settings.Link)) { <a href="@settings.Link"> @RenderTheImage(settings) </a> } else { @RenderTheImage(settings) } if (settings.Caption != null) { <span class="image-caption dw-mod">@settings.Caption</span> @:</div> } } } @helper RenderTheImage(Image settings) { if (settings != null) { string placeholderImage = "/Files/Images/placeholder.gif"; string imageEngine = "/Admin/Public/GetImage.ashx?"; string imageStyle = ""; switch (settings.Style) { case ImageStyle.Ball: imageStyle = "grid__cell-img--ball"; break; } if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle) { if (settings.ImageDefault != null) { settings.ImageDefault.Height = settings.ImageDefault.Width; } if (settings.ImageMedium != null) { settings.ImageMedium.Height = settings.ImageMedium.Width; } if (settings.ImageSmall != null) { settings.ImageSmall.Height = settings.ImageSmall.Width; } } string defaultImage = imageEngine; string imageSmall = ""; string imageMedium = ""; if (settings.DisableImageEngine) { defaultImage = settings.Path; } else { if (settings.ImageDefault != null) { defaultImage += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageDefault); if (settings.Path.GetType() != typeof(string)) { defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; } else { defaultImage += settings.Path != null ? "Image=" + settings.Path : ""; } } if (settings.ImageSmall != null) { imageSmall = "data-src-small=\"" + imageEngine; imageSmall += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageSmall); if (settings.Path.GetType() != typeof(string)) { imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; } else { imageSmall += settings.Path != null ? "Image=" + settings.Path : ""; } imageSmall += "\""; } if (settings.ImageMedium != null) { imageMedium = "data-src-medium=\"" + imageEngine; imageMedium += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageMedium); if (settings.Path.GetType() != typeof(string)) { imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; } else { imageMedium += settings.Path != null ? "Image=" + settings.Path : ""; } imageMedium += "\""; } } Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); } if (!string.IsNullOrEmpty(settings.Title)) { optionalAttributes.Add("alt", settings.Title); optionalAttributes.Add("title", settings.Title); } if (settings.DisableLazyLoad) { <img id="@settings.Id" class="@imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> } else { <img id="@settings.Id" class="b-lazy @imageStyle @settings.CssClass dw-mod" src="@placeholderImage" data-src="@defaultImage" @imageSmall @imageMedium @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> } } } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderFileField(FileField settings) { var attributes = new Dictionary<string, string>(); if (string.IsNullOrEmpty(settings.Id)) { settings.Id = Guid.NewGuid().ToString("N"); } if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } if (settings.Disabled) { attributes.Add("disabled", "true"); } if (settings.Required) { attributes.Add("required", "true"); } if (settings.Multiple) { attributes.Add("multiple", "true"); } if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } if (string.IsNullOrEmpty(settings.ChooseFileText)) { settings.ChooseFileText = Translate("Choose file"); } if (string.IsNullOrEmpty(settings.NoFilesChosenText)) { settings.NoFilesChosenText = Translate("No files chosen..."); } if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } string setValueToFakeInput = "FileUpload.setValueToFakeInput(this)"; attributes.Add("onchange", setValueToFakeInput + (!string.IsNullOrEmpty(settings.OnChange) ? settings.OnChange : "")); attributes.Add("type", "file"); if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } settings.CssClass = "u-full-width " + settings.CssClass; var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id">@settings.Label</label> } @if (!string.IsNullOrEmpty(settings.HelpText)) { <small class="form__help-text">@settings.HelpText</small> } <div class="form__field-combi file-input u-no-margin dw-mod"> <input @ComponentMethods.AddAttributes(resultAttributes) class="file-input__real-input" data-no-files-text="@settings.NoFilesChosenText" data-many-files-text="@Translate("files")" /> <label for="@settings.Id" class="file-input__btn btn--secondary btn dw-mod">@settings.ChooseFileText</label> <label for="@settings.Id" class="@settings.CssClass file-input__fake-input js-fake-input dw-mod">@settings.NoFilesChosenText</label> @if (settings.UploadButton != null) { settings.UploadButton.CssClass += " btn--condensed u-no-margin"; @Render(settings.UploadButton) } </div> @Render(new NotificationMessage { Message = settings.ErrorMessage }) </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Core @using System.Linq @* Component *@ @helper RenderDateTimeField(DateTimeField settings) { if (string.IsNullOrEmpty(settings.Id)) { settings.Id = Guid.NewGuid().ToString("N"); } var textField = new TextField { Name = settings.Name, Id = settings.Id, Label = settings.Label, HelpText = settings.HelpText, Value = settings.Value, Disabled = settings.Disabled, Required = settings.Required, ErrorMessage = settings.ErrorMessage, CssClass = settings.CssClass, WrapperCssClass = settings.WrapperCssClass, OnChange = settings.OnChange, OnClick = settings.OnClick, ExtraAttributes = settings.ExtraAttributes, // Placeholder = settings.Placeholder }; @Render(textField) List<string> jsAttributes = new List<string>(); jsAttributes.Add("mode: '" + Enum.GetName(typeof(DateTimeFieldMode), settings.Mode).ToLower() + "'"); if (!string.IsNullOrEmpty(settings.DateFormat)) { jsAttributes.Add("dateFormat: '" + settings.DateFormat + "'"); } if (!string.IsNullOrEmpty(settings.MinDate)) { jsAttributes.Add("minDate: '" + settings.MinDate + "'"); } if (!string.IsNullOrEmpty(settings.MaxDate)) { jsAttributes.Add("maxDate: '" + settings.MaxDate + "'"); } if (settings.IsInline) { jsAttributes.Add("inline: " + Converter.ToString(settings.IsInline).ToLower()); } if (settings.EnableTime) { jsAttributes.Add("enableTime: " + Converter.ToString(settings.EnableTime).ToLower()); } if (settings.EnableWeekNumbers) { jsAttributes.Add("weekNumbers: " + Converter.ToString(settings.EnableWeekNumbers).ToLower()); } jsAttributes.AddRange(settings.GetFlatPickrOptions().Select(x => x.Key + ": " + x.Value)); <script> document.addEventListener("DOMContentLoaded", function () { flatpickr("#@textField.Id", { @string.Join(",", jsAttributes) }); }); </script> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderTextField(TextField settings) { var attributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) { settings.Id = Guid.NewGuid().ToString("N"); } /*base settings*/ if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } if (settings.Disabled) { attributes.Add("disabled", "true"); } if (settings.Required) { attributes.Add("required", "true"); } if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } /*end*/ if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } if (settings.ReadOnly) { attributes.Add("readonly", "true"); } if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } attributes.Add("type", Enum.GetName(typeof(TextFieldType), settings.Type).ToLower()); if (settings.Type == TextFieldType.Password) { attributes.Add("autocomplete", "off"); }; if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } settings.CssClass = "u-full-width " + settings.CssClass; var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); string noMargin = "u-no-margin"; if (!settings.ReadOnly) { noMargin = ""; } <div class="form__field-group u-full-width @noMargin @settings.WrapperCssClass dw-mod"> @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id">@settings.Label</label> } @if (!string.IsNullOrEmpty(settings.HelpText)) { <small class="form__help-text">@settings.HelpText</small> } @if (settings.ActionButton != null) { settings.ActionButton.CssClass += " btn--condensed u-no-margin"; <div class="form__field-combi u-no-margin dw-mod"> <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> @Render(settings.ActionButton) </div> } else { <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> } @Render(new NotificationMessage { Message = settings.ErrorMessage }) </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderNumberField(NumberField settings) { var attributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) { settings.Id = Guid.NewGuid().ToString("N"); } /*base settings*/ if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } if (settings.Disabled) { attributes.Add("disabled", "true"); } if (settings.Required) { attributes.Add("required", "true"); } if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } /*end*/ if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } if (settings.ReadOnly) { attributes.Add("readonly", "true"); } if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } if (settings.Min != null) { attributes.Add("min", settings.Min.ToString()); } if (settings.Step != 0) { attributes.Add("step", settings.Step.ToString()); } if (settings.Value != null && !string.IsNullOrEmpty(settings.Value.ToString())) { attributes.Add("value", settings.Value.ToString()); } attributes.Add("type", "number"); var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id">@settings.Label</label> } @if (!string.IsNullOrEmpty(settings.HelpText)) { <small class="form__help-text">@settings.HelpText</small> } @if (settings.ActionButton != null) { settings.ActionButton.CssClass += " btn--condensed u-no-margin"; <div class="form__field-combi u-no-margin dw-mod"> <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> @Render(settings.ActionButton) </div> } else { <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> } @Render(new NotificationMessage { Message = settings.ErrorMessage }) </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderTextareaField(TextareaField settings) { Dictionary<string, string> attributes = new Dictionary<string, string>(); string id = settings.Id; if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(id)) { id = Guid.NewGuid().ToString("N"); } if (!string.IsNullOrEmpty(id)) { attributes.Add("id", id); } if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } if (settings.Disabled) { attributes.Add("disabled", "true"); } if (settings.Required) { attributes.Add("required", "true"); } if (settings.ReadOnly) { attributes.Add("readonly", "true"); } if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } if (settings.Rows != 0) { attributes.Add("rows", settings.Rows.ToString()); } attributes.Add("name", settings.Name); <div class="form__field-group @settings.WrapperCssClass dw-mod"> @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@id">@settings.Label</label> } @if (!string.IsNullOrEmpty(settings.HelpText)) { <small class="form__help-text">@settings.HelpText</small> } <textarea class="u-full-width @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Value</textarea> @Render(new NotificationMessage { Message = settings.ErrorMessage }) </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderHiddenField(HiddenField settings) { var attributes = new Dictionary<string, string>(); attributes.Add("type", "hidden"); if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } <input @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)/> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderCheckboxField(CheckboxField settings) { var attributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) { settings.Id = Guid.NewGuid().ToString("N"); } /*base settings*/ if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } if (settings.Disabled) { attributes.Add("disabled", "true"); } if (settings.Required) { attributes.Add("required", "true"); } if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } /*end*/ attributes.Add("type", "checkbox"); if (settings.Checked) { attributes.Add("checked", "true"); } settings.CssClass = "form__control " + settings.CssClass; if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); <div class="form__field-group @settings.WrapperCssClass dw-mod"> <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="dw-mod">@settings.Label</label> } @if (!string.IsNullOrEmpty(settings.HelpText)) { <small class="form__help-text">@settings.HelpText</small> } @Render(new NotificationMessage { Message = settings.ErrorMessage }) </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderCheckboxListField(CheckboxListField settings) { <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> @if (!string.IsNullOrEmpty(settings.Label)) { <label>@settings.Label</label> } @if (!string.IsNullOrEmpty(settings.HelpText)) { <small class="form__help-text">@settings.HelpText</small> } @foreach (var item in settings.Options) { if (settings.Required) { item.Required = true; } if (settings.Disabled) { item.Disabled = true; } if (!string.IsNullOrEmpty(settings.Name)) { item.Name = settings.Name; } if (!string.IsNullOrEmpty(settings.CssClass)) { item.CssClass += settings.CssClass; } /* value is not supported */ if (!string.IsNullOrEmpty(settings.OnClick)) { item.OnClick += settings.OnClick; } if (!string.IsNullOrEmpty(settings.OnChange)) { item.OnChange += settings.OnChange; } @Render(item) } @Render(new NotificationMessage { Message = settings.ErrorMessage }) </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderSelectField(SelectField settings) { if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) { settings.Id = Guid.NewGuid().ToString("N"); } <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id">@settings.Label</label> } @if (!string.IsNullOrEmpty(settings.HelpText)) { <small class="form__help-text">@settings.HelpText</small> } @if (settings.ActionButton != null) { settings.ActionButton.CssClass += " btn--condensed u-no-margin"; <div class="form__field-combi u-no-margin dw-mod"> @RenderSelectBase(settings) @Render(settings.ActionButton) </div> } else { @RenderSelectBase(settings) } @Render(new NotificationMessage { Message = settings.ErrorMessage }) </div> } @helper RenderSelectBase(SelectField settings) { var attributes = new Dictionary<string, string>(); /*base settings*/ if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } if (settings.Disabled) { attributes.Add("disabled", "true"); } if (settings.Required) { attributes.Add("required", "true"); } if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } /*end*/ var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); <select @ComponentMethods.AddAttributes(resultAttributes) class="u-full-width @settings.CssClass dw-mod"> @if (settings.Default != null) { @Render(settings.Default) } @foreach (var item in settings.Options) { if (!string.IsNullOrEmpty(settings.Value)) { item.Checked = item.Value == settings.Value; } @Render(item) } </select> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderRadioButtonField(RadioButtonField settings) { var attributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) { settings.Id = Guid.NewGuid().ToString("N"); } /*base settings*/ if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } if (settings.Disabled) { attributes.Add("disabled", "true"); } if (settings.Required) { attributes.Add("required", "true"); } if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } /*end*/ attributes.Add("type", "radio"); if (settings.Checked) { attributes.Add("checked", "true"); } settings.CssClass = "form__control " + settings.CssClass; if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); <div class="form__field-group @settings.WrapperCssClass dw-mod"> <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="dw-mod">@settings.Label</label> } @if (!string.IsNullOrEmpty(settings.HelpText)) { <small class="form__help-text">@settings.HelpText</small> } @Render(new NotificationMessage { Message = settings.ErrorMessage }) </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderRadioButtonListField(RadioButtonListField settings) { <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> @if (!string.IsNullOrEmpty(settings.Label)) { <label>@settings.Label</label> } @if (!string.IsNullOrEmpty(settings.HelpText)) { <small class="form__help-text">@settings.HelpText</small> } @foreach (var item in settings.Options) { if (settings.Required) { item.Required = true; } if (settings.Disabled) { item.Disabled = true; } if (!string.IsNullOrEmpty(settings.Name)) { item.Name = settings.Name; } if (!string.IsNullOrEmpty(settings.Value) && settings.Value == item.Value) { item.Checked = true; } if (!string.IsNullOrEmpty(settings.OnClick)) { item.OnClick += settings.OnClick; } if (!string.IsNullOrEmpty(settings.OnChange)) { item.OnChange += settings.OnChange; } if (!string.IsNullOrEmpty(settings.CssClass)) { item.CssClass += settings.CssClass; } @Render(item) } @Render(new NotificationMessage { Message = settings.ErrorMessage }) </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderNotificationMessage(NotificationMessage settings) { if (!string.IsNullOrEmpty(settings.Message)) { var attributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } string messageTypeClass = Enum.GetName(typeof(NotificationMessageType), settings.MessageType).ToLower(); <div class="field-@messageTypeClass @settings.CssClass u-full-width dw-mod" @ComponentMethods.AddAttributes(attributes)>@settings.Message</div> } } @using Dynamicweb.Rapido.Blocks.Components.General @* Component *@ @helper RenderHandlebarsRoot(HandlebarsRoot settings) { string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : ""; <div class="@settings.CssClass dw-mod js-handlebars-root" id="@settings.Id" data-template="@settings.ScriptTemplate" data-json-feed="@settings.FeedUrl" data-init-onload="@settings.InitOnLoad.ToString()" data-preloader="@settings.Preloader" @preRender> @if (settings.SubBlocks != null) { @RenderBlockList(settings.SubBlocks) } </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @using System.Text.RegularExpressions @* Component *@ @helper RenderSticker(Sticker settings) { if (!String.IsNullOrEmpty(settings.Title)) { string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : ""; string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : ""; Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) { string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : ""; styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : ""; optionalAttributes.Add("style", styleTag); } <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div> } } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderStickersCollection(StickersCollection settings) { if (settings.Stickers.Count > 0) { string position = "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower(); <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> @foreach (Sticker sticker in settings.Stickers) { @Render(sticker) } </div> } } @using Dynamicweb.Rapido.Blocks.Components.General @* Component *@ @helper RenderForm(Form settings) { if (settings != null) { Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(settings.Action)) { optionalAttributes.Add("action", settings.Action); }; if (!string.IsNullOrEmpty(settings.Name)) { optionalAttributes.Add("name", settings.Name); }; if (!string.IsNullOrEmpty(settings.OnSubmit)) { optionalAttributes.Add("onsubmit", settings.OnSubmit); }; var enctypes = new Dictionary<string, string> { { "multipart", "multipart/form-data" }, { "text", "text/plain" }, { "application", "application/x-www-form-urlencoded" } }; if (settings.Enctype != FormEnctype.none) { optionalAttributes.Add("enctype", enctypes[Enum.GetName(typeof(FormEnctype), settings.Enctype).ToLower()]); }; optionalAttributes.Add("method", settings.Method.ToString()); if (!string.IsNullOrEmpty(settings.FormStartMarkup)) { @settings.FormStartMarkup } else { @:<form class="@settings.CssClass u-no-margin dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)> } foreach (var field in settings.GetFields()) { @Render(field) } @:</form> } } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderText(Text settings) { @settings.Content } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderContentModule(ContentModule settings) { if (!string.IsNullOrEmpty(settings.Content)) { @settings.Content } } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderModal(Modal settings) { if (settings != null) { string modalId = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); string onchange = !string.IsNullOrEmpty(settings.OnClose) ? "onchange=\"if(!this.checked){" + settings.OnClose + "}\"" : ""; <input type="checkbox" id="@(modalId)ModalTrigger" class="modal-trigger" @onchange /> <div class="modal-container"> @if (!settings.DisableDarkOverlay) { <label for="@(modalId)ModalTrigger" id="@(modalId)ModalOverlay" class="modal-overlay"></label> } <div class="modal modal--@settings.Width.ToString().ToLower() modal-height--@settings.Height.ToString().ToLower()" id="@(modalId)Modal"> @if (settings.Heading != null) { if (!string.IsNullOrEmpty(settings.Heading.Title)) { <div class="modal__header"> @Render(settings.Heading) </div> } } <div class="modal__body @(settings.Width.ToString().ToLower() == "full" ? "modal__body--full" : "")"> @if (!string.IsNullOrEmpty(settings.BodyText)) { @settings.BodyText } @if (settings.BodyTemplate != null) { @settings.BodyTemplate } @{ var actions = settings.GetActions(); } </div> @if (actions.Length > 0) { <div class="modal__footer"> @foreach (var action in actions) { action.CssClass += " u-no-margin"; @Render(action) } </div> } <label class="modal__close-btn" for="@(modalId)ModalTrigger"></label> </div> </div> } } @using Dynamicweb.Rapido.Blocks.Components.General @* Component *@ @helper RenderMediaListItem(MediaListItem settings) { <div class="media-list-item @settings.CssClass dw-mod" @(!string.IsNullOrEmpty(settings.Id) ? "id=\"" + settings.Id + "\"" : "")> @if (!string.IsNullOrEmpty(settings.Label)) { if (!string.IsNullOrEmpty(settings.Link)) { @Render(new Link { Href = settings.Link, CssClass = "media-list-item__sticker dw-mod", ButtonLayout = ButtonLayout.None, Title = settings.Label, OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" }) } else if (!string.IsNullOrEmpty(settings.OnClick)) { <span class="media-list-item__sticker dw-mod" onclick="@(settings.OnClick)"> <span class="u-uppercase">@settings.Label</span> </span> } else { <span class="media-list-item__sticker media-list-item__sticker--no-link dw-mod"> <span class="u-uppercase">@settings.Label</span> </span> } } <div class="media-list-item__wrap"> <div class="media-list-item__info dw-mod"> <div class="media-list-item__header dw-mod"> @if (!string.IsNullOrEmpty(settings.Title)) { if (!string.IsNullOrEmpty(settings.Link)) { @Render(new Link { Href = settings.Link, CssClass = "media-list-item__name dw-mod", ButtonLayout = ButtonLayout.None, Title = settings.Title, OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" }) } else if (!string.IsNullOrEmpty(settings.OnClick)) { <span class="media-list-item__name dw-mod" onclick="@(settings.OnClick)">@settings.Title</span> } else { <span class="media-list-item__name media-list-item__name--no-link dw-mod">@settings.Title</span> } } @if (!string.IsNullOrEmpty(settings.Status)) { <div class="media-list-item__state dw-mod">@settings.Status</div> } </div> @{ settings.InfoTable.CssClass += " media-list-item__parameters-table"; } @Render(settings.InfoTable) </div> <div class="media-list-item__actions dw-mod"> <div class="media-list-item__actions-list dw-mod"> @{ var actions = settings.GetActions(); foreach (ButtonBase action in actions) { action.ButtonLayout = ButtonLayout.None; action.CssClass += " media-list-item__action link"; @Render(action) } } </div> @if (settings.SelectButton != null && !string.IsNullOrEmpty(settings.SelectButton.Title)) { settings.SelectButton.CssClass += " u-no-margin"; <div class="media-list-item__action-button"> @Render(settings.SelectButton) </div> } </div> </div> </div> } @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @helper RenderTable(Table settings) { Dictionary<string, string> attributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } var enumToClasses = new Dictionary<TableDesign, string> { { TableDesign.Clean, "table--clean" }, { TableDesign.Bordered, "table--bordered" }, { TableDesign.Striped, "table--striped" }, { TableDesign.Hover, "table--hover" }, { TableDesign.Compact, "table--compact" }, { TableDesign.Condensed, "table--condensed" }, { TableDesign.NoTopBorder, "table--no-top-border" } }; string tableDesignClass = ""; if (settings.Design != TableDesign.None) { tableDesignClass = enumToClasses[settings.Design]; } if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableDesign.None) { attributes.Add("class", "table " + tableDesignClass + " " + settings.CssClass + " dw-mod"); } var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); <table @ComponentMethods.AddAttributes(resultAttributes)> @if (settings.Header != null) { <thead> @Render(settings.Header) </thead> } <tbody> @foreach (var row in settings.Rows) { @Render(row) } </tbody> @if (settings.Footer != null) { <tfoot> @Render(settings.Footer) </tfoot> } </table> } @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @helper RenderTableRow(TableRow settings) { Dictionary<string, string> attributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } var enumToClasses = new Dictionary<TableRowDesign, string> { { TableRowDesign.NoBorder, "table__row--no-border" }, { TableRowDesign.Border, "table__row--border" }, { TableRowDesign.TopBorder, "table__row--top-line" }, { TableRowDesign.BottomBorder, "table__row--bottom-line" }, { TableRowDesign.Solid, "table__row--solid" } }; string tableRowDesignClass = ""; if (settings.Design != TableRowDesign.None) { tableRowDesignClass = enumToClasses[settings.Design]; } if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableRowDesign.None) { attributes.Add("class", "table__row " + tableRowDesignClass + " " + settings.CssClass + " dw-mod"); } var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); <tr @ComponentMethods.AddAttributes(resultAttributes)> @foreach (var cell in settings.Cells) { if (settings.IsHeaderRow) { cell.IsHeader = true; } @Render(cell) } </tr> } @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Core @helper RenderTableCell(TableCell settings) { Dictionary<string, string> attributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } if (settings.Colspan != 0) { attributes.Add("colspan", Converter.ToString(settings.Colspan)); } if (settings.Rowspan != 0) { attributes.Add("rowspan", Converter.ToString(settings.Rowspan)); } if (!string.IsNullOrEmpty(settings.CssClass)) { attributes.Add("class", settings.CssClass + " dw-mod"); } var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); string tagName = settings.IsHeader ? "th" : "td"; @("<" + tagName + " " + ComponentMethods.AddAttributes(resultAttributes) + ">") @settings.Content @("</" + tagName + ">"); } @using System.Linq @using Dynamicweb.Rapido.Blocks.Components.General @* Component *@ @helper RenderPagination(Dynamicweb.Rapido.Blocks.Components.General.Pagination settings) { var pageNumberQueryStringName = Dynamicweb.Rapido.Services.Pagination.GetPageNumberQueryStringName(settings); // Get the proper 'page number' query string parameter var queryParameters = Dynamicweb.Rapido.Services.Url.GetQueryParameters(pageNumberQueryStringName); // Get the NameValueCollection from the querystring if (settings.NumberOfPages > 1) { string url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/Default.aspx"; string ariaLabel = !string.IsNullOrWhiteSpace(settings.AriaLabel) ? settings.AriaLabel : Translate("Page navigation"); Dictionary<string, int> startAndEndPageNumber = Dynamicweb.Rapido.Services.Pagination.GetStartAndEndPageNumber(settings); <div class="pager u-margin-top dw-mod @settings.CssClass" aria-label="@ariaLabel"> @if (settings.ShowPagingInfo) { <div class="pager__info dw-mod"> @Translate("Page") @settings.CurrentPageNumber @Translate("of") @settings.NumberOfPages </div> } <ul class="pager__list dw-mod"> @if (!string.IsNullOrWhiteSpace(settings.FirstPageUrl) && settings.ShowFirstAndLastControls) { @Render(new PaginationItem { Link = settings.FirstPageUrl, Icon = settings.FirstIcon }) } @if (!string.IsNullOrWhiteSpace(settings.PreviousPageUrl) && settings.ShowNextAndPrevControls) { @Render(new PaginationItem { Link = settings.PreviousPageUrl, Icon = settings.PrevIcon }) } @if (settings.GetPages().Any()) { foreach (var page in settings.GetPages()) { @Render(page) } } else { for (var page = startAndEndPageNumber["StartPage"]; page <= startAndEndPageNumber["EndPage"]; page++) { queryParameters = Dynamicweb.Rapido.Services.Url.UpdateQueryStringParameter(queryParameters, pageNumberQueryStringName, page.ToString()); @Render(new PaginationItem { Label = page.ToString(), Link = Dynamicweb.Rapido.Services.Url.BuildUri(url, queryParameters).PathAndQuery, IsActive = (settings.CurrentPageNumber == page) }); } } @if (!string.IsNullOrWhiteSpace(settings.NextPageUrl) && settings.ShowNextAndPrevControls) { @Render(new PaginationItem { Link = settings.NextPageUrl, Icon = settings.NextIcon }) } @if (!string.IsNullOrWhiteSpace(settings.LastPageUrl) && settings.ShowFirstAndLastControls) { @Render(new PaginationItem { Link = settings.LastPageUrl, Icon = settings.LastIcon }) } </ul> </div> } } @helper RenderPaginationItem(PaginationItem settings) { if (settings.Icon == null) { settings.Icon = new Icon(); } settings.Icon.Label = settings.Label; <li class="pager__btn dw-mod"> @if (settings.IsActive) { <span class="pager__num pager__num--current dw-mod"> @Render(settings.Icon) </span> } else { <a href="@settings.Link" class="pager__num dw-mod"> @Render(settings.Icon) </a> } </li> } @using Dynamicweb.Rapido.Blocks.Components.General 134 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 135 136 137 @using System.Linq 138 @using Dna.Rizzo.Components 139 @using Dynamicweb.Core 140 @using Dynamicweb.Rapido.Blocks.Components.General 141 142 @helper RenderMonthYearField(DateTimeField settings) 143 { 144 if (string.IsNullOrEmpty(settings.Id)) 145 { 146 settings.Id = Guid.NewGuid().ToString("N"); 147 } 148 149 var textField = new TextField { 150 Name = settings.Name, 151 Id = settings.Id, 152 Label = settings.Label, 153 HelpText = settings.HelpText, 154 Value = settings.Value, 155 Disabled = settings.Disabled, 156 Required = settings.Required, 157 ErrorMessage = settings.ErrorMessage, 158 CssClass = settings.CssClass, 159 WrapperCssClass = settings.WrapperCssClass, 160 OnChange = settings.OnChange, 161 OnClick = settings.OnClick, 162 ExtraAttributes = settings.ExtraAttributes, 163 // 164 Placeholder = settings.Placeholder 165 }; 166 167 @Render(textField) 168 169 List<string> jsAttributes = new List<string>(); 170 171 jsAttributes.Add("mode: '" + Enum.GetName(typeof(DateTimeFieldMode), settings.Mode).ToLower() + "'"); 172 173 if (!string.IsNullOrEmpty(settings.DateFormat)) 174 { 175 jsAttributes.Add("dateFormat: '" + settings.DateFormat + "'"); 176 } 177 if (!string.IsNullOrEmpty(settings.MinDate)) 178 { 179 jsAttributes.Add("minDate: '" + settings.MinDate + "'"); 180 } 181 if (!string.IsNullOrEmpty(settings.MaxDate)) 182 { 183 jsAttributes.Add("maxDate: '" + settings.MaxDate + "'"); 184 } 185 if (settings.IsInline) 186 { 187 jsAttributes.Add("inline: " + Converter.ToString(settings.IsInline).ToLower()); 188 } 189 if (settings.EnableTime) 190 { 191 jsAttributes.Add("enableTime: " + Converter.ToString(settings.EnableTime).ToLower()); 192 } 193 if (settings.EnableWeekNumbers) 194 { 195 jsAttributes.Add("weekNumbers: " + Converter.ToString(settings.EnableWeekNumbers).ToLower()); 196 } 197 jsAttributes.Add("plugins: " + "[new monthSelectPlugin({shorthand: true, dateFormat: 'F Y', altFormat: 'F Y'})]"); 198 199 jsAttributes.AddRange(settings.GetFlatPickrOptions().Select(x => x.Key + ": " + x.Value)); 200 201 <script> 202 document.addEventListener("DOMContentLoaded", function () { 203 flatpickr("#@textField.Id", { 204 @string.Join(",", jsAttributes) 205 }); 206 }); 207 </script> 208 } 209 210 @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 u-no-padding 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"> @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-3 image-hover--zoom dw-mod"> <a href="{{link}}" class="u-full-height u-color-light--bg"> {{#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 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"> <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 u-position-relative dw-mod"> @if (settings.Stickers != null) { if (settings.Stickers.Position != StickersListPosition.Custom) { @Render(settings.Stickers); } } @Render(settings.Image) </div> } </div> @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) { <div class="card u-color-light--bg 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"> <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> } } 211 212 213 @* Include the Blocks for the page *@ 214 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); Block tagManager = new Block() { Id = "TagManager", SortId = 1, Template = RenderGoogleTagManager() }; Block facebookPixel = new Block() { Id = "FacebookPixel", SortId = 2, Template = RenderFacebookPixel() }; topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManager); topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel); } @helper RenderGoogleTagManager() { string GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID"); if (!string.IsNullOrWhiteSpace(GoogleTagManagerID)) { <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> <!-- 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> } } 215 @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.Xs, 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") && 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" }; 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(new TextField { Id = "LoginPassword", Name = "password", Type = TextFieldType.Password, Label = Translate("Password"), CssClass = "u-full-width", Required = true }); 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 Link { Href = "/default.aspx?ID=" + createAccountPageId, Title = Translate("Create account?"), ButtonLayout = ButtonLayout.None, CssClass = "u-block u-padding-bottom" }); } if (!hideForgotPasswordLink) { form.Add(new Link { Href = forgotPasswordPageLink, Title = Translate("Forgot your password?"), ButtonLayout = ButtonLayout.None, CssClass = "u-block u-padding-bottom" }); } @Render(form) if (showModalOnStart) { <script> document.getElementById("SignInModalTrigger").checked = true; </script> } } 216 217 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 218 { 219 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @using Dynamicweb.Rapido.Services @functions { BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); } @{ var mobileTopLayout = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetString("Design")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; bool mobileHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); bool mobileHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart") || !Dynamicweb.Rapido.Services.User.IsBuyingAllowed(); Block mobileHeader = new Block() { Id = "MobileTop", SortId = 10, Template = RenderMobileTop(), SkipRenderBlocksList = true }; mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader); Block mobileHeaderNavigation = new Block() { Id = "MobileHeaderNavigation", SortId = 10, Template = RenderMobileHeaderNavigation(), SkipRenderBlocksList = true, BlocksList = new List<Block> { new Block { Id = "MobileHeaderNavigationTrigger", SortId = 10, Template = RenderMobileHeaderNavigationTrigger() } } }; mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation); Block mobileHeaderLogo = new Block() { Id = "MobileHeaderLogo", SortId = 20, Template = RenderMobileHeaderLogo(), SkipRenderBlocksList = true }; mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo); Block mobileHeaderActions = new Block() { Id = "MobileHeaderActions", SortId = 30, Template = RenderMobileTopActions(), SkipRenderBlocksList = true }; mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions); if (!mobileHideSearch) { Block mobileHeaderSearch = new Block { Id = "MobileHeaderSearch", SortId = 10, Template = RenderMobileTopSearch() }; mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch); } Block mobileHeaderMiniCart; if (!mobileHideCart) { mobileHeaderMiniCart = new Block { Id = "MobileHeaderMiniCart", SortId = 20, Template = RenderMobileTopMiniCart() }; Block miniCartCounterScriptTemplate = new Block { Id = "MiniCartCounterScriptTemplate", Template = RenderMobileMiniCartCounterContent() }; BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); } else { mobileHeaderMiniCart = new Block { Id = "MobileHeaderMiniCart", SortId = 20 }; } if (!mobileHideSearch) { Block mobileHeaderSearchBar = new Block() { Id = "MobileHeaderSearchBar", SortId = 30, Template = RenderMobileTopSearchBar() }; mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar); } switch (mobileTopLayout) { case "nav-left": mobileHeaderNavigation.SortId = 10; mobileHeaderLogo.SortId = 20; mobileHeaderActions.SortId = 30; mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); break; case "nav-right": mobileHeaderLogo.SortId = 10; mobileHeaderActions.SortId = 20; mobileHeaderNavigation.SortId = 30; mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); break; case "nav-search-left": mobileHeaderNavigation.SortId = 10; mobileHeaderLogo.SortId = 20; mobileHeaderActions.SortId = 30; mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); break; case "search-left": mobileHeaderActions.SortId = 10; mobileHeaderLogo.SortId = 20; mobileHeaderNavigation.SortId = 30; mobileHeaderMiniCart.SortId = 0; mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); break; } if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) { BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block { Id = "CartInitialization", Template = RenderMobileCartInitialization() }); } } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb.Rapido.Blocks @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb.Rapido.Blocks @{ BlocksPage customMobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); } @helper RenderMobileCartInitialization() { int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); <script> window.cartId = "@miniCartFeedPageId"; </script> } @helper RenderMobileTop() { List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList(); <nav class="main-navigation-mobile dw-mod"> <div class="center-container top-container__center-container dw-mod"> <div class="grid grid--align-center"> @RenderBlockList(subBlocks) </div> </div> </nav> } @helper RenderMobileHeaderNavigation() { List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList(); <div class="grid__col-auto-width"> <ul class="menu dw-mod"> @RenderBlockList(subBlocks) </ul> </div> } @helper RenderMobileHeaderNavigationTrigger() { <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label> </li> } @helper RenderMobileHeaderLogo() { List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList(); var mobileTopLayout = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetString("Design")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : ""; string firstPageId = Model.Area.FirstActivePage.ID.ToString(); string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName"); string mobileLogo = "/Files/Images/logo-dynamicweb.png"; if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null) { mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded; } if (Path.GetExtension(mobileLogo).ToLower() != ".svg") { mobileLogo = "/Admin/Public/GetImage.ashx?height=40&amp;width=100&amp;crop=5&amp;Compression=75&amp;image=" + mobileLogo; } else { mobileLogo = HttpUtility.UrlDecode(mobileLogo); } <div class="grid__col-auto grid__col--bleed"> <div class="grid__cell @centeredLogo"> <a href="/Default.aspx?ID=@firstPageId" class="logo logo--mobile u-inline-block dw-mod"> <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" /> </a> </div> @RenderBlockList(subBlocks) </div> } @helper RenderMobileTopActions() { List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList(); <div class="grid__col-auto-width"> <ul class="menu dw-mod"> @RenderBlockList(subBlocks) </ul> </div> } @helper RenderMobileTopSearch() { <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> </label> </li> } @helper RenderMobileTopMiniCart() { int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); int cartPageId = GetPageIdByNavigationTag("CartPage"); double cartProductsCount = Model.Cart.TotalProductsCount; <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper"> <div class="mini-cart dw-mod"> <a href="/Default.aspx?ID=@cartPageId&Purge=True" id="miniCartCounterWrap" class="menu__link menu__link--icon menu__link--mobile dw-mod js-mini-cart-button"> <div class="u-inline u-position-relative"> <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> <div class="mini-cart__counter dw-mod"> <div class="js-handlebars-root js-mini-cart-counter" id="cartCounter" data-template="MiniCartCounterContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=Counter" data-init-onload="false" data-preloader="false"> <div class="js-mini-cart-counter-content" data-count="@cartProductsCount"> @cartProductsCount </div> </div> </div> </div> </a> </div> </li> } @helper RenderMobileTopSearchBar() { string searchFeedId = ""; string searchSecondFeedId = ""; int groupsFeedId; int productsPageId = GetPageIdByNavigationTag("ProductsPage"); string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; string resultPageLink; string searchPlaceholder; string searchType = "product-search"; string searchTemplate; string searchContentTemplate = ""; string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; bool showGroups = true; if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") { searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; resultPageLink = contentSearchPageLink; searchPlaceholder = Translate("Search page"); groupsFeedId = 0; searchType = "content-search"; searchTemplate = "SearchPagesTemplate"; showGroups = false; } else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") { searchFeedId = productsPageId + "&feed=true"; searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; resultPageLink = Converter.ToString(productsPageId); searchPlaceholder = Translate("Search products or pages"); groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); searchType = "combined-search"; searchTemplate = "SearchProductsTemplateWrap"; searchContentTemplate = "SearchPagesTemplateWrap"; showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); } else { resultPageLink = Converter.ToString(productsPageId); searchFeedId = productsPageId + "&feed=true"; groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); searchPlaceholder = Translate("Search products"); searchTemplate = "SearchProductsTemplate"; searchType = "product-search"; showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); } <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" /> <div class="main-navigation-mobile typeahead-mobile dw-mod"> <div class="center-container top-container__center-container dw-mod"> <div class="grid"> <div class="grid__col-auto"> <div class="typeahead-mobile__search-field dw-mod js-typeahead" data-page-size="@(searchType == "combined-search" ? 4 : 8)" id="MobileProductSearch" data-search-feed-id="@searchFeedId" data-search-second-feed-id="@searchSecondFeedId" data-result-page-id="@resultPageLink" data-search-type="@searchType"> <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue"> @if (string.IsNullOrEmpty(searchSecondFeedId)) { <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="MobileProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></ul> } else { <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> <div class="js-handlebars-root js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="MobileProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></div> <div class="js-handlebars-root js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="MobileContentSearchBarContent" data-template="@searchContentTemplate" data-json-feed="/Default.aspx?ID=@searchSecondFeedId" data-init-onload="false"></div> </div> } <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button> </div> </div> <div class="grid__col-auto-width"> <ul class="menu dw-mod"> <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> <i class="fas fa-times fa-1_5x"></i> </label> </li> </ul> </div> </div> </div> </div> } @helper RenderMobileMiniCartCounterContent() { <script id="MiniCartCounterContent" type="text/x-template"> {{#.}} <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> {{numberofproducts}} </div> {{/.}} </script> } </text> 220 <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 ?? ""; userName += " " + (Model.CurrentUser.LastName ?? ""); userName += userName == "" && Model.CurrentUser.UserName != null ? Model.CurrentUser.UserName : ""; <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 = renderPagesInToolBar ? 1 : 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"><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> 221 } 222 else 223 { 224 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @functions { BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master"); } @{ Block masterTools = new Block() { Id = "MasterDesktopTools", SortId = 10, Template = RenderDesktopTools(), SkipRenderBlocksList = true, BlocksList = new List<Block> { new Block { Id = "MasterDesktopToolsText", SortId = 10, Template = RenderDesktopToolsText(), Design = new Design { Size = "auto", HidePadding = true, RenderType = RenderType.Column } }, new Block { Id = "MasterDesktopToolsNavigation", SortId = 20, Template = RenderDesktopToolsNavigation(), Design = new Design { Size = "auto-width", HidePadding = true, RenderType = RenderType.Column } } } }; headerBlocksPage.Add("MasterHeader", masterTools); Block masterDesktopExtra = new Block() { Id = "MasterDesktopExtra", SortId = 10, Template = RenderDesktopExtra(), SkipRenderBlocksList = true }; headerBlocksPage.Add("MasterHeader", masterDesktopExtra); Block masterDesktopNavigation = new Block() { Id = "MasterDesktopNavigation", SortId = 20, Template = RenderDesktopNavigation(), SkipRenderBlocksList = true }; headerBlocksPage.Add("MasterHeader", masterDesktopNavigation); } @* Include the Blocks for the page *@ @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ Block masterDesktopLogo = new Block { Id = "MasterDesktopLogo", SortId = 10, Template = RenderDesktopLogo(), Design = new Design { Size = "auto-width", HidePadding = true, RenderType = RenderType.Column, CssClass = "grid--align-self-center" } }; BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo); } @helper RenderDesktopLogo() { string firstPageId = Model.Area.FirstActivePage.ID.ToString(); string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : ""; string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png"; if (Path.GetExtension(logo).ToLower() != ".svg") { int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight"); logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40; logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&amp;crop=5&amp;Compression=75&amp;image=" + logo; } else { logo = HttpUtility.UrlDecode(logo); } <div class="logo @alignClass dw-mod"> <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block"> <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" /> </a> </div> } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @functions { bool isMegaMenu; } @{ isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false; Block masterDesktopMenu = new Block { Id = "MasterDesktopMenu", SortId = 10, Template = RenderDesktopMenu(), Design = new Design { Size = "auto", HidePadding = true, RenderType = RenderType.Column } }; if (isMegaMenu) { masterDesktopMenu.Design.CssClass = "u-reset-position"; } BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu); } @helper RenderDesktopMenu() { string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : ""; string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders"); int startLevel = renderPagesInToolBar ? 1 : 0; string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"); <div class="grid__cell u-flex @(isMegaMenu ? "u-reset-position" : "") @menuAlignment"> @if (!isMegaMenu) { @RenderNavigation(new { id = "topnavigation", cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", startLevel = startLevel, ecomStartLevel = startLevel + 1, endlevel = 5, expandmode = "all", template = "BaseMenuWithDropdown.xslt" }); } else { @RenderNavigation(new { id = "topnavigation", cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", startLevel = startLevel, ecomStartLevel = startLevel + 1, endlevel = 5, promotionImage = megamenuPromotionImage, promotionLink = promotionLink, expandmode = "all", showOnlyHeaders = showOnlyHeaders.ToString().ToLower(), template = "BaseMegaMenu.xslt" }); } </div> } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ Block masterDesktopActionsMenu = new Block { Id = "MasterDesktopActionsMenu", SortId = 10, Template = RenderDesktopActionsMenu(), Design = new Design { CssClass = "u-flex" }, SkipRenderBlocksList = true }; BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu); if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"))) { Block masterDesktopActionsHeaderButton = new Block { Id = "MasterDesktopActionsHeaderButton", SortId = 60, Template = RenderHeaderButton() }; masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton); } } @helper RenderDesktopActionsMenu() { List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList(); <ul class="menu u-flex dw-mod"> @RenderBlockList(subBlocks) </ul> } @helper RenderHeaderButton() { string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText"); string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"); string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : ""; <li class="menu__item menu__item--horizontal menu--clean dw-mod"> <a class="btn @headerButtonType dw-mod u-no-margin u-margin-top u-margin-left" href="@headerButtonLink">@headerButtonText</a> </li> } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Core; @using System.Text.RegularExpressions @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ Block masterDesktopActionsMenuLanguageSelector = new Block { Id = "MasterDesktopActionsMenuLanguageSelector", SortId = 40, Template = RenderLanguageSelector() }; BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector); } @helper RenderLanguageSelector() { string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; string languageViewType = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("LanguageSelector").SelectedValue) ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("LanguageSelector").SelectedValue.ToLower() : ""; if (Model.Languages.Count > 1) { <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod"> <div class="@menuLinkClass dw-mod" title="@Translate("Language")"> <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i> </div> <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell"> @foreach (var lang in Model.Languages) { string widthClass = "menu__item--fixed-width"; string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty); cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1); if (languageViewType == "flag-culture") { langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span> " + cultureName; } if (languageViewType == "flag") { langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span>"; widthClass = ""; } if (languageViewType == "name") { langInfo = lang.Name; } if (languageViewType == "culture") { langInfo = cultureName; widthClass = ""; } <div class="menu__item dw-mod @widthClass"> <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__link dw-mod">@langInfo</a> </div> } </div> </li> } } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.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 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 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 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"; 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" ? "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 (Model.CurrentUser.ID > 0) { if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) { @RenderSeparator() } @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"> @if (!string.IsNullOrEmpty(icon)){<i class="@icon u-margin-right"></i>}@text </a> </li> } @helper RenderSeparator() { <li class="list__seperator dw-mod"></li> } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); Block masterDesktopActionsMenuFavorites = new Block { Id = "MasterDesktopActionsMenuFavorites", SortId = 30, Template = RenderFavorites() }; if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0) { BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites); } } @helper RenderFavorites() { int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId; string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod" title="@Translate("Favorites")"> <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i> </a> </li> } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @using Dynamicweb.Rapido.Services @{ bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !hideCart) { Block masterDesktopActionsMenuMiniCart = new Block { Id = "MasterDesktopActionsMenuMiniCart", SortId = 50, 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 = RenderNoLayoutMiniCart(); 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", Template = RenderNoLayoutMiniCart() }); } } @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 RenderNoLayoutMiniCart() { int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); <script> window.cartId = "@miniCartFeedPageId"; </script> } @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" ? "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')"> <div class="u-inline u-position-relative" title="@Translate("Cart")"> <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" ? "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"> <div class="u-inline u-position-relative" title="@Translate("Cart")"> <i class="@cartIcon fa-1_5x"></i> @RenderMiniCartCounter() </div> </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 + ")"; } <div class="mini-cart__counter @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod"> <div class="js-handlebars-root js-mini-cart-counter" id="cartCounter" data-template="MiniCartCounterContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=Counter" data-init-onload="false" data-preloader="false"> <div class="js-mini-cart-counter-content" data-count="@Model.Cart.TotalProductsCount.ToString()"> @cartProductsCount @cartProductsTotalPrice </div> </div> </div> } @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"> {{#.}} <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> @if (showPriceInMiniCartCounter) { @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> } else { <text>{{numberofproducts}}</text> } </div> {{/.}} </script> } @helper RenderMiniCartDropdownLayout() { int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); <div class="mini-cart mini-cart-dropdown js-mini-cart grid__cell dw-mod" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="dropdown" data-cart-page-link="@cartPageLink"> <div class="mini-cart-dropdown__inner dw-mod"> <h3 class="u-ta-center dw-mod">@Translate("Shopping cart")</h3> <div class="mini-cart-dropdown__body u-flex dw-mod"> <div class="js-handlebars-root u-flex grid--direction-column u-full-width dw-mod" id="miniCartContent" data-template="MiniCartContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> </div> </div> </div> } @helper RenderMiniCartPanelLayout() { int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); <div class="mini-cart grid__cell dw-mod"> <input type="checkbox" id="miniCartTrigger" class="panel-trigger" /> <div class="panel panel--right panel--with-close-btn dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink"> <label for="miniCartTrigger" class="panel__close-btn" title="@Translate("Close panel")"><i class="fas fa-times"></i></label> <div class="panel__content u-full-width dw-mod"> <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3> <div class="panel__content-body panel__content-body--cart dw-mod"> <div class="js-handlebars-root u-flex grid--direction-column u-full-height dw-mod" id="miniCartContent" data-template="MiniCartContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> </div> </div> </div> </div> } @helper RenderMiniCartModalLayout() { int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); <div class="mini-cart grid__cell dw-mod"> <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" /> <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink"> <label for="miniCartTrigger" class="modal-overlay"></label> <div class="modal modal--md modal--top-right dw-mod"> <div class="modal__body u-flex grid--direction-column dw-mod"> <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3> <div class="js-handlebars-root u-flex grid--direction-column dw-mod" id="miniCartContent" data-template="MiniCartContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> </div> <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label> </div> </div> </div> } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart"); Block masterDesktopActionsMenuDownloadCart = new Block { Id = "MasterDesktopActionsMenuDownloadCart", SortId = 35, 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" ? "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="@downloadCartPageLink" class="@menuLinkClass dw-mod" title="@Translate("Download cart")"> <i class="fas fa-cart-arrow-down fa-1_5x"></i> </a> </li> } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @functions { public class SearchConfiguration { public string searchFeedId { get; set; } public string searchSecondFeedId { get; set; } public int groupsFeedId { get; set; } public string resultPageLink { get; set; } public string searchPlaceholder { get; set; } public string searchType { get; set; } public string searchTemplate { get; set; } public string searchContentTemplate { get; set; } public string searchValue { get; set; } public bool showGroups { get; set; } public SearchConfiguration() { searchFeedId = ""; searchSecondFeedId = ""; searchType = "product-search"; searchContentTemplate = ""; showGroups = true; } } } @{ Block masterSearchBar = new Block { Id = "MasterSearchBar", SortId = 40, Template = RenderSearch("bar"), Design = new Design { Size = "auto", HidePadding = true, RenderType = RenderType.Column } }; Block masterSearchAction = new Block { Id = "MasterDesktopActionsMenuSearch", SortId = 10, Template = RenderSearch() }; BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar); BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction); } @helper RenderSearch(string type = "mini-search") { string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage")); string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch"; SearchConfiguration searchConfiguration = null; switch (searchType) { case "contentSearch": searchConfiguration = new SearchConfiguration() { searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", resultPageLink = contentSearchPageLink, searchPlaceholder = Translate("Search page"), groupsFeedId = 0, searchType = "content-search", searchTemplate = "SearchPagesTemplate", showGroups = false }; break; case "combinedSearch": searchConfiguration = new SearchConfiguration() { searchFeedId = productsPageId + "&feed=true", searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", resultPageLink = Converter.ToString(productsPageId), searchPlaceholder = Translate("Search products or pages"), groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), searchType = "combined-search", searchTemplate = "SearchProductsTemplateWrap", searchContentTemplate = "SearchPagesTemplateWrap", showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") }; break; default: //productSearch searchConfiguration = new SearchConfiguration() { resultPageLink = Converter.ToString(productsPageId), searchFeedId = productsPageId + "&feed=true", groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), searchPlaceholder = Translate("Search products"), searchTemplate = "SearchProductsTemplate", searchType = "product-search", showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") }; break; } searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; if (type == "mini-search") { @RenderMiniSearch(searchConfiguration) } else { @RenderSearchBar(searchConfiguration) } } @helper RenderSearchBar(SearchConfiguration options) { bool isLiveProductInfoActive = Dynamicweb.Core.Converter.ToBoolean(Pageview.GlobalTags.GetTagByName("Global:LiveIntegration.IsLazyLoadingForProductInfoEnabled")?.Value ?? string.Empty); <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar" data-page-size="7" data-search-feed-id="@options.searchFeedId" data-search-second-feed-id="@options.searchSecondFeedId" data-result-page-id="@options.resultPageLink" data-groups-page-id="@options.groupsFeedId" data-search-type="@options.searchType" data-live-price="@(isLiveProductInfoActive.ToString().ToLowerInvariant())"> @if (options.showGroups) { <button type="button" class="btn btn--condensed u-color-light-gray--bg typeahead-group-btn dw-mod js-typeahead-groups-btn" data-group-id="all">@Translate("All")</button> <ul class="dropdown dropdown--absolute-position u-min-w220px js-handlebars-root js-typeahead-groups-content dw-mod" id="ProductSearchBarGroupsContent" data-template="SearchGroupsTemplate" data-json-feed="/Default.aspx?ID=@options.groupsFeedId&feedType=productGroups" data-init-onload="false" data-preloader="minimal"></ul> } <div class="typeahead-search-field"> <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue"> @if (string.IsNullOrEmpty(options.searchSecondFeedId)) { <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></ul> } else { <div class="dropdown dropdown--absolute-position dropdown--combined grid"> <div class="js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-init-onload="false"></div> <div class="js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="ContentSearchBarContent" data-template="@options.searchContentTemplate" data-init-onload="false"></div> </div> } </div> <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn" title="@Translate("Search")"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button> </div> } @helper RenderMiniSearch(SearchConfiguration options) { bool isLiveProductInfoActive = Dynamicweb.Core.Converter.ToBoolean(Pageview.GlobalTags.GetTagByName("Global:LiveIntegration.IsLazyLoadingForProductInfoEnabled")?.Value ?? string.Empty); <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="miniSearch"> <div class="menu__link menu__link--icon dw-mod" title="@Translate("Search")"> <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> </div> <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod"> <div class="typeahead js-typeahead" id="ProductSearchBar" data-page-size="7" data-search-feed-id="@options.searchFeedId" data-search-second-feed-id="@options.searchSecondFeedId" data-result-page-id="@options.resultPageLink" data-search-type="@options.searchType" data-live-price="@(isLiveProductInfoActive.ToString().ToLowerInvariant())"> <div class="typeahead-search-field"> <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue"> @if (string.IsNullOrEmpty(options.searchSecondFeedId)) { <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></ul> } else { <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> <div class="js-handlebars-root js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></div> <div class="js-handlebars-root js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="ContentSearchBarContent" data-template="@options.searchContentTemplate" data-json-feed="/Default.aspx?ID=@options.searchSecondFeedId" data-init-onload="false"></div> </div> } </div> </div> </div> </li> } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ string headerConfigurationTopLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; bool headerConfigurationHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master"); Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo"); headerConfigurationPage.RemoveBlock(configDesktopLogo); Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu"); headerConfigurationPage.RemoveBlock(configDesktopMenu); Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar"); headerConfigurationPage.RemoveBlock(configSearchBar); Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch"); headerConfigurationPage.RemoveBlock(configSearchAction); Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu"); headerConfigurationPage.RemoveBlock(configDesktopActionsMenu); Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra"); switch (headerConfigurationTopLayout) { case "condensed": //2 configDesktopLogo.Design.Size = "auto-width"; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); configDesktopMenu.SortId = 20; configDesktopMenu.Design.Size = "auto"; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); configDesktopActionsMenu.SortId = 30; configDesktopActionsMenu.Design.Size = "auto-width"; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); if (!headerConfigurationHideSearch) { configSearchBar.SortId = 40; configSearchBar.Design.Size = "12"; configDesktopExtra.SortId = 50; headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); } break; case "splitted": //3 configDesktopLogo.Design.Size = "auto"; headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); if (!headerConfigurationHideSearch) { configSearchBar.SortId = 20; configSearchBar.Design.Size = "auto"; headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); } headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); configDesktopActionsMenu.SortId = 20; configDesktopActionsMenu.Design.Size = "auto-width"; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); break; case "minimal": //4 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": //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 "two-lines": //6 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": //7 configDesktopLogo.Design.Size = "auto"; headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); configDesktopMenu.Design.Size = "auto-width"; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); configDesktopActionsMenu.SortId = 20; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); if (!headerConfigurationHideSearch) { headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); } break; case "normal": //1 default: headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); if (!headerConfigurationHideSearch) { configSearchBar.SortId = 20; headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); } configDesktopActionsMenu.SortId = 30; headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu); configDesktopActionsMenu.Design.Size = "auto-width"; headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); break; } } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using Dynamicweb.Rapido.Blocks @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using Dynamicweb.Rapido.Blocks @{ } @helper RenderDesktopTools() { List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList(); <div class="tools-navigation dw-mod"> <div class="center-container grid top-container__center-container dw-mod"> @RenderBlockList(subBlocks) </div> </div> } @helper RenderDesktopToolsText() { string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText"); if (!string.IsNullOrEmpty(toolsText)) { <div class="u-margin-top u-margin-bottom">@toolsText</div> } } @helper RenderDesktopToolsNavigation() { bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); if (renderPagesInToolBar) { @RenderNavigation(new { id = "topToolsNavigation", cssclass = "menu menu-tools dw-mod dwnavigation", template = "TopMenu.xslt" }) } } @helper RenderDesktopNavigation() { List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList(); string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : ""; <nav class="main-navigation dw-mod"> <div class="center-container top-container__center-container grid @alignClass dw-mod"> @RenderBlockList(subBlocks) </div> </nav> } @helper RenderDesktopExtra() { List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList(); if (subBlocks.Count > 0) { <div class="header header-top dw-mod"> <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod"> @RenderBlockList(subBlocks) </div> </div> } }</text> 225 } 226 227 @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 } }; Block impersonationContent = new Block { Id = "ImpersonationContent", SortId = 10 }; if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) { //Render stop impersonation view impersonationContent.Template = RenderStopImpersonationView(); } 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 impersonate"), 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 = 20, Template = RenderSearchResultTemplate() } ); if (impersonationLayout != "bar") { impersonationBar.BlocksList.Add( new Block { Id = "ImpersonationSearchScripts", SortId = 30, 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 u-padding--lg impersonation__container @(impersonationLayout != "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 = "<b>" + userName + "</b> " + Translate("is impersonating") + " <b>" + secondaryUserName + "</b>"; impersonationText = Dynamicweb.Security.UserManagement.User.ImpersonationMode == Dynamicweb.Security.UserManagement.UserImpersonation.Full ? "<b>" + secondaryUserName + "</b> " + Translate("is impersonating") + " <b>" + userName + "</b>" : impersonationText; if (impersonationLayout == "right-lower-box") { <div class="u-margin-bottom--lg u-ta-center"> @impersonationText </div> @RenderStopImpersonationForm() } else { <div class="grid grid--align-center grid--justify-space-between impersonation__stop-wrap"> <div class="u-margin-right--lg impersonation__stop-text"> <i class="fas fa-user-secret"></i> @impersonationText </div> @RenderStopImpersonationForm() </div> } } @helper RenderStopImpersonationForm() { <form method="post" class="u-no-margin"> @Render(new Button { ButtonType = ButtonType.Submit, ButtonLayout = ButtonLayout.None, Title = Translate("Stop impersonation"), Href = "/Default.aspx?ID=" + impersonationPageId, CssClass = "impersonation__button btn btn--impersonation", Name = "DwExtranetRemoveSecondaryUser" }) </form> } @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 impersonate"); 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 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> } 228 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 229 230 @using System 231 @using System.Web 232 @using System.Collections.Generic 233 @using Dynamicweb.Rapido.Blocks.Extensibility 234 @using Dynamicweb.Rapido.Blocks 235 236 @{ 237 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 238 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table"; 239 240 Block orderLines = new Block 241 { 242 Id = "MiniCartOrderLines", 243 SkipRenderBlocksList = true, 244 BlocksList = new List<Block> 245 { 246 new Block { 247 Id = "MiniCartOrderLinesList", 248 SortId = 20, 249 Template = RenderMiniCartOrderLinesList() 250 } 251 } 252 }; 253 254 Block orderlinesScriptTemplates = new Block 255 { 256 Id = "OrderlinesScriptTemplates" 257 }; 258 259 if (orderlinesView == "table") 260 { 261 orderLines.Template = RenderMiniCartOrderLinesTable(); 262 orderLines.BlocksList.Add( 263 new Block 264 { 265 Id = "MiniCartOrderlinesTableHeader", 266 SortId = 10, 267 Template = RenderMiniCartOrderLinesHeader() 268 } 269 ); 270 271 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates(); 272 } 273 else 274 { 275 orderLines.Template = RenderMiniCartOrderLinesBlocks(); 276 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates(); 277 } 278 279 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates); 280 281 Block miniCartScriptTemplates = new Block() 282 { 283 Id = "MasterMiniCartTemplates", 284 SortId = 1, 285 Template = RenderMiniCartScriptTemplates(), 286 SkipRenderBlocksList = true, 287 BlocksList = new List<Block> 288 { 289 orderLines, 290 new Block { 291 Id = "MiniCartFooter", 292 Template = RenderMiniCartFooter(), 293 SortId = 50, 294 SkipRenderBlocksList = true, 295 BlocksList = new List<Block> 296 { 297 new Block { 298 Id = "MiniCartSubTotal", 299 Template = RenderMiniCartSubTotal(), 300 SortId = 30 301 }, 302 new Block { 303 Id = "MiniCartFees", 304 Template = RenderMiniCartFees(), 305 SortId = 40 306 }, 307 new Block { 308 Id = "MiniCartPoints", 309 Template = RenderMiniCartPoints(), 310 SortId = 50 311 }, 312 new Block { 313 Id = "MiniCartTotal", 314 Template = RenderMiniCartTotal(), 315 SortId = 60 316 }, 317 new Block { 318 Id = "MiniCartDisclaimer", 319 Template = RenderMiniCartDisclaimer(), 320 SortId = 70 321 }, 322 new Block { 323 Id = "MiniCartActions", 324 Template = RenderMiniCartActions(), 325 SortId = 80 326 } 327 } 328 } 329 } 330 }; 331 332 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates); 333 } 334 335 @helper RenderMiniCartScriptsTableTemplates() 336 { 337 <script id="MiniCartOrderline" type="text/x-template"> 338 {{#unless isEmpty}} 339 <tr> 340 <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> 341 <td class="u-va-middle"> 342 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a> 343 {{#if variantname}} 344 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a> 345 {{/if}} 346 {{#if unitname}} 347 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div> 348 {{/if}} 349 </td> 350 <td class="u-ta-right u-va-middle">{{quantity}}</td> 351 <td class="u-ta-right u-va-middle"> 352 {{#if pointsTotal}} 353 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 354 {{else}} 355 {{totalprice}} 356 {{/if}} 357 </td> 358 </tr> 359 {{/unless}} 360 </script> 361 362 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 363 {{#unless isEmpty}} 364 <tr class="table__row--no-border"> 365 <td class="u-w60px">&nbsp;</td> 366 <td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td> 367 <td class="u-ta-right">&nbsp;</td> 368 <td class="u-ta-right">{{totalprice}}</td> 369 </tr> 370 {{/unless}} 371 </script> 372 } 373 374 @helper RenderMiniCartScriptsListTemplates() 375 { 376 int cartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 377 378 <script id="MiniCartOrderline" type="text/x-template"> 379 {{#unless isEmpty}} 380 <div class="mini-cart-orderline grid dw-mod"> 381 <div class="grid__col-4"> 382 <a href="{{link}}" class="{{hideimage}}"> 383 <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}}"> 384 </a> 385 </div> 386 <div class="grid__col-8"> 387 <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> 388 {{#if variantname}} 389 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div> 390 {{/if}} 391 {{#if unitname}} 392 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div> 393 {{/if}} 394 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div> 395 396 <div class="grid__cell-footer"> 397 <div class="grid__cell"> 398 <div class="u-pull--left mini-cart-orderline__price dw-mod"> 399 {{#if pointsTotal}} 400 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 401 {{else}} 402 {{totalprice}} 403 {{/if}} 404 </div> 405 <button type="button" title="@Translate("Remove orderline")" class="btn btn--clean btn--condensed u-pull--right mini-cart-orderline__remove-btn dw-mod" onclick="{{removeFromCartGoogleImpression}}; Cart.UpdateCart('miniCartContent', '/Default.aspx?ID=@cartFeedPageId', 'CartCmd=DelOrderLine&key={{orderLineId}}&redirect=false', true);">@Translate("Remove")</button> 406 </div> 407 </div> 408 </div> 409 </div> 410 {{/unless}} 411 </script> 412 413 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 414 {{#unless isEmpty}} 415 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod"> 416 <div class="grid__col-4"> 417 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div> 418 </div> 419 <div class="grid__col-8">{{totalprice}}</div> 420 </div> 421 {{/unless}} 422 </script> 423 } 424 425 @helper RenderMiniCartScriptTemplates() 426 { 427 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 428 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 429 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage")); 430 431 <script id="MiniCartContent" type="text/x-template"> 432 {{#.}} 433 {{#unless isEmpty}} 434 @RenderBlockList(subBlocks) 435 {{/unless}} 436 {{/.}} 437 </script> 438 } 439 440 @helper RenderMiniCartOrderLinesTable() 441 { 442 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 443 444 <div class="u-overflow-auto"> 445 <table class="table mini-cart-table dw-mod"> 446 @RenderBlockList(subBlocks) 447 </table> 448 </div> 449 } 450 451 @helper RenderMiniCartOrderLinesBlocks() 452 { 453 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 454 455 <div class="u-overflow-auto"> 456 @RenderBlockList(subBlocks) 457 </div> 458 } 459 460 @helper RenderMiniCartOrderLinesHeader() 461 { 462 <thead> 463 <tr> 464 <td>&nbsp;</td> 465 <td>@Translate("Product")</td> 466 <td class="u-ta-right">@Translate("Qty")</td> 467 <td class="u-ta-right" width="120">@Translate("Price")</td> 468 </tr> 469 </thead> 470 } 471 472 @helper RenderMiniCartOrderLinesList() 473 { 474 <text> 475 {{#OrderLines}} 476 {{#ifCond template "===" "CartOrderline"}} 477 {{>MiniCartOrderline}} 478 {{/ifCond}} 479 {{#ifCond template "===" "CartOrderlineMobile"}} 480 {{>MiniCartOrderline}} 481 {{/ifCond}} 482 {{#ifCond template "===" "CartOrderlineDiscount"}} 483 {{>MiniCartOrderlineDiscount}} 484 {{/ifCond}} 485 {{/OrderLines}} 486 </text> 487 } 488 489 @helper RenderMiniCartFees() 490 { 491 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 492 if (!pointShop) 493 { 494 <text> 495 {{#unless hidePaymentfee}} 496 <div class="grid"> 497 <div class="grid__col-6 grid__col--bleed-y"> 498 {{paymentmethod}} 499 </div> 500 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{paymentfee}}</div> 501 </div> 502 {{/unless}} 503 </text> 504 } 505 <text> 506 {{#unless hideShippingfee}} 507 <div class="grid"> 508 <div class="grid__col-6 grid__col--bleed-y"> 509 {{shippingmethod}} 510 </div> 511 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{shippingfee}}</div> 512 </div> 513 {{/unless}} 514 </text> 515 <text> 516 {{#if hasTaxSettings}} 517 <div class="grid"> 518 <div class="grid__col-6 grid__col--bleed-y">@Translate("Sales Tax")</div> 519 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{totaltaxes}}</div> 520 </div> 521 {{/if}} 522 </text> 523 } 524 525 @helper RenderMiniCartFooter() 526 { 527 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList(); 528 529 <div class="mini-cart__footer u-border-top u-padding-top dw-mod"> 530 @RenderBlockList(subBlocks) 531 </div> 532 } 533 534 @helper RenderMiniCartActions() 535 { 536 int cartPageId = GetPageIdByNavigationTag("CartPage"); 537 538 <button type="button" title="@Translate("Empty cart")" class="btn btn--secondary u-full-width dw-mod u-no-margin u-margin-bottom" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event);">@Translate("Empty cart")</button> 539 <a href="/Default.aspx?ID=@cartPageId" title="@Translate("Proceed to checkout")" class="btn btn--primary u-full-width u-no-margin dw-mod">@Translate("Proceed to checkout")</a> 540 } 541 542 @helper RenderMiniCartPoints() 543 { 544 <text> 545 {{#if earnings}} 546 <div class="grid"> 547 <div class="grid__col-6 grid__col--bleed-y">@Translate("Earnings")</div> 548 <div class="grid__col-6 grid__col--bleed-y grid--align-end"> 549 <div> 550 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points") 551 </div> 552 </div> 553 </div> 554 {{/if}} 555 </text> 556 } 557 558 @helper RenderMiniCartSubTotal() 559 { 560 bool hasTaxSettings = Dynamicweb.Rapido.Services.Countries.HasTaxSettings(Model.Cart.ID); 561 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 562 if (!pointShop) 563 { 564 <text> 565 {{#unless hideSubTotal}} 566 <div class="grid dw-mod u-bold"> 567 <div class="grid__col-6 grid__col--bleed-y">@Translate("Subtotal")</div> 568 <div class="grid__col-6 grid__col--bleed-y grid--align-end"> 569 @if (hasTaxSettings) 570 { 571 <text>{{subtotalpricewithouttaxes}}</text> 572 } 573 else 574 { 575 <text>{{subtotalprice}}</text> 576 } 577 </div> 578 </div> 579 {{/unless}} 580 </text> 581 } 582 } 583 584 @helper RenderMiniCartTotal() 585 { 586 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 587 588 <div class="mini-cart-totals grid u-border-top u-margin-top dw-mod"> 589 <div class="grid__col-6">@Translate("Total")</div> 590 <div class="grid__col-6 grid--align-end"> 591 <div> 592 @if (pointShop) 593 { 594 <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points") 595 } 596 else 597 { 598 <text>{{totalprice}}</text> 599 } 600 </div> 601 </div> 602 </div> 603 } 604 605 @helper RenderMiniCartDisclaimer() 606 { 607 <text> 608 {{#if showCheckoutDisclaimer}} 609 <div class="grid u-margin-bottom u-ta-right"> 610 <small class="grid__col-12">{{checkoutDisclaimer}}</small> 611 </div> 612 {{/if}} 613 </text> 614 } 615 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Services @{ string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; string addToCartNotificationMiniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !string.IsNullOrEmpty(addToCartNotificationType)) { if (addToCartNotificationType == "modal") { Block addToCartNotificationModal = new Block { Id = "AddToCartNotificationModal", Template = RenderAddToCartNotificationModal() }; Block addToCartNotificationScript = new Block { Id = "AddToCartNotificationScript", Template = RenderAddToCartNotificationModalScript() }; BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal); BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); } else if (addToCartNotificationType == "toggle" && addToCartNotificationMiniCartLayout != "none" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") { Block addToCartNotificationScript = new Block { Id = "AddToCartNotificationScript", Template = RenderAddToCartNotificationToggleScript() }; BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); } } } @helper RenderAddToCartNotificationModal() { <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> } @helper RenderAddToCartNotificationModalScript() { int cartPageId = GetPageIdByNavigationTag("CartPage"); <script id="LastAddedProductTemplate" type="text/x-template"> @{ Modal lastAddedProduct = new Modal { Id = "LastAddedProduct", Heading = new Heading { Level = 2, Title = Translate("Product is added to the cart") }, Width = ModalWidth.Md, BodyTemplate = RenderModalContent() }; lastAddedProduct.AddActions( new Button { ButtonType = ButtonType.Button, ButtonLayout = ButtonLayout.Secondary, Title = Translate("Continue shopping"), CssClass = "u-pull--left u-no-margin btn--sm", OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false" }, new Link { Href = "/Default.aspx?ID=" + cartPageId, ButtonLayout = ButtonLayout.Secondary, CssClass = "u-pull--right u-no-margin btn--sm", Title = Translate("Proceed to checkout") } ); @Render(lastAddedProduct) } </script> <script> document.addEventListener('addToCart', function (event) { Cart.ShowLastAddedProductModal(event.detail); }); </script> } @helper RenderModalContent() { <div class="grid"> <div class="grid__col-2"> @Render(new Image { Path = "{{ productInfo.image }}", Link = "{{ productInfo.link }}", Title = "{{ productInfo.name }}", DisableImageEngine = true }) </div> <div class="u-padding grid--align-self-center"> <span>{{quantity}}</span> x </div> <div class="grid__col-auto grid--align-self-center"> <div>{{productInfo.name}}</div> {{#if productInfo.variantName}} <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> {{/if}} {{#if productInfo.unitName}} <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> {{/if}} </div> </div> } @helper RenderAddToCartNotificationToggleScript() { int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); <script> document.addEventListener('addToCart', function () { Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); }); </script> } 616 @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 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> } 617 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @using Dynamicweb.Ecommerce.Common @{ BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); Block masterScriptReferences = new Block() { Id = "MasterScriptReferences", SortId = 1, Template = RenderMasterScriptReferences() }; referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); } @helper RenderMasterScriptReferences() { <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script> <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script> if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript")) { var minify = Model.Area.Item.GetItem("Rizzo").GetBoolean("MinifyJavascript"); const string folderName = "custom"; var customBundle = Dna.Optimizer.Renderer.RenderScripts($"/Files/Templates/Designs/Rapido/js/{folderName}", $"-{folderName}-scripts", new List<string>(), new List<string>(), minify, false, false); <script src="@customBundle"></script> PushPromise(customBundle); } PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"); PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js"); } 618 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 619 620 @using System 621 @using System.Web 622 @using System.Collections.Generic 623 @using Dynamicweb.Rapido.Blocks.Extensibility 624 @using Dynamicweb.Rapido.Blocks 625 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 626 @using Dynamicweb.Rapido.Services 627 628 @{ 629 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); 630 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 631 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID")); 632 633 if (!navigationItemsHideSearch || isFavoriteList) 634 { 635 Block masterSearchScriptTemplates = new Block() 636 { 637 Id = "MasterSearchScriptTemplates", 638 SortId = 1, 639 Template = RenderSearchScriptTemplates() 640 }; 641 642 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); 643 } 644 } 645 646 @helper RenderSearchScriptTemplates() 647 { 648 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 649 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 650 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 651 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 652 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults"); 653 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton"); 654 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton"); 655 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton"); 656 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 657 658 <script id="SearchGroupsTemplate" type="text/x-template"> 659 {{#.}} 660 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 661 {{/.}} 662 </script> 663 664 <script id="SearchProductsTemplate" type="text/x-template"> 665 {{#each .}} 666 {{#Product}} 667 {{#ifCond template "!==" "SearchMore"}} 668 <li class="dropdown__item dropdown__item--seperator dw-mod"> 669 @if (useFacebookPixel) 670 { 671 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 672 } 673 @if (useGoogleTagManager) 674 { 675 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text> 676 } 677 <div> 678 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}{{#if variantName}}, {{variantName}}{{/if}}"> 679 <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> 680 <div class="u-pull--left"> 681 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}{{#if variantName}}, {{variantName}}{{/if}}</div> 682 @if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 683 { 684 if (pointShopOnly) 685 { 686 <text> 687 {{#if havePointPrice}} 688 <div> 689 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 690 </div> 691 {{else}} 692 <small class="help-text u-no-margin">@Translate("Not available")</small> 693 {{/if}} 694 {{#unless canBePurchasedWithPoints}} 695 {{#if havePointPrice}} 696 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 697 {{/if}} 698 {{/unless}} 699 </text> 700 } 701 else 702 { 703 <div>{{price}}</div> 704 } 705 } 706 </div> 707 </a> 708 <div class="u-margin-left u-pull--right"> 709 @{ 710 var viewBtn = new Link 711 { 712 Href = "{{link}}", 713 OnClick = "{{googleImpressionClick}}", 714 ButtonLayout = ButtonLayout.Secondary, 715 CssClass = "btn--condensed u-no-margin u-w80px js-ignore-click-outside", 716 Title = Translate("View") 717 }; 718 } 719 @if (showAddToCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 720 { 721 <text>{{#if hideAddToCartButton}}</text> 722 @Render(viewBtn) 723 <text>{{else}}</text> 724 @Render(new AddToCartButton 725 { 726 HideTitle = true, 727 ProductId = "{{productId}}", 728 ProductInfo = "{{productInfo}}", 729 BuyForPoints = pointShopOnly, 730 OnClick = "{{facebookPixelAction}}", 731 CssClass = "u-w80px js-ignore-click-outside", 732 Icon = new Icon { 733 CssClass = "js-ignore-click-outside" 734 }, 735 ExtraAttributes = new Dictionary<string, string> 736 { 737 { "{{disabledBuyButton}}", "" }, 738 { "{{outOfStock}}", "" } 739 } 740 }) 741 <text>{{/if}}</text> 742 } 743 else if (showViewButton) 744 { 745 @Render(viewBtn) 746 } 747 @if (showAddToDownloadButton) 748 { 749 <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}}"> 750 <i class="fas fa-plus js-button-icon"></i> 751 </button> 752 } 753 </div> 754 </div> 755 </li> 756 {{/ifCond}} 757 {{#ifCond template "===" "SearchMore"}} 758 {{>SearchMoreProducts}} 759 {{/ifCond}} 760 {{/Product}} 761 {{else}} 762 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 763 @Translate("Your search gave 0 results") 764 </li> 765 {{/each}} 766 </script> 767 768 <script id="SearchMoreProducts" type="text/x-template"> 769 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 770 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 771 @Translate("View all") 772 </a> 773 </li> 774 </script> 775 776 <script id="SearchMorePages" type="text/x-template"> 777 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 778 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 779 @Translate("View all") 780 </a> 781 </li> 782 </script> 783 784 <script id="SearchPagesTemplate" type="text/x-template"> 785 {{#each .}} 786 {{#ifCond template "!==" "SearchMore"}} 787 <li class="dropdown__item dropdown__item--seperator dw-mod"> 788 <div> 789 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit"> 790 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 791 <div class="u-pull--left"> 792 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 793 </div> 794 </a> 795 </div> 796 </li> 797 {{/ifCond}} 798 {{#ifCond template "===" "SearchMore"}} 799 {{>SearchMorePages}} 800 {{/ifCond}} 801 {{else}} 802 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 803 @Translate("Your search gave 0 results") 804 </li> 805 {{/each}} 806 </script> 807 808 <script id="SearchPagesTemplateWrap" type="text/x-template"> 809 <div class="dropdown__column-header">@Translate("Pages")</div> 810 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 811 {{>SearchPagesTemplate}} 812 </ul> 813 </script> 814 815 <script id="SearchProductsTemplateWrap" type="text/x-template"> 816 <div class="dropdown__column-header">@Translate("Products")</div> 817 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 818 {{>SearchProductsTemplate}} 819 </ul> 820 </script> 821 } 822 823 @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 824 825 @* Component *@ 826 827 @helper RenderAddToCart(AddToCart settings) 828 { 829 //set Id for quantity selector to get it's value from button 830 if (settings.QuantitySelector != null) 831 { 832 if (string.IsNullOrEmpty(settings.QuantitySelector.Id)) 833 { 834 settings.QuantitySelector.Id = Guid.NewGuid().ToString("N"); 835 } 836 837 settings.AddButton.QuantitySelectorId = settings.QuantitySelector.Id; 838 839 if (settings.Disabled) 840 { 841 settings.QuantitySelector.Disabled = true; 842 } 843 844 if (string.IsNullOrEmpty(settings.QuantitySelector.Name)) 845 { 846 settings.QuantitySelector.Name = settings.QuantitySelector.Id; 847 } 848 849 settings.QuantitySelector.Max = "{{availableAmount}}"; 850 } 851 852 if (settings.Disabled) 853 { 854 settings.AddButton.Disabled = true; 855 } 856 857 settings.AddButton.CssClass += " btn--condensed"; 858 859 //unitsSelector 860 if (settings.UnitSelector != null) 861 { 862 if (settings.Disabled) 863 { 864 settings.QuantitySelector.Disabled = true; 865 } 866 } 867 868 <div class="buttons-collection @settings.WrapperCssClass" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 869 @if (settings.UnitSelector != null) 870 { 871 @Render(settings.UnitSelector) 872 } 873 @if (settings.QuantitySelector != null) 874 { 875 @Render(settings.QuantitySelector) 876 } 877 @Render(settings.AddButton) 878 </div> 879 } @using Dynamicweb.Core 880 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 881 @using Dynamicweb.Rapido.Blocks.Components.General 882 883 @* Component *@ 884 885 @helper RenderAddToCartButton(AddToCartButton settings) 886 { 887 if (!settings.HideTitle) 888 { 889 if (string.IsNullOrEmpty(settings.Title)) 890 { 891 if (settings.BuyForPoints) 892 { 893 settings.Title = Translate("Buy with points"); 894 } 895 else 896 { 897 settings.Title = Translate("Add to cart"); 898 } 899 } 900 } 901 else 902 { 903 settings.Title = ""; 904 } 905 906 var webServiceConnectionAvailableTag = Pageview.GlobalTags.GetTagByName("Global:LiveIntegration.IsWebServiceConnectionAvailable"); 907 var disableAddToCart = Pageview.AreaSettings.GetItem("Rizzo").GetBoolean("DisableAddToCarButton"); 908 if (webServiceConnectionAvailableTag != null && !Converter.ToBoolean(webServiceConnectionAvailableTag.Value) && disableAddToCart) 909 { 910 settings.Disabled = true; 911 settings.AltText = Translate("Temporarily unavailable"); 912 } 913 914 if (settings.Icon == null) 915 { 916 settings.Icon = new Icon(); 917 settings.Icon.LabelPosition = Dynamicweb.Rapido.Blocks.Components.General.IconLabelPosition.After; 918 } 919 920 if (string.IsNullOrEmpty(settings.Icon.Name)) 921 { 922 settings.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue; 923 } 924 925 string cartArgs = "{ " + 926 "id: '" + settings.ProductId + "'," + 927 (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") + 928 (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") + 929 (settings.BuyForPoints ? "buyForPoints: true," : "") + 930 (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") + 931 "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value)") + 932 "}"; 933 string stockValidationUrl = Dna.StockValidation.Product.GetValidationUrl(GetPageIdByNavigationTag("StockValidation"), settings.ProductId, settings.VariantId, settings.UnitId, Pageview.Area.EcomLanguageId); 934 935 settings.OnClick = "StockValidation.AddToCartValidation(event, " + cartArgs + ", '" + stockValidationUrl + "');" + settings.OnClick; 936 937 @RenderButton(settings) 938 } @using Dynamicweb.Rapido.Blocks.Components.Ecommerce @* Component *@ @helper RenderUnitSelector(UnitSelector settings) { var id = settings.Id; var disabledClass = settings.Disabled ? "disabled" : ""; <input type="checkbox" id="@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="@id">@settings.SelectedOption</label> <div class="dropdown__content dw-mod"> @settings.OptionsContent </div> <label class="dropdown-trigger-off" for="@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" /> } 939 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); Block primaryBottomSnippets = new Block() { Id = "MasterJavascriptInitializers", SortId = 100, Template = RenderPrimaryBottomSnippets() }; bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); } @helper RenderPrimaryBottomSnippets() { bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode"); bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); if (isWireframeMode) { <script> Wireframe.Init(true); </script> } if (useGoogleTagManager) { <script> document.addEventListener('addToCart', function(event) { var googleImpression = event.detail.productInfo.googleImpression; dataLayer.push({ 'event': 'addToCart', 'ecommerce': { 'currencyCode': '@Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency().Code', 'add': { 'products': [{ 'name': googleImpression.name, 'id': googleImpression.id, 'price': googleImpression.price, 'brand': googleImpression.brand, 'category': googleImpression.category, 'variant': googleImpression.variant, 'quantity': event.detail.quantity }] } } }); }); </script> } //if digitalwarehouse if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart")) { string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]); if (string.IsNullOrEmpty(cartContextId)) { var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2"); var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps); cartContextId = cartSettings.OrderContextID; HttpContext.Current.Application["DownloadCartContext"] = cartContextId; } <script> let downloadCart = new DownloadCart({ cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"), contextId: "@cartContextId", addButtonText: "@Translate("Add")", removeButtonText: "@Translate("Remove")" }); </script> } <!--$$Javascripts--> } 940 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 941 942 @using System 943 @using System.Web 944 @using System.Collections.Generic 945 @using Dynamicweb.Rapido.Blocks 946 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 947 @using Dynamicweb.Rapido.Blocks 948 @using Dynamicweb.Rapido.Blocks.Extensibility 949 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System.Collections.Generic @using Dynamicweb.Core @using Dynamicweb.Rapido.Blocks @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Extensibility @{ BlocksPage masterBlockPage = BlocksPage.GetBlockPage("Master"); masterBlockPage.RemoveBlockById("ImpersonationBar"); if (Model.CurrentUser.ID > 0 && Dna.AutoImpersonate.Helpers.AmountOfUserICanSetAsSecondary > 1) { masterBlockPage.Add(MasterBlockId.MasterHeader, new Block() { Id = "RizzoImpersonationBarContainer", SortId = 5, Design = new Design() { CssClass = "center-container", RenderType = RenderType.None }, BlocksList = new List<Block>() { new Block() { Id = "RizzoImpersonationBar", SortId = 5, Design = new Design() { Size = "12", CssClass = "grid--justify-end", RenderType = RenderType.Column }, Template = RenderRizzoImpersonationBar() } } }); if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request[Dna.AutoImpersonate.Constants.Parameters.RequireManaging])) { masterBlockPage.Add(MasterBlockId.MasterMain, new Block() { Id = "RizzoRequireManageAccount", SortId = 15, Design = new Design() { Size = "width-auto", HidePadding = true, CssClass = "u-color-warning--bg", RenderType = RenderType.Column }, Template = RenderRizzoRequireManageAccount() }); } } } @helper RenderRizzoImpersonationBar() { bool isManagingAccount = Model.CurrentSecondaryUser.ID > 0; string switchAccountUrl = string.Format("Default.aspx?Id={0}", GetPageIdByNavigationTag(Dna.AutoImpersonate.Constants.PageProperties.NavigationTags.Impersonation)); string userName = Model.CurrentUser.Name.IsNotNullOrEmpty() ? Model.CurrentUser.Name : Model.CurrentUser.FirstName.IsNotNullOrEmpty() || Model.CurrentUser.LastName.IsNotNullOrEmpty() ? string.Format("{0}{1}", Model.CurrentUser.FirstName, Model.CurrentUser.LastName) : Model.CurrentUser.UserName; <div class="u-font-size--sm"> @string.Format("{0}: {1}", isManagingAccount ? Translate("Managing Account") : Translate("Welcome Back"), userName) @Render(new Link() { Href = switchAccountUrl, CssClass = "u-margin-left", ButtonLayout = ButtonLayout.None, Title = Translate("Manage Account"), Icon = new Icon() { Prefix = "fas", Name = "fa-address-book", LabelPosition = IconLabelPosition.After } }) @Render(new Link() { Href = "/Admin/Public/ExtranetLogoff.aspx", CssClass = "u-margin-left", ButtonLayout = ButtonLayout.None, Title = Translate("Logout"), Icon = new Icon() { Prefix = "fas", Name = "fa-sign-out", LabelPosition = IconLabelPosition.After } }) </div> } @helper RenderRizzoRequireManageAccount() { <div class="center-container"> <div class="grid"> <div class="grid--align-self-center grid__col-x"> <div class="grid-cell u-bold"> @Render(new Icon { Prefix = "fas", Name = "fa-exclamation-triangle", Label = Translate("Please select an account to manage before continuing"), LabelPosition = IconLabelPosition.After }) </div> </div> </div> </div> } 950 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using Dynamicweb.Rapido.Blocks @{ BlocksPage.GetBlockPage("Master").GetBlockById("MiniCartOrderLinesList").Template = RenderRizzoMiniCartOrderLinesList(); } @helper RenderRizzoMiniCartOrderLinesList() { <text> {{#OrderLines}} {{#ifCond template "===" "CartOrderline"}} {{>MiniCartOrderline}} {{/ifCond}} {{#ifCond template "===" "CartOrderlineMobile"}} {{>MiniCartOrderline}}t {{/ifCond}} {{#ifCond template "===" "CartOrderlineDiscount"}} {{>MiniCartOrderlineDiscount}} {{/ifCond}} {{/OrderLines}} {{#OrderLinesOutOfStock}} {{#ifCond template "===" "CartOrderline"}} {{>MiniCartOrderline}} {{/ifCond}} {{#ifCond template "===" "CartOrderlineMobile"}} {{>MiniCartOrderline}} {{/ifCond}} {{#ifCond template "===" "CartOrderlineDiscount"}} {{>MiniCartOrderlineDiscount}} {{/ifCond}} {{/OrderLinesOutOfStock}} </text> } 951 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 952 @using System.Collections.Generic 953 @using Dynamicweb.Rapido.Blocks.Components.General 954 @using Dynamicweb.Rapido.Blocks.Extensibility 955 @using Dynamicweb.Rapido.Blocks 956 @using Dynamicweb.Core 957 @functions{ 958 BlocksPage rizzoErpConnectionBlocksPage = BlocksPage.GetBlockPage("Master"); 959 } 960 @{ 961 var webServiceConnectionAvailableTag = Pageview.GlobalTags.GetTagByName("Global:LiveIntegration.IsWebServiceConnectionAvailable"); 962 var showErpDownMessage = Model.Area.Item.GetItem("Rizzo").GetBoolean("ShowErpDownMessage"); 963 if (webServiceConnectionAvailableTag != null && !Converter.ToBoolean(webServiceConnectionAvailableTag.Value) && showErpDownMessage) 964 { 965 rizzoErpConnectionBlocksPage.Add(MasterBlockId.MasterMain, new Block() 966 { 967 Id = "RizzoNoErpConnection", 968 SortId = 15, 969 Design = new Design { Size = "width-auto", HidePadding = true, CssClass = "u-color-danger--bg", RenderType = RenderType.Column }, 970 BlocksList = new List<Block> 971 { 972 new Block 973 { 974 Id = "RizzoNoErpConnectionContainer", 975 SortId = 10, 976 Design = new Design { RenderType = RenderType.None, CssClass = "center-container content-container"}, 977 SkipRenderBlocksList = true, 978 Template = RenderRizzoNoErpConnectionContainer(), 979 BlocksList = new List<Block> 980 { 981 new Block 982 { 983 Id = "RizzoNoErpConnectionMessage", 984 SortId = 10, 985 Design = new Design { Size = "12", RenderType = RenderType.Column, CssClass = "u-padding--lg"}, 986 Component = new Heading { 987 Level = 0, 988 CssClass = "grid-cell u-bold", 989 Title = Translate("Currently we are down for maintenance. We expect to be back soon."), 990 Icon = new Icon {Prefix = "fas", Name = "fa-exclamation-triangle", LabelPosition = IconLabelPosition.After} 991 } 992 } 993 } 994 } 995 } 996 }); 997 } 998 } 999 1000 @helper RenderRizzoNoErpConnectionContainer() 1001 { 1002 @RenderBlockList(rizzoErpConnectionBlocksPage.GetBlockById("RizzoNoErpConnectionContainer").BlocksList) 1003 } 1004 @{ 1005 var rizzoReferencesBlocksPage = BlocksPage.GetBlockPage("Master"); 1006 var masterScriptRizzoReferences = new Block() 1007 { 1008 Id = "MasterScriptRizzoReferences", 1009 SortId = 2, 1010 Template = RenderMasterScriptRizzoReferences() 1011 }; 1012 rizzoReferencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptRizzoReferences); 1013 } 1014 @helper RenderMasterScriptRizzoReferences() { 1015 if (Model.Area.Item.GetItem("Rizzo").GetBoolean("UseRizzoJavascript")) 1016 { 1017 var minify = Model.Area.Item.GetItem("Rizzo").GetBoolean("MinifyJavascript");; 1018 const string folderName = "rizzo"; 1019 var rizzoBundle = Dna.Optimizer.Renderer.RenderScripts($"/Files/Templates/Designs/Rapido/js/{folderName}", $"-{folderName}-scripts", new List<string>(), new List<string>(), minify, false, false); 1020 <script src="@rizzoBundle"></script> 1021 PushPromise(rizzoBundle); 1022 } 1023 } 1024 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using Dynamicweb.Rapido.Blocks @using Dynamicweb.Rapido.Blocks.Extensibility @{ var rizzoPackagesReferencesBlocksPage = BlocksPage.GetBlockPage("Master"); var masterScriptRizzoPackagesReferences = new Block() { Id = "MasterScriptRizzoPackagesReferences", SortId = 2, Template = RenderMasterScriptRizzoPackagesReferences() }; rizzoPackagesReferencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptRizzoPackagesReferences); } @helper RenderMasterScriptRizzoPackagesReferences() { if (Model.Area.Item.GetItem("RizzoPackages").GetBoolean("UseRizzoJavascript")) { var minify = Model.Area.Item.GetItem("Rizzo").GetBoolean("MinifyJavascript");; const string folderName = "rizzoPackages"; var rizzoPackagesBundle = Dna.Optimizer.Renderer.RenderScripts($"/Files/Templates/Designs/Rapido/js/{folderName}", $"-{folderName}-scripts", new List<string>(), new List<string>(), minify, false, false); <script src="@rizzoPackagesBundle"></script> PushPromise(rizzoPackagesBundle); } } 1025 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 1026 1027 @using System.Collections.Generic 1028 @using Dynamicweb.Rapido.Blocks 1029 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 1030 1031 @{ 1032 BlocksPage customSearchBlocksPage = BlocksPage.GetBlockPage("Master"); 1033 1034 if (customSearchBlocksPage.GetBlockById("MasterSearchScriptTemplates") != null) 1035 { 1036 customSearchBlocksPage.GetBlockById("MasterSearchScriptTemplates").Template = RenderSearchScriptTemplatesCustom(); 1037 } 1038 } 1039 1040 @helper RenderSearchScriptTemplatesCustom() 1041 { 1042 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 1043 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 1044 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 1045 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 1046 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults"); 1047 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton"); 1048 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton"); 1049 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton"); 1050 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 1051 1052 <script id="SearchGroupsTemplate" type="text/x-template"> 1053 {{#.}} 1054 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 1055 {{/.}} 1056 </script> 1057 1058 <script id="SearchProductsTemplate" type="text/x-template"> 1059 {{#each .}} 1060 {{#Product}} 1061 {{#ifCond template "!==" "SearchMore"}} 1062 <li class="dropdown__item dropdown__item--seperator dw-mod"> 1063 @if (useFacebookPixel) 1064 { 1065 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 1066 } 1067 @if (useGoogleTagManager) 1068 { 1069 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text> 1070 } 1071 <div> 1072 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}{{#if variantName}}, {{variantName}}{{/if}}"> 1073 <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> 1074 <div class="u-pull--left"> 1075 @*START CUSTOM CODE*@ 1076 <div class="u-max-w220px u-truncate-text js-typeahead-name u-flex grid--direction-column"><span class="u-bold">{{number}}</span> {{name}}{{#if variantName}}, {{variantName}}{{/if}}</div> 1077 @*END CUSTOM CODE*@ 1078 @if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 1079 { 1080 if (pointShopOnly) 1081 { 1082 <text> 1083 {{#if havePointPrice}} 1084 <div> 1085 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 1086 </div> 1087 {{else}} 1088 <small class="help-text u-no-margin">@Translate("Not available")</small> 1089 {{/if}} 1090 {{#unless canBePurchasedWithPoints}} 1091 {{#if havePointPrice}} 1092 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 1093 {{/if}} 1094 {{/unless}} 1095 </text> 1096 } 1097 else 1098 { 1099 <div>{{price}}</div> 1100 } 1101 } 1102 </div> 1103 </a> 1104 <div class="u-margin-left u-pull--right"> 1105 @{ 1106 var viewBtn = new Link 1107 { 1108 Href = "{{link}}", 1109 OnClick = "{{googleImpressionClick}}", 1110 ButtonLayout = ButtonLayout.Secondary, 1111 CssClass = "btn--condensed u-no-margin u-w80px js-ignore-click-outside", 1112 Title = Translate("View") 1113 }; 1114 } 1115 @if (showAddToCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 1116 { 1117 <text>{{#if hideAddToCartButton}}</text> 1118 @Render(viewBtn) 1119 <text>{{else}}</text> 1120 @Render(new AddToCartButton 1121 { 1122 HideTitle = true, 1123 ProductId = "{{productId}}", 1124 ProductInfo = "{{productInfo}}", 1125 BuyForPoints = pointShopOnly, 1126 OnClick = "{{facebookPixelAction}}", 1127 CssClass = "u-w80px js-ignore-click-outside", 1128 Icon = new Icon { 1129 CssClass = "js-ignore-click-outside" 1130 }, 1131 ExtraAttributes = new Dictionary<string, string> 1132 { 1133 { "{{disabledBuyButton}}", "" }, 1134 { "{{outOfStock}}", "" } 1135 } 1136 }) 1137 <text>{{/if}}</text> 1138 } 1139 else if (showViewButton) 1140 { 1141 @Render(viewBtn) 1142 } 1143 @if (showAddToDownloadButton) 1144 { 1145 <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}}"> 1146 <i class="fas fa-plus js-button-icon"></i> 1147 </button> 1148 } 1149 </div> 1150 </div> 1151 </li> 1152 {{/ifCond}} 1153 {{#ifCond template "===" "SearchMore"}} 1154 {{>SearchMoreProducts}} 1155 {{/ifCond}} 1156 {{/Product}} 1157 {{else}} 1158 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 1159 @Translate("Your search gave 0 results") 1160 </li> 1161 {{/each}} 1162 </script> 1163 1164 <script id="SearchMoreProducts" type="text/x-template"> 1165 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 1166 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 1167 @Translate("View all") 1168 </a> 1169 </li> 1170 </script> 1171 1172 <script id="SearchMorePages" type="text/x-template"> 1173 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 1174 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 1175 @Translate("View all") 1176 </a> 1177 </li> 1178 </script> 1179 1180 <script id="SearchPagesTemplate" type="text/x-template"> 1181 {{#each .}} 1182 {{#ifCond template "!==" "SearchMore"}} 1183 <li class="dropdown__item dropdown__item--seperator dw-mod"> 1184 <div> 1185 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit"> 1186 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 1187 <div class="u-pull--left"> 1188 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 1189 </div> 1190 </a> 1191 </div> 1192 </li> 1193 {{/ifCond}} 1194 {{#ifCond template "===" "SearchMore"}} 1195 {{>SearchMorePages}} 1196 {{/ifCond}} 1197 {{else}} 1198 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 1199 @Translate("Your search gave 0 results") 1200 </li> 1201 {{/each}} 1202 </script> 1203 1204 <script id="SearchPagesTemplateWrap" type="text/x-template"> 1205 <div class="dropdown__column-header">@Translate("Pages")</div> 1206 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 1207 {{>SearchPagesTemplate}} 1208 </ul> 1209 </script> 1210 1211 <script id="SearchProductsTemplateWrap" type="text/x-template"> 1212 <div class="dropdown__column-header">@Translate("Products")</div> 1213 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 1214 {{>SearchProductsTemplate}} 1215 </ul> 1216 </script> 1217 } 1218 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 1219 1220 @using Dynamicweb.Rapido.Blocks 1221 1222 @{ 1223 var customMiniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 1224 var orderlinesViewCustom = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table"; 1225 var orderLinesScriptTemplates = customMiniCartBlocksPage.GetBlockById("OrderlinesScriptTemplates"); 1226 1227 if (orderlinesViewCustom == "table") 1228 { 1229 orderLinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplatesCustom(); 1230 } 1231 else 1232 { 1233 orderLinesScriptTemplates.Template = RenderMiniCartScriptsListTemplatesCustom(); 1234 } 1235 } 1236 1237 @helper RenderMiniCartScriptsTableTemplatesCustom() 1238 { 1239 <script id="MiniCartOrderline" type="text/x-template"> 1240 {{#unless isEmpty}} 1241 <tr> 1242 <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&Quality=75&Format=webp&image={{image}}" alt="{{productnumber}}" title="{{productnumber}}"></a></td> 1243 <td class="u-va-middle"> 1244 @*START CUSTOM CODE*@ 1245 <a href="{{link}}" class="mini-cart-orderline__name" title="{{productnumber}}"><span class="u-clearfix">{{productnumber}}</span>{{#unless variantname}}{{name}}{{/unless}}</a> 1246 @*END CUSTOM CODE*@ 1247 </td> 1248 <td class="u-ta-right u-va-middle">{{quantity}}</td> 1249 <td class="u-ta-right u-va-middle"> 1250 {{#if pointsTotal}} 1251 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 1252 {{else}} 1253 {{totalprice}} 1254 {{/if}} 1255 </td> 1256 </tr> 1257 {{/unless}} 1258 </script> 1259 1260 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 1261 {{#unless isEmpty}} 1262 <tr class="table__row--no-border"> 1263 <td class="u-w60px">&nbsp;</td> 1264 @*START CUSTOM CODE*@ 1265 <td><div class="mini-cart-orderline__name dw-mod"><span class="u-clearfix">{{productnumber}}</span>{{#unless variantname}}{{name}}{{/unless}}</div></td> 1266 @*END CUSTOM CODE*@ 1267 <td class="u-ta-right">&nbsp;</td> 1268 <td class="u-ta-right">{{totalprice}}</td> 1269 </tr> 1270 {{/unless}} 1271 </script> 1272 } 1273 1274 @helper RenderMiniCartScriptsListTemplatesCustom() 1275 { 1276 int cartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 1277 1278 <script id="MiniCartOrderline" type="text/x-template"> 1279 {{#unless isEmpty}} 1280 <div class="mini-cart-orderline grid dw-mod"> 1281 <div class="grid__col-4"> 1282 <a href="{{link}}" class="{{hideimage}}"> 1283 <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=100&height=100&crop=5&Quality=75&Format=webp&image={{image}}" alt="{{name}}" title="{{productnumber}}"> 1284 </a> 1285 </div> 1286 <div class="grid__col-8"> 1287 @*START CUSTOM CODE*@ 1288 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--truncate mini-cart-orderline__name--md u-padding-right--lg" title="{{productnumber}}"><span class="u-clearfix">{{productnumber}}</span>{{#unless variantname}}{{name}}{{/unless}}</a> 1289 @*END CUSTOM CODE*@ 1290 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div> 1291 1292 <div class="grid__cell-footer"> 1293 <div class="grid__cell"> 1294 <div class="u-pull--left mini-cart-orderline__price dw-mod"> 1295 {{#if pointsTotal}} 1296 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 1297 {{else}} 1298 {{totalprice}} 1299 {{/if}} 1300 </div> 1301 @* ASI CUSTOM CODE START *@ 1302 <button type="button" title="@Translate("Remove line")" class="btn btn--clean btn--condensed u-pull--right mini-cart-orderline__remove-btn dw-mod" onclick="{{removeFromCartGoogleImpression}}; Cart.UpdateCart('miniCartContent', '/Default.aspx?ID=@cartFeedPageId', 'CartCmd=DelOrderLine&key={{orderLineId}}&redirect=false', true);">@Translate("Remove")</button> 1303 @* ASI CUSTOM CODE END *@ 1304 </div> 1305 </div> 1306 </div> 1307 </div> 1308 {{/unless}} 1309 </script> 1310 1311 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 1312 {{#unless isEmpty}} 1313 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod"> 1314 <div class="grid__col-4"> 1315 @*START CUSTOM CODE*@ 1316 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod"><span class="u-clearfix">{{productnumber}}</span>{{#unless variantname}}{{name}}{{/unless}}</div> 1317 @*END CUSTOM CODE*@ 1318 </div> 1319 <div class="grid__col-8">{{totalprice}}</div> 1320 </div> 1321 {{/unless}} 1322 </script> 1323 } 1324 @{ 1325 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master"); 1326 1327 } 1328 1329 1330 @functions { 1331 public class ManifestIcon 1332 { 1333 public string src { get; set; } 1334 public string type { get; set; } 1335 public string sizes { get; set; } 1336 } 1337 1338 public class Manifest 1339 { 1340 public string name { get; set; } 1341 public string short_name { get; set; } 1342 public string start_url { get; set; } 1343 public string display { get; set; } 1344 public string background_color { get; set; } 1345 public string theme_color { get; set; } 1346 public List<ManifestIcon> icons { get; set; } 1347 } 1348 } 1349 1350 <!DOCTYPE html> 1351 1352 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> 1353 1354 1355 1356 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 1357 @RenderBlockList(masterPage.BlocksRoot.BlocksList) 1358 1359 1360 1361 @helper RenderMasterHead() { 1362 List<Block> subBlocks = this.masterPage.GetBlockListById("Head").OrderBy(item => item.SortId).ToList(); 1363 1364 <head> 1365 <!-- Rapido version 3.2 --> 1366 1367 @RenderBlockList(subBlocks) 1368 </head> 1369 } 1370 1371 @helper RenderMasterMetadata() { 1372 var swatches = new Dynamicweb.Content.Items.ColorSwatchService(); 1373 var brandColors = swatches.GetColorSwatch(1); 1374 string brandColorOne = brandColors.Palette["BrandColor1"]; 1375 1376 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) { 1377 Manifest manifest = new Manifest 1378 { 1379 name = Model.Area.Item.GetItem("Settings").GetString("AppName"), 1380 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"), 1381 start_url = "/", 1382 display = "standalone", 1383 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"), 1384 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor") 1385 }; 1386 1387 manifest.icons = new List<ManifestIcon> { 1388 new ManifestIcon { 1389 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 1390 sizes = "192x192", 1391 type = "image/png" 1392 }, 1393 new ManifestIcon { 1394 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 1395 sizes = "512x512", 1396 type = "image/png" 1397 }, 1398 new ManifestIcon { 1399 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 1400 sizes = "1024x1024", 1401 type = "image/png" 1402 } 1403 }; 1404 1405 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json"); 1406 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest); 1407 string currentManifest = File.ReadAllText(manifestFilePath); 1408 1409 if (manifestJSON != currentManifest) 1410 { 1411 File.WriteAllText(manifestFilePath, manifestJSON); 1412 } 1413 } 1414 1415 <meta charset="utf-8" /> 1416 <title>@Model.Title</title> 1417 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 1418 <meta name="robots" content="index, follow"> 1419 <meta name="theme-color" content="@brandColorOne" /> 1420 1421 if (!Model.MetaTags.Contains("og:image")) { 1422 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"))); 1423 } 1424 1425 if (!Model.MetaTags.Contains("og:description")) { 1426 Pageview.Meta.AddTag("og:description", Model.Description); 1427 } 1428 1429 Pageview.Meta.AddTag("og:title", Model.Title); 1430 Pageview.Meta.AddTag("og:site_name", Model.Name); 1431 Pageview.Meta.AddTag("og:url", HttpContext.Current.Request.Url.ToString()); 1432 Pageview.Meta.AddTag("og:type", "Website"); 1433 Pageview.Meta.AddTag("fb:page_id", Model.ID.ToString()); 1434 1435 @Model.MetaTags 1436 } 1437 1438 @helper RenderMasterCss() { 1439 var fonts = new string[] { 1440 getFontFamily("Layout", "HeaderFont"), 1441 getFontFamily("Layout", "SubheaderFont"), 1442 getFontFamily("Layout", "TertiaryHeaderFont"), 1443 getFontFamily("Layout", "BodyText"), 1444 getFontFamily("Layout", "Header", "ToolsFont"), 1445 getFontFamily("Layout", "Header", "NavigationFont"), 1446 getFontFamily("Layout", "MobileNavigation", "Font"), 1447 getFontFamily("ProductList", "Facets", "HeaderFont"), 1448 getFontFamily("ProductPage", "PriceFontDesign"), 1449 getFontFamily("Ecommerce", "SaleSticker", "Font"), 1450 getFontFamily("Ecommerce", "NewSticker", "Font"), 1451 getFontFamily("Ecommerce", "CustomSticker", "Font") 1452 }; 1453 1454 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks; 1455 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png"; 1456 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro"); 1457 string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css"; 1458 if (useFontAwesomePro) 1459 { 1460 fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css"; 1461 } 1462 1463 /* Optimizer variables */ 1464 var minify = Model.Area.Item.GetItem("Rizzo").GetBoolean("MinifyCss");; 1465 var folderName = string.Empty; 1466 var rizzoBundle = string.Empty; 1467 var rizzoPackagesBundle = string.Empty; 1468 var igniteBundle = string.Empty; 1469 var variablesFile = "/Files/Templates/Designs/Rapido/css/rapido/_variables_" + Model.Area.ID + ".auto.less"; 1470 1471 //Favicon 1472 <link href="@favicon" rel="icon" type="image/png"> 1473 1474 //Base (Default, wireframe) styles 1475 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css"> 1476 1477 //Rapido Css from Website Settings 1478 <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css"> 1479 1480 if (Model.Area.Item.GetItem("Rizzo").GetBoolean("UseRizzoCss")) 1481 { 1482 <!-- Rizzo Css (DWNA specific styles) --> 1483 folderName = "rizzo"; 1484 rizzoBundle = Dna.Optimizer.Renderer.RenderStyles($"/Files/Templates/Designs/Rapido/css/{folderName}", $"-{folderName}-styles", new [] {variablesFile}, new[] { $"{folderName}.css", $"{folderName}.min.css" }, minify, false, false); 1485 <link id="rizzoCss" type="text/css" rel="stylesheet" href="@rizzoBundle" /> 1486 } 1487 if (Model.Area.Item.GetItem("RizzoPackages").GetBoolean("UseRizzoCss")) 1488 { 1489 <!-- Rizzo Packages Css (DWNA packages specific styles) --> 1490 folderName = "rizzoPackages"; 1491 rizzoPackagesBundle = Dna.Optimizer.Renderer.RenderStyles($"/Files/Templates/Designs/Rapido/css/{folderName}", $"-{folderName}-styles", new [] {variablesFile}, new[] { $"{folderName}.css", $"{folderName}.min.css" }, minify, false, false); 1492 <link id="rizzoPackagesCss" type="text/css" rel="stylesheet" href="@rizzoPackagesBundle" /> 1493 } 1494 1495 //Ignite Css (Custom site specific styles) 1496 folderName = "ignite"; 1497 igniteBundle = Dna.Optimizer.Renderer.RenderStyles($"/Files/Templates/Designs/Rapido/css/{folderName}", $"-{folderName}-styles", new [] {variablesFile}, new[] { $"{folderName}.css", $"{folderName}.min.css" }, minify, false, false); 1498 <link id="igniteCss" type="text/css" rel="stylesheet" href="@igniteBundle" /> 1499 1500 //Font awesome 1501 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css"> 1502 1503 //Flag icon 1504 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css"> 1505 1506 //Google fonts 1507 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))); 1508 1509 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> 1510 1511 PushPromise(favicon); 1512 PushPromise(fontAwesomeCssLink); 1513 PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css"); 1514 PushPromise(autoCssLink); 1515 if (Model.Area.Item.GetItem("Rizzo").GetBoolean("UseRizzoCss")) 1516 { 1517 PushPromise(rizzoBundle); 1518 } 1519 if (Model.Area.Item.GetItem("RizzoPackages").GetBoolean("UseRizzoCss")) 1520 { 1521 PushPromise(rizzoPackagesBundle); 1522 } 1523 PushPromise(igniteBundle); 1524 PushPromise("/Files/Images/placeholder.gif"); 1525 PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css"); 1526 } 1527 1528 @helper RenderMasterManifest() { 1529 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName"))) 1530 { 1531 <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json"> 1532 PushPromise("/Files/Templates/Designs/Rapido/manifest.json"); 1533 } 1534 } 1535 1536 @helper RenderMasterBody() { 1537 List<Block> subBlocks = this.masterPage.GetBlockListById("Body").OrderBy(item => item.SortId).ToList(); 1538 string designLayout = Model.PropertyItem.GetItem("CustomSettings") != null ? Model.PropertyItem.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.PropertyItem.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : ""; 1539 if (!String.IsNullOrEmpty(designLayout)) { 1540 designLayout = "class=\"" + designLayout + "\""; 1541 } 1542 1543 <body @designLayout> 1544 @RenderBlockList(subBlocks) 1545 </body> 1546 } 1547 1548 @helper RenderMasterHeader() 1549 { 1550 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); 1551 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 1552 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; 1553 1554 <header class="top-container @stickyTop dw-mod" id="Top"> 1555 @RenderBlockList(subBlocks) 1556 </header> 1557 } 1558 1559 @helper RenderMain() 1560 { 1561 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); 1562 1563 <main class="site dw-mod"> 1564 @RenderBlockList(subBlocks) 1565 </main> 1566 } 1567 1568 @helper RenderPageContent() 1569 { 1570 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 1571 string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; 1572 1573 <div id="Page" class="page @pagePos"> 1574 <section class="center-container content-container dw-mod" id="content"> 1575 1576 @RenderSnippet("Content") 1577 </section> 1578 </div> 1579 } 1580 1581 @* Hack to support nested helpers *@ 1582 @SnippetStart("Content") 1583 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks @functions { BlocksPage page = BlocksPage.GetBlockPage("Page"); } @{ bool isProductPage = HttpContext.Current.Request.QueryString.Get("ProductID") != null; string backgroundColorClass = Model.PropertyItem.GetList("BackgroundColor") != null && !isProductPage ? "u-" + Model.PropertyItem.GetList("BackgroundColor").SelectedValue + "--bg" : ""; string navigationMarkup = ""; Block pageContainer = new Block { Id = "PageContainer", SortId = 10, BlocksList = new List<Block> { new Block { Id = "PageRow", SortId = 20, Design = new Design { RenderType = RenderType.Row } } } }; page.Add(pageContainer); if (Model.PropertyItem.GetList("ShowBreadcrumb") != null && Model.PropertyItem.GetList("ShowBreadcrumb").SelectedValue == "True") { Block breadcrumbNavigation = new Block { Id = "PageBreadcrumbNavigation", SortId = 10, Component = new BreadcrumbNavigation { Id = "breadcrumb", Template = "Breadcrumb.xslt", SitemapMode = true } }; page.Add("PageContainer", breadcrumbNavigation); } if (Model.PropertyItem.GetList("LeftMenu") != null && Model.PropertyItem.GetList("LeftMenu").SelectedValue == "True" && (Pageview.Page.NavigationSettings == null || !Pageview.Page.NavigationSettings.UseEcomGroups)) { navigationMarkup = RenderNavigation(new { id = "leftnav", cssclass = "dwnavigation", startLevel = 2, expandmode = "all", endlevel = 5, template = "LeftNavigation.xslt" }); if (!string.IsNullOrEmpty(navigationMarkup)) { Block leftNavigation = new Block { Id = "PageLeftNavigation", SortId = 10, Component = new LeftNavigation { Id = "leftnav", CssClass = "dwnavigation", StartLevel = 2, EndLevel = 5, Expandmode = "all", Template = "LeftNavigation.xslt" }, Design = new Design { RenderType = RenderType.Column, Size = "3" } }; page.Add("PageRow", leftNavigation); } } string contentColumnSize = !string.IsNullOrEmpty(navigationMarkup) ? "9" : "12"; Block pageContent = new Block { Id = "PageContent", SortId = 20, Design = new Design { RenderType = RenderType.Column, Size = contentColumnSize, CssClass = "grid__col--bleed" }, BlocksList = new List<Block> { new Block { Id = "PageContentRow", SortId = 10, Component = new Text { Content = @Model.Placeholder("dwcontent", "content", "default:true;sort:1") }, Design = new Design { RenderType = RenderType.Row } } } }; page.Add("PageRow", pageContent); } @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using Dynamicweb.Rapido.Blocks @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using Dynamicweb.Rapido.Blocks @{ BlocksPage pageCustomBlocksPage = BlocksPage.GetBlockPage("Page"); } @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ @RenderBlockList(page.BlocksRoot.BlocksList) @* Very small hack to make it cleanly, and easily possible to change the background color on a single page *@ @if (backgroundColorClass != "") { <script> document.getElementById("Page").classList.add("@backgroundColorClass"); </script> } 1584 @SnippetEnd("Content") 1585 1586 </html> 1587 1588