Error executing template "Designs/Rapido/_parsed/BlogArticle.parsed.cshtml"System.NullReferenceException: Object reference not set to an instance of an object.at CompiledRazorTemplates.Dynamic.RazorEngine_c44c21d1291e4292baec61146bf75365.b__149_0(TextWriter __razor_helper_writer) in D:\web\websites\SpaldingTEST\Files\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 6257at RazorEngine.Templating.TemplateWriter.ToString()at System.Lazy`1.CreateValue()at System.Lazy`1.LazyInitValue()at CompiledRazorTemplates.Dynamic.RazorEngine_c44c21d1291e4292baec61146bf75365.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\web\websites\SpaldingTEST\Files\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 223at CompiledRazorTemplates.Dynamic.RazorEngine_c44c21d1291e4292baec61146bf75365.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\web\websites\SpaldingTEST\Files\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 137at CompiledRazorTemplates.Dynamic.RazorEngine_c44c21d1291e4292baec61146bf75365.b__147_0(TextWriter __razor_helper_writer) in D:\web\websites\SpaldingTEST\Files\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 6233at RazorEngine.Templating.TemplateWriter.ToString()at System.Lazy`1.CreateValue()at System.Lazy`1.LazyInitValue()at CompiledRazorTemplates.Dynamic.RazorEngine_c44c21d1291e4292baec61146bf75365.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\web\websites\SpaldingTEST\Files\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 223at CompiledRazorTemplates.Dynamic.RazorEngine_c44c21d1291e4292baec61146bf75365.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\web\websites\SpaldingTEST\Files\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 137at CompiledRazorTemplates.Dynamic.RazorEngine_c44c21d1291e4292baec61146bf75365.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\web\websites\SpaldingTEST\Files\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 245at CompiledRazorTemplates.Dynamic.RazorEngine_c44c21d1291e4292baec61146bf75365.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\web\websites\SpaldingTEST\Files\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 137at CompiledRazorTemplates.Dynamic.RazorEngine_c44c21d1291e4292baec61146bf75365.Execute() in D:\web\websites\SpaldingTEST\Files\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 6213at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.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 18 @functions { 19 BlocksPage masterPage = BlocksPage.GetBlockPage("Master"); 20 21 string getFontFamily(params string[] items) 22 { 23 var itemParent = Pageview.AreaSettings; 24 foreach (var item in items) 25 { 26 itemParent = itemParent.GetItem(item); 27 if (itemParent == null) 28 { 29 return null; 30 } 31 } 32 33 var googleFont = itemParent.GetGoogleFont("FontFamily"); 34 if (googleFont == null) 35 { 36 return null; 37 } 38 return googleFont.Family.Replace(" ", "+"); 39 } 40 } 41 42 @{ 43 //Font settings 44 var fonts = new string[] { 45 getFontFamily("Layout", "HeaderFont"), 46 getFontFamily("Layout", "SubheaderFont"), 47 getFontFamily("Layout", "TertiaryHeaderFont"), 48 getFontFamily("Layout", "Header", "ToolsFont"), 49 getFontFamily("Layout", "Header", "NavigationFont"), 50 getFontFamily("Layout", "MobileNavigation", "Font"), 51 getFontFamily("ProductList", "Facets", "HeaderFont"), 52 getFontFamily("ProductPage", "PriceFontDesign"), 53 getFontFamily("Ecommerce", "SaleSticker", "Font"), 54 getFontFamily("Ecommerce", "NewSticker", "Font"), 55 getFontFamily("Ecommerce", "CustomSticker", "Font") 56 }; 57 58 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks; 59 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png"; 60 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro"); 61 string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css"; 62 if (useFontAwesomePro) 63 { 64 fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css"; 65 } 66 } 67 68 @{ 69 Block master = new Block() 70 { 71 Id = "Master", 72 BlocksList = new List<Block> { 73 new Block { 74 Id = "MasterTopSnippets", 75 SortId = 10 76 }, 77 new Block { 78 Id = "MasterMain", 79 SortId = 20, 80 Template = RenderMain(), 81 SkipRenderBlocksList = true, 82 BlocksList = new List<Block> { 83 new Block { 84 Id = "MasterHeader", 85 SortId = 10, 86 Template = RenderMasterHeader(), 87 SkipRenderBlocksList = true 88 }, 89 new Block { 90 Id = "MasterPageContent", 91 SortId = 20, 92 Template = RenderPageContent() 93 } 94 } 95 }, 96 new Block { 97 Id = "MasterFooter", 98 SortId = 30 99 },100 new Block {101 Id = "MasterReferences",102 SortId = 40103 },104 new Block {105 Id = "MasterBottomSnippets",106 SortId = 50107 }108 }109 };110111 masterPage.Add(master);112 }113114 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@115 @using System.Text.RegularExpressions116 @using System.Collections.Generic117 @using System.Reflection118 @using System.Web.UI.HtmlControls119 @using Dynamicweb.Rapido.Blocks.Components120 @using Dynamicweb.Rapido.Blocks.Components.Articles121 @using Dynamicweb.Rapido.Blocks.Components.Documentation122 @using Dynamicweb.Rapido.Blocks123124125 @*--- START: Base block renderers ---*@126127 @helper RenderBlockList(List<Block> blocks)128 {129 blocks = blocks.OrderBy(item => item.SortId).ToList();130131 foreach (Block item in blocks)132 {133 <!-- START: @item.Id -->134135 if (item.Design == null)136 {137 @RenderBlock(item)138 }139 else if (item.Design.RenderType == RenderType.None) {140 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : "";141142 <div class="@cssClass dw-mod">143 @RenderBlock(item)144 </div>145 }146 else if (item.Design.RenderType != RenderType.Hide)147 {148 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : "";149150 if (!item.SkipRenderBlocksList) {151 if (item.Design.RenderType == RenderType.Row)152 {153 <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id">154 @RenderBlock(item)155 </div>156 }157158 if (item.Design.RenderType == RenderType.Column)159 {160 string hidePadding = item.Design.HidePadding ? "u-no-padding" : "";161 string size = item.Design.Size ?? "12";162 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size;163164 <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">165 @RenderBlock(item)166 </div>167 }168169 if (item.Design.RenderType == RenderType.Table)170 {171 <table class="table @cssClass dw-mod" id="Block__@item.Id">172 @RenderBlock(item)173 </table>174 }175176 if (item.Design.RenderType == RenderType.TableRow)177 {178 <tr class="@cssClass dw-mod" id="Block__@item.Id">179 @RenderBlock(item)180 </tr>181 }182183 if (item.Design.RenderType == RenderType.TableColumn)184 {185 <td class="@cssClass dw-mod" id="Block__@item.Id">186 @RenderBlock(item)187 </td>188 }189190 if (item.Design.RenderType == RenderType.CardHeader)191 {192 <div class="card-header @cssClass dw-mod">193 @RenderBlock(item)194 </div>195 }196197 if (item.Design.RenderType == RenderType.CardBody)198 {199 <div class="card @cssClass dw-mod">200 @RenderBlock(item)201 </div>202 }203204 if (item.Design.RenderType == RenderType.CardFooter)205 {206 <div class="card-footer @cssClass dw-mod">207 @RenderBlock(item)208 </div>209 }210 }211 else212 {213 @RenderBlock(item)214 }215 }216217 <!-- END: @item.Id -->218 }219 }220221 @helper RenderBlock(Block item)222 {223 if (item.Template != null)224 {225 @BlocksPage.RenderTemplate(item.Template)226 }227228 if (item.Component != null)229 {230 string methodName = item.Component.HelperName;231 dynamic[] methodParameters = new dynamic[1];232 methodParameters[0] = item.Component;233 Type methodType = this.GetType();234 MethodInfo generalMethod = methodType.GetMethod(methodName);235236 if (generalMethod != null) {237 @generalMethod.Invoke(this, methodParameters).ToString();238 } else {239 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked");240 }241 }242243 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList)244 {245 @RenderBlockList(item.BlocksList)246 }247 }248249 @*--- END: Base block renderers ---*@250251252 @* Include the components *@253 @using Dynamicweb.Rapido.Blocks.Components254 @using Dynamicweb.Rapido.Blocks.Components.General255 @using Dynamicweb.Rapido.Blocks256257258 @* Components *@259 @using System.Reflection260 @using Dynamicweb.Rapido.Blocks.Components.General261262263 @* Component *@264265 @helper RenderIcon(Icon settings) {266 if (settings != null)267 {268 dynamic[] methodParameters = new dynamic[1];269 methodParameters[0] = settings;270 MethodInfo customMethod = this.GetType().GetMethod("RenderIconCustom");271272 if (customMethod != null)273 {274 @customMethod.Invoke(this, methodParameters).ToString();275 } else {276 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : "";277278 if (settings.Name != null)279 {280 if (String.IsNullOrEmpty(settings.Label)) {281 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i>282 } else {283 if (settings.LabelPosition == IconLabelPosition.Before) {284 <span>@settings.Label <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i></span>285 } else {286 <span><i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> @settings.Label</span>287 }288 }289 }290 }291 }292 }293 @using System.Reflection294 @using Dynamicweb.Rapido.Blocks.Components.General295 @using Dynamicweb.Rapido.Blocks.Components296297298 @* Component *@299300 @helper RenderButton(Button settings) {301 dynamic[] methodParameters = new dynamic[1];302 methodParameters[0] = settings;303 MethodInfo customMethod = this.GetType().GetMethod("RenderButtonCustom");304305 if (customMethod != null)306 {307 @customMethod.Invoke(this, methodParameters).ToString();308 }309 else310 {311 string target;312 string disabled = settings.Disabled ? "disabled" : "";313 string buttonType = settings.ButtonType == ButtonType.Submit ? "submit" : "button";314 buttonType = settings.ButtonType == ButtonType.Reset ? "reset" : buttonType;315 string buttonLayout = settings.ButtonLayout.ToString().ToLower();316317 switch (settings.Target)318 {319 case LinkTargetType.Blank:320 target = "_blank";321 break;322 case LinkTargetType.Parent:323 target = "_parent";324 break;325 case LinkTargetType.Self:326 target = "_self";327 break;328 case LinkTargetType.Top:329 target = "_top";330 break;331 default:332 target = "_self";333 break;334 }335336 string onClickAction = settings.OnClick != null ? settings.OnClick : "";337 string noOpener = target == "_blank" ? "rel=\"noopener\"" : "";338339 if (!String.IsNullOrEmpty(settings.ConfirmText))340 {341 string modalId = settings.Id;342 @RenderConfirmDialog(settings);343 onClickAction = "document.getElementById('" + modalId + "ModalTrigger').checked = true";344 }345346 if (settings.Icon != null)347 {348 if (settings.IconPosition == null) {349 settings.Icon.LabelPosition = IconLabelPosition.After;350 } else {351 settings.Icon.LabelPosition = settings.IconPosition == IconPosition.Before ? IconLabelPosition.After : IconLabelPosition.Before;352 }353 if (settings.Icon.Label == null) {354 settings.Icon.Label = settings.Title;355 }356 }357 string content = settings.Icon == null ? settings.Title : Convert.ToString(RenderIcon(settings.Icon));358359 if (!String.IsNullOrEmpty(settings.Link) && String.IsNullOrEmpty(settings.ConfirmText))360 {361 <a href="@settings.Link" target="@target" @noOpener class="btn btn--@buttonLayout @settings.CssClass @disabled dw-mod" onclick="@onClickAction" @ComponentMethods.AddAttributes(settings.ExtraAttributes) @disabled>@content</a>362 }363 else364 {365 <button type="@buttonType" class="btn btn--@buttonLayout @settings.CssClass @disabled dw-mod" onclick="@onClickAction" @ComponentMethods.AddAttributes(settings.ExtraAttributes) @disabled>@content</button>366 }367 }368 }369370371 @helper RenderConfirmDialog(Button settings) {372 dynamic[] methodParameters = new dynamic[1];373 methodParameters[0] = settings;374 MethodInfo customMethod = this.GetType().GetMethod("RenderConfirmDialogCustom");375376 if (customMethod != null)377 {378 @customMethod.Invoke(this, methodParameters).ToString();379 } else {380 string modalTriggerId = settings.Id + "ModalTrigger";381382 <!-- Trigger for the confirm modal -->383 <input type="checkbox" id="@modalTriggerId" class="modal-trigger" />384385 <!-- Login modal -->386 <div class="modal-container">387 <label for="@modalTriggerId" class="modal-overlay"></label>388 <div class="modal modal--xs">389 <div class="modal__header">390 <h2>@settings.ConfirmText</h2>391 </div>392 <div class="modal__body">393 @RenderButton(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = settings.OnClick, CssClass = "u-full-width", Link = settings.Link })394 </div>395 </div>396 </div>397 }398 }399 @using System.Reflection400 @using Dynamicweb.Rapido.Blocks.Components401 @using Dynamicweb.Rapido.Blocks.Components.General402 @using Dynamicweb.Rapido.Blocks403404405 @* Component *@406407 @helper RenderRating(Rating settings)408 {409 dynamic[] methodParameters = new dynamic[1];410 methodParameters[0] = settings;411 MethodInfo customMethod = this.GetType().GetMethod("RenderRatingCustom");412413 if (customMethod != null)414 {415 @customMethod.Invoke(this, methodParameters).ToString();416 } else {417 if (settings.Score > 0)418 {419 int rating = settings.Score;420 string iconType = "fa-star";421422 switch (settings.Type.ToString()) {423 case "Stars":424 iconType = "fa-star";425 break;426 case "Hearts":427 iconType = "fa-heart";428 break;429 case "Lemons":430 iconType = "fa-lemon";431 break;432 case "Bombs":433 iconType = "fa-bomb";434 break;435 }436437 <div class="u-ta-right">438 @for (int i = 0; i < settings.OutOf; i++)439 {440 <i class="@(rating > i ? "fas" : "far") @iconType"></i>441 }442 </div>443 }444 }445 }446 @using System.Reflection447 @using Dynamicweb.Rapido.Blocks.Components.General448 @using Dynamicweb.Rapido.Blocks.Components449450451 @* Component *@452453 @helper RenderFieldListOption(FieldListOption settings) {454 dynamic[] methodParameters = new dynamic[1];455 methodParameters[0] = settings;456 MethodInfo customMethod = this.GetType().GetMethod("RenderFieldListOptionCustom");457458 if (customMethod != null)459 {460 @customMethod.Invoke(this, methodParameters).ToString();461 } else {462 string disabled = settings.Disabled ? "disabled" : "";463 string selected = settings.Checked ? "checked" : "";464465 if (settings.Type.ToString() == "RadioButton")466 {467 <input class="form__control @disabled dw-mod" onchange="@settings.OnChange" onclick="@settings.OnClick" type="radio" name="@settings.Name" id="@settings.Id" value="@settings.Value" @selected @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes) />468 <label for="@settings.Id" class="u-inline @disabled dw-mod">@settings.Label</label>469 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage })470 }471472 if (settings.Type.ToString() == "Checkbox")473 {474 @RenderCheckboxField(settings)475 }476477 if (settings.Type.ToString() == "SelectOption")478 {479 <option value="@settings.Value" id="@settings.Id" onclick="@settings.OnClick" class="@disabled" @disabled @selected @ComponentMethods.AddAttributes(settings.ExtraAttributes) >@settings.Name</option>480 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage })481 }482 }483 }484485 @using System.Reflection486 @using Dynamicweb.Rapido.Blocks.Components.General487 @using Dynamicweb.Rapido.Blocks.Components488489490 @* Component *@491492 @helper RenderNavigation(Navigation settings) {493 dynamic[] methodParameters = new dynamic[1];494 methodParameters[0] = settings;495 MethodInfo customMethod = this.GetType().GetMethod("RenderNavigationCustom");496497 if (customMethod != null)498 {499 @customMethod.Invoke(this, methodParameters).ToString();500 } else {501 @RenderNavigation(new502 {503 id = settings.Id,504 cssclass = settings.CssClass,505 startLevel = settings.StartLevel,506 endlevel = settings.EndLevel,507 expandmode = settings.Expandmode,508 template = settings.Template509 })510 }511 }512 @using System.Reflection513 @using Dynamicweb.Rapido.Blocks.Components.General514 @using Dynamicweb.Rapido.Blocks.Components515516517 @* Component *@518519 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) {520 dynamic[] methodParameters = new dynamic[1];521 methodParameters[0] = settings;522 MethodInfo customMethod = this.GetType().GetMethod("RenderBreadcrumbNavigationCustom");523524 if (customMethod != null)525 {526 @customMethod.Invoke(this, methodParameters).ToString();527 } else {528 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id;529 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template;530 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel;531 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel;532 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode;533534 @RenderNavigation(settings)535 }536 }537 @using System.Reflection538 @using Dynamicweb.Rapido.Blocks.Components.General539540541 @* Component *@542543 @helper RenderHeading(Heading settings) {544 dynamic[] methodParameters = new dynamic[1];545 methodParameters[0] = settings;546 MethodInfo customMethod = this.GetType().GetMethod("RenderHeadingCustom");547548 if (customMethod != null)549 {550 @customMethod.Invoke(this, methodParameters).ToString();551 } else {552 string startTag = "<h" + settings.Level.ToString() + " class=\"" + settings.CssClass + "\">";553 string endTag = "</h" + settings.Level.ToString() + "\">";554555 if (settings.Icon != null)556 {557 if (settings.IconPosition == null) {558 settings.Icon.LabelPosition = IconLabelPosition.After;559 } else {560 settings.Icon.LabelPosition = settings.IconPosition == IconPosition.Before ? IconLabelPosition.After : IconLabelPosition.Before;561 }562 if (settings.Icon.Label == null) {563 settings.Icon.Label = settings.Title;564 }565566 @startTag@RenderIcon(settings.Icon)@endTag567 } else {568 @startTag@settings.Title@endTag569 }570 }571 }572 @using System.Reflection573 @using Dynamicweb.Rapido.Blocks.Components574 @using Dynamicweb.Rapido.Blocks.Components.General575 @using Dynamicweb.Rapido.Blocks576577578 @* Component *@579580 @helper RenderImage(Image settings)581 {582 if (settings.Path != null)583 {584 dynamic[] methodParameters = new dynamic[1];585 methodParameters[0] = settings;586 MethodInfo customMethod = this.GetType().GetMethod("RenderImageCustom");587588 if (customMethod != null)589 {590 @customMethod.Invoke(this, methodParameters).ToString();591 } else {592 <div>593 @if (settings.Link != null)594 {595 <a href="@settings.Link">596 @RenderTheImage(settings);597 </a>598 }599 else600 {601 @RenderTheImage(settings);602 }603 </div>604 }605 }606 }607608 @functions {609 string getImagePathFromSettings(ImageSettings settings)610 {611 string result = "";612613 if (settings != null)614 {615 result += settings.Width != 0 ? "Width=" + settings.Width + "&" : "";616 result += settings.Height != 0 ? "Height=" + settings.Height + "&" : "";617 result += "Crop=" + settings.Crop + "&";618 result += "Compression=" + settings.Compression + "&";619 result += "DoNotUpscale=" + settings.DoNotUpscale.ToString() + "&";620 result += "FillCanvas=" + settings.FillCanvas.ToString() + "&";621 }622623 return result;624 }625 }626627 @helper RenderTheImage(Image settings)628 {629 if (settings != null)630 {631 dynamic[] methodParameters = new dynamic[1];632 methodParameters[0] = settings;633 MethodInfo customMethod = this.GetType().GetMethod("RenderTheImageCustom");634635 if (customMethod != null)636 {637 @customMethod.Invoke(this, methodParameters).ToString();638 } else {639 string placeholderImage = "/Files/Images/placeholder.gif";640 string imageEngine = "/Admin/Public/GetImage.ashx?";641642 string imageStyle = "";643644 switch (settings.Style)645 {646 case ImageStyle.Ball:647 imageStyle = "grid__cell-img--ball";648 break;649 }650651 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle)652 {653 if (settings.ImageDefault != null)654 {655 settings.ImageDefault.Height = settings.ImageDefault.Width;656 }657 if (settings.ImageMedium != null)658 {659 settings.ImageMedium.Height = settings.ImageMedium.Width;660 }661 if (settings.ImageSmall != null)662 {663 settings.ImageSmall.Height = settings.ImageSmall.Width;664 }665 }666667 string defaultImage = imageEngine;668 string imageSmall = "";669 string imageMedium = "";670671 if (settings.DisableImageEngine) {672 defaultImage = settings.Path;673 } else {674 if (settings.ImageDefault != null)675 {676 defaultImage += getImagePathFromSettings(settings.ImageDefault);677678 if (settings.Path.GetType() != typeof(string))679 {680 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";681 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";682 }683 else684 {685 defaultImage += settings.Path != null ? "Image=" + settings.Path : "";686 }687 }688689 if (settings.ImageSmall != null)690 {691 imageSmall = "data-src-small=\"" + imageEngine;692 imageSmall += getImagePathFromSettings(settings.ImageSmall);693694 if (settings.Path.GetType() != typeof(string))695 {696 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";697 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";698 }699 else700 {701 imageSmall += settings.Path != null ? "Image=" + settings.Path : "";702 }703704 imageSmall += "\"";705 }706707 if (settings.ImageMedium != null)708 {709 imageMedium = "data-src-medium=\"" + imageEngine;710 imageMedium += getImagePathFromSettings(settings.ImageMedium);711712 if (settings.Path.GetType() != typeof(string))713 {714 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";715 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";716 }717 else718 {719 imageMedium += settings.Path != null ? "Image=" + settings.Path : "";720 }721722 imageMedium += "\"";723 }724 }725726 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>();727 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); }728 if (!String.IsNullOrEmpty(settings.Title)) { optionalAttributes.Add("alt", settings.Title); }729730 if (settings.DisableLazyLoad) {731 <img class="grid__cell-img @imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) />732 } else {733 <img class="grid__cell-img b-lazy @imageStyle @settings.CssClass dw-mod" src="@placeholderImage" data-src="@defaultImage" @imageSmall @imageMedium @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) />734 }735736 if (settings.Caption != null)737 {738 <span class="image-caption dw-mod">@settings.Caption</span>739 }740 }741 }742 }743 @using System.Reflection744 @using Dynamicweb.Rapido.Blocks.Components.General745 @using Dynamicweb.Rapido.Blocks.Components746747748 @* Component *@749750 @helper RenderTextField(TextField settings) {751 dynamic[] methodParameters = new dynamic[1];752 methodParameters[0] = settings;753 MethodInfo customMethod = this.GetType().GetMethod("RenderTextFieldCustom");754755 if (customMethod != null)756 {757 @customMethod.Invoke(this, methodParameters).ToString();758 } else {759 int maxLength = settings.MaxLength != 0 ? settings.MaxLength : 524288;760 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>();761 if (settings.Type == TextFieldType.Password) { optionalAttributes.Add("autocomplete", "off"); };762 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); }763 if (!String.IsNullOrEmpty(settings.Placeholder)) { optionalAttributes.Add("placeholder", settings.Placeholder); }764 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); }765 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); }766 if (settings.MaxLength != 0) { optionalAttributes.Add("maxlength", settings.MaxLength.ToString()); }767768 <div class="form__field-group dw-mod">769 @if (!String.IsNullOrEmpty(settings.Label))770 {771 <label for="@settings.Id">@settings.Label</label>772 }773774 <input type="@settings.Type" class="u-full-width @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) />775776 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage })777 </div>778 }779 }780 @using System.Reflection781 @using Dynamicweb.Rapido.Blocks.Components.General782 @using Dynamicweb.Rapido.Blocks.Components783784785 @* Component *@786787 @helper RenderNumberField(NumberField settings) {788 dynamic[] methodParameters = new dynamic[1];789 methodParameters[0] = settings;790 MethodInfo customMethod = this.GetType().GetMethod("RenderNumberFieldCustom");791792 if (customMethod != null)793 {794 @customMethod.Invoke(this, methodParameters).ToString();795 } else {796 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>();797 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); }798 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); }799 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); }800 if (settings.Max != 0) { optionalAttributes.Add("max", settings.Max.ToString()); }801 if (settings.Min != 0) { optionalAttributes.Add("min", settings.Min.ToString()); }802 if (settings.Step != 0) { optionalAttributes.Add("step", settings.Step.ToString()); }803804 <div class="form__field-group dw-mod">805 @if (!String.IsNullOrEmpty(settings.Label))806 {807 <div>808 <label for="@settings.Id">@settings.Label</label>809 </div>810 }811812 <input type="Number" class="u-w70px @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) />813814 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage })815 </div>816 }817 }818 @using System.Reflection819 @using Dynamicweb.Rapido.Blocks.Components.General820 @using Dynamicweb.Rapido.Blocks.Components821822823 @* Component *@824825 @helper RenderTextareaField(TextareaField settings) {826 dynamic[] methodParameters = new dynamic[1];827 methodParameters[0] = settings;828 MethodInfo customMethod = this.GetType().GetMethod("RenderTextareaFieldCustom");829830 if (customMethod != null)831 {832 @customMethod.Invoke(this, methodParameters).ToString();833 } else {834 int maxLength = settings.MaxLength != 0 ? settings.MaxLength : 524288;835 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>();836 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); }837 if (!String.IsNullOrEmpty(settings.Placeholder)) { optionalAttributes.Add("placeholder", settings.Placeholder); }838 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); }839 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); }840 if (settings.MaxLength != 0) { optionalAttributes.Add("maxlength", settings.MaxLength.ToString()); }841 if (settings.Rows != 0) { optionalAttributes.Add("rows", settings.Rows.ToString()); }842843 <div class="form__field-group dw-mod">844 @if (!String.IsNullOrEmpty(@settings.Label))845 {846 <label for="@settings.Id">@settings.Label</label>847 }848849 <textarea class="u-full-width @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)></textarea>850851 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage })852 </div>853 }854 }855 @using System.Reflection856 @using Dynamicweb.Rapido.Blocks.Components.General857 @using Dynamicweb.Rapido.Blocks.Components858859860 @* Component *@861862 @helper RenderHiddenField(HiddenField settings) {863 dynamic[] methodParameters = new dynamic[1];864 methodParameters[0] = settings;865 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom");866867 if (customMethod != null)868 {869 @customMethod.Invoke(this, methodParameters).ToString();870 } else {871 <input type="hidden" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(settings.ExtraAttributes)/>872 }873 }874 @using System.Reflection875 @using Dynamicweb.Rapido.Blocks.Components.General876 @using Dynamicweb.Rapido.Blocks.Components877878879 @* Component *@880881 @helper RenderCheckboxField(dynamic settings) {882 dynamic[] methodParameters = new dynamic[1];883 methodParameters[0] = settings;884 MethodInfo customMethod = this.GetType().GetMethod("RenderCheckboxFieldCustom");885886 if (customMethod != null)887 {888 @customMethod.Invoke(this, methodParameters).ToString();889 } else {890 settings.Type = FieldListOptionType.Checkbox;891 string disabled = settings.Disabled ? "disabled" : "";892 string required = settings.Required ? "required" : "";893 string checkedString = settings.Checked == true ? "checked" : "";894 string id = settings.Id != null ? settings.Id : settings.Label.Replace(" ", "");895896 <div class="form__field-group dw-mod">897 <input type="checkbox" class="form__control @settings.CssClass @disabled dw-mod" name="@settings.Name" id="@id" value="@settings.Value" onclick="@settings.OnClick" @disabled @required @checkedString @ComponentMethods.AddAttributes(settings.ExtraAttributes) />898899 @if (!String.IsNullOrEmpty(settings.Label))900 {901 <label for="@id" class="@disabled dw-mod">@settings.Label</label>902 }903904 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage })905 </div>906 }907 }908 @using System.Reflection909 @using Dynamicweb.Rapido.Blocks.Components.General910 @using Dynamicweb.Rapido.Blocks.Components911912913 @* Component *@914915 @helper RenderCheckboxListField(CheckboxListField settings) {916 dynamic[] methodParameters = new dynamic[1];917 methodParameters[0] = settings;918 MethodInfo customMethod = this.GetType().GetMethod("RenderCheckboxListFieldCustom");919920 if (customMethod != null)921 {922 @customMethod.Invoke(this, methodParameters).ToString();923 } else {924 string disabled = settings.Disabled ? "disabled" : "";925926 <div class="form__field-group @settings.CssClass u-margin-bottom @disabled dw-mod" @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes)>927 @if (!String.IsNullOrEmpty(settings.Label))928 {929 <div class="u-bold u-margin-bottom">@settings.Label</div>930 }931932 @foreach (var item in settings.Options)933 {934 item.Type = FieldListOptionType.Checkbox;935 @RenderFieldListOption(item)936 }937938 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage })939 </div>940 }941 }942943 @using System.Reflection944 @using Dynamicweb.Rapido.Blocks.Components.General945 @using Dynamicweb.Rapido.Blocks.Components946947948 @* Component *@949950 @helper RenderSelectField(SelectField settings) {951 dynamic[] methodParameters = new dynamic[1];952 methodParameters[0] = settings;953 MethodInfo customMethod = this.GetType().GetMethod("RenderSelectFieldCustom");954955 if (customMethod != null)956 {957 @customMethod.Invoke(this, methodParameters).ToString();958 } else {959 string disabled = settings.Disabled ? "disabled" : "";960 string required = settings.Required ? "required" : "";961962 if (settings.Default != null)963 {964 settings.Default.Type = FieldListOptionType.SelectOption;965 }966967 <div class="form__field-group u-full-width dw-mod">968 @if (!String.IsNullOrEmpty(settings.Label))969 {970 <label for="@settings.Id">@settings.Label</label>971 }972973 <div class="form__field-combi u-no-margin dw-mod">974 <select id="@settings.Id" class="u-full-width @settings.CssClass dw-mod" onchange="@settings.OnChange" @ComponentMethods.AddAttributes(settings.ExtraAttributes) >975 @if (settings.Default.Value != null)976 {977 @RenderFieldListOption(settings.Default)978 }979980 @foreach (var item in settings.Options)981 {982 item.Type = FieldListOptionType.SelectOption;983 @RenderFieldListOption(item)984 }985 </select>986 @if (settings.ActionButton.Link != null || settings.ActionButton.OnClick != null) {987 settings.ActionButton.CssClass += " btn--condensed u-no-margin";988 @RenderButton(settings.ActionButton);989 }990 </div>991992 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage })993 </div>994 }995 }996 @using System.Reflection997 @using Dynamicweb.Rapido.Blocks.Components.General998 @using Dynamicweb.Rapido.Blocks.Components99910001001 @* Component *@10021003 @helper RenderRadioButtonField(RadioButtonField settings) {1004 dynamic[] methodParameters = new dynamic[1];1005 methodParameters[0] = settings;1006 MethodInfo customMethod = this.GetType().GetMethod("RenderRadioButtonFieldCustom");10071008 if (customMethod != null)1009 {1010 @customMethod.Invoke(this, methodParameters).ToString();1011 } else {1012 string disabled = settings.Disabled ? "disabled" : "";10131014 <div class="form__field-group @settings.CssClass u-margin-bottom @disabled" @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes)>1015 @if (!String.IsNullOrEmpty(settings.Label))1016 {1017 <div class="u-bold u-margin-bottom">@settings.Label</div>1018 }10191020 @foreach (var item in settings.Options)1021 {1022 item.Type = FieldListOptionType.RadioButton;10231024 if (settings.Name != null)1025 {1026 item.Name = settings.Name;1027 }10281029 if (settings.RenderOptionsInline)1030 {1031 @RenderFieldListOption(item)1032 }1033 else1034 {1035 <div>1036 @RenderFieldListOption(item)1037 </div>1038 }1039 }10401041 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage })1042 </div>1043 }1044 }1045 @using System.Reflection1046 @using Dynamicweb.Rapido.Blocks.Components.General1047 @using Dynamicweb.Rapido.Blocks.Components104810491050 @* Component *@10511052 @helper RenderNotificationMessage(NotificationMessage settings) {1053 dynamic[] methodParameters = new dynamic[1];1054 methodParameters[0] = settings;1055 MethodInfo customMethod = this.GetType().GetMethod("RenderNotificationMessageCustom");10561057 if (customMethod != null)1058 {1059 @customMethod.Invoke(this, methodParameters).ToString();1060 } else {1061 if (!String.IsNullOrEmpty(settings.Message))1062 {1063 string messageTypeClass = settings.MessageType.ToString().ToLower();1064 <div class="field-@messageTypeClass @settings.CssClass u-full-width dw-mod">@settings.Message</div>1065 }1066 }1067 }1068 @using System.Reflection1069 @using Dynamicweb.Rapido.Blocks.Components.General107010711072 @* Component *@10731074 @helper RenderHandlebarsRoot(HandlebarsRoot settings) {1075 dynamic[] methodParameters = new dynamic[1];1076 methodParameters[0] = settings;1077 MethodInfo customMethod = this.GetType().GetMethod("RenderHandlebarsRootCustom");10781079 if (customMethod != null)1080 {1081 @customMethod.Invoke(this, methodParameters).ToString();1082 } else {1083 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : "";10841085 <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>1086 @if (settings.SubBlocks != null) {1087 @RenderBlockList(settings.SubBlocks)1088 }1089 </div>1090 }1091 }1092 @using System.Reflection1093 @using Dynamicweb.Rapido.Blocks.Components.General1094 @using Dynamicweb.Rapido.Blocks.Components1095 @using System.Text.RegularExpressions109610971098 @* Component *@10991100 @helper RenderSticker(Sticker settings) {1101 dynamic[] methodParameters = new dynamic[1];1102 methodParameters[0] = settings;1103 MethodInfo customMethod = this.GetType().GetMethod("RenderStickerCustom");11041105 if (customMethod != null)1106 {1107 @customMethod.Invoke(this, methodParameters).ToString();1108 }1109 else1110 {1111 if (!String.IsNullOrEmpty(settings.Title)) {1112 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : "";1113 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : "";11141115 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>();1116 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) {1117 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : "";1118 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : "";1119 optionalAttributes.Add("style", styleTag);1120 }11211122 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div>1123 }1124 }1125 }11261127 @using System.Reflection1128 @using Dynamicweb.Rapido.Blocks.Components.General1129 @using Dynamicweb.Rapido.Blocks.Components113011311132 @* Component *@11331134 @helper RenderStickersCollection(StickersCollection settings) {1135 dynamic[] methodParameters = new dynamic[1];1136 methodParameters[0] = settings;1137 MethodInfo customMethod = this.GetType().GetMethod("RenderStickersCollectionCustom");11381139 if (customMethod != null)1140 {1141 @customMethod.Invoke(this, methodParameters).ToString();1142 }1143 else1144 {1145 if (settings.Stickers.Count > 0) {1146 string position = settings.Position != null ? "" + "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower() : "";11471148 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>1149 @foreach (Sticker sticker in settings.Stickers)1150 {1151 @RenderSticker(sticker)1152 }1153 </div>1154 }1155 }1156 }11571158 @using System.Reflection1159 @using Dynamicweb.Rapido.Blocks.Components.General1160 @using Dynamicweb.Rapido.Blocks.Components1161116211631164 @* Component *@11651166 @helper RenderField(Field settings) {1167 dynamic[] methodParameters = new dynamic[1];1168 methodParameters[0] = settings;1169 MethodInfo customMethod = this.GetType().GetMethod("RenderFieldCustom");11701171 if (customMethod != null)1172 {1173 @customMethod.Invoke(this, methodParameters).ToString();1174 } else {1175 switch (settings.FieldType)1176 {1177 case FieldType.Checkbox:1178 CheckboxField checkbox = new CheckboxField1179 {1180 Label = settings.Label,1181 Id = settings.Id,1182 Name = settings.Label.Replace(" ", ""),1183 Value = settings.Value,1184 Checked = Convert.ToBoolean(settings.Placeholder),1185 OnClick = settings.OnClick,1186 Disabled = settings.Disabled,1187 Required = settings.Required,1188 CssClass = settings.CssClass,1189 ExtraAttributes = settings.ExtraAttributes,1190 ErrorMessage = settings.ErrorMessage1191 };11921193 @RenderCheckboxField(checkbox)1194 break;1195 case FieldType.Email:1196 TextField emailField = new TextField1197 {1198 Label = settings.Label != null ? settings.Label : Translate("Email"),1199 Id = settings.Id,1200 Value = settings.Value,1201 OnClick = settings.OnClick,1202 Disabled = settings.Disabled,1203 Required = settings.Required,1204 CssClass = settings.CssClass,1205 ExtraAttributes = settings.ExtraAttributes,1206 ErrorMessage = settings.ErrorMessage,1207 Placeholder = settings.Placeholder,1208 Type = TextFieldType.Email1209 };12101211 @RenderTextField(emailField)1212 break;1213 case FieldType.Hidden:1214 HiddenField hiddenField = new HiddenField1215 {1216 Label = settings.Label,1217 Id = settings.Id,1218 Value = settings.Value,1219 Disabled = settings.Disabled,1220 Required = settings.Required,1221 CssClass = settings.CssClass,1222 ExtraAttributes = settings.ExtraAttributes,1223 ErrorMessage = settings.ErrorMessage1224 };12251226 @RenderHiddenField(hiddenField)1227 break;1228 case FieldType.Integer:1229 NumberField numberField = new NumberField1230 {1231 Label = settings.Label,1232 Id = settings.Id,1233 Value = settings.Value.GetType() == typeof(int) ? Convert.ToInt32(settings.Value) : 1,1234 OnClick = settings.OnClick,1235 Disabled = settings.Disabled,1236 Required = settings.Required,1237 CssClass = settings.CssClass,1238 ExtraAttributes = settings.ExtraAttributes,1239 ErrorMessage = settings.ErrorMessage,1240 Step = 11241 };12421243 @RenderNumberField(numberField)1244 break;1245 case FieldType.Password:1246 TextField passwordField = new TextField1247 {1248 Label = settings.Label != null ? settings.Label : Translate("Password"),1249 Id = settings.Id,1250 Value = settings.Value,1251 OnClick = settings.OnClick,1252 Disabled = settings.Disabled,1253 Required = settings.Required,1254 CssClass = settings.CssClass,1255 ExtraAttributes = settings.ExtraAttributes,1256 ErrorMessage = settings.ErrorMessage,1257 Placeholder = settings.Placeholder,1258 Type = TextFieldType.Password1259 };12601261 @RenderTextField(passwordField)1262 break;1263 case FieldType.Reset:1264 Button resetField = new Button1265 {1266 Title = settings.Label != null ? settings.Label : Translate("Reset"),1267 Id = settings.Id,1268 OnClick = settings.OnClick,1269 Disabled = settings.Disabled,1270 CssClass = settings.CssClass,1271 ExtraAttributes = settings.ExtraAttributes,1272 ButtonLayout = ButtonLayout.Secondary,1273 ButtonType = ButtonType.Reset1274 };12751276 @RenderButton(resetField)1277 break;1278 case FieldType.Submit:1279 Button submitField = new Button1280 {1281 Title = settings.Label != null ? settings.Label : Translate("Submit"),1282 Id = settings.Id,1283 OnClick = settings.OnClick,1284 Disabled = settings.Disabled,1285 CssClass = settings.CssClass,1286 ExtraAttributes = settings.ExtraAttributes,1287 ButtonLayout = ButtonLayout.Primary,1288 ButtonType = ButtonType.Submit1289 };12901291 @RenderButton(submitField)1292 break;1293 case FieldType.Tel:1294 TextField telField = new TextField1295 {1296 Label = settings.Label != null ? settings.Label : Translate("Phone"),1297 Id = settings.Id,1298 Value = settings.Value,1299 OnClick = settings.OnClick,1300 Disabled = settings.Disabled,1301 Required = settings.Required,1302 CssClass = settings.CssClass,1303 ExtraAttributes = settings.ExtraAttributes,1304 ErrorMessage = settings.ErrorMessage,1305 Placeholder = settings.Placeholder,1306 Type = TextFieldType.Tel1307 };13081309 @RenderTextField(telField)1310 break;1311 case FieldType.Text:1312 TextField textField = new TextField1313 {1314 Label = settings.Label,1315 Id = settings.Id,1316 Value = settings.Value,1317 OnClick = settings.OnClick,1318 Disabled = settings.Disabled,1319 Required = settings.Required,1320 CssClass = settings.CssClass,1321 ExtraAttributes = settings.ExtraAttributes,1322 ErrorMessage = settings.ErrorMessage,1323 Placeholder = settings.Placeholder,1324 Type = TextFieldType.Text1325 };13261327 @RenderTextField(textField)1328 break;1329 case FieldType.Textarea:1330 TextareaField textareaField = new TextareaField1331 {1332 Label = settings.Label,1333 Id = settings.Id,1334 Value = settings.Value,1335 OnClick = settings.OnClick,1336 Disabled = settings.Disabled,1337 Required = settings.Required,1338 CssClass = settings.CssClass,1339 ExtraAttributes = settings.ExtraAttributes,1340 ErrorMessage = settings.ErrorMessage,1341 Placeholder = settings.Placeholder1342 };13431344 @RenderTextareaField(textareaField)1345 break;1346 default:1347 TextField defaultField = new TextField1348 {1349 Label = settings.Label,1350 Id = settings.Id,1351 Value = settings.Value,1352 OnClick = settings.OnClick,1353 Disabled = settings.Disabled,1354 Required = settings.Required,1355 CssClass = settings.CssClass,1356 ExtraAttributes = settings.ExtraAttributes,1357 ErrorMessage = settings.ErrorMessage,1358 Placeholder = settings.Placeholder,1359 Type = TextFieldType.Text1360 };13611362 @RenderTextField(defaultField)1363 break;1364 }1365 }1366 }136713681369 @using Dynamicweb.Frontend1370 @using System.Reflection1371 @using Dynamicweb.Content.Items1372 @using System.Web.UI.HtmlControls1373 @using Dynamicweb.Rapido.Blocks.Components1374 @using Dynamicweb.Rapido.Blocks137513761377 @* Components for the articles *@1378 @using System.Reflection1379 @using Dynamicweb.Rapido.Blocks.Components.Articles138013811382 @* Component for the articles *@13831384 @helper RenderArticleBanner(dynamic settings) {1385 dynamic[] methodParameters = new dynamic[1];1386 methodParameters[0] = settings;1387 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerCustom");13881389 if (customMethod != null)1390 {1391 @customMethod.Invoke(this, methodParameters).ToString();1392 } else {1393 string filterClasses = "image-filter image-filter--darken";1394 settings.Layout = ArticleHeaderLayout.Banner;13951396 if (settings.Image != null)1397 {1398 if (settings.Image.Path != null)1399 {1400 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width">1401 <div class="background-image @filterClasses dw-mod">1402 <div class="background-image__wrapper @filterClasses dw-mod">1403 @{1404 settings.Image.CssClass += "background-image__cover dw-mod";1405 }1406 @RenderImage(settings.Image)1407 </div>1408 </div>1409 <div class="center-container dw-mod">1410 <div class="grid">1411 <div class="grid__col-md-8 grid__col-xs-12 paragraph-container paragraph-container--height-lg">1412 <div class="u-left-middle">1413 <div>1414 @if (!String.IsNullOrEmpty(settings.Heading))1415 {1416 <h1 class="article__header article__header--giant dw-mod" style="color: @settings.TextColor">@settings.Heading</h1>1417 }1418 @if (!String.IsNullOrEmpty(settings.Subheading))1419 {1420 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div>1421 }1422 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))1423 {1424 <small class="article__post-info u-margin-bottom--lg dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small>1425 }1426 @if (!String.IsNullOrEmpty(settings.Link)) {1427 <div class="grid__cell">1428 @RenderButton(new Button { Link= settings.Link, Title= settings.LinkText, ButtonLayout= settings.ButtonLayout })1429 </div>1430 }1431 </div>1432 </div>1433 </div>1434 @if (settings.ExternalParagraphId != 0)1435 {1436 <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod">1437 <div class="u-color-light-gray--bg u-color-dark dw-mod">1438 @RenderParagraphContent(settings.ExternalParagraphId)1439 </div>1440 </div>1441 }1442 </div>1443 </div>1444 </section>1445 }1446 else1447 {1448 settings.Layout = ArticleHeaderLayout.Clean;1449 @RenderArticleCleanHeader(settings);1450 }1451 }1452 else1453 {1454 settings.Layout = ArticleHeaderLayout.Clean;1455 @RenderArticleCleanHeader(settings);1456 }1457 }1458 }1459 @using System.Reflection1460 @using Dynamicweb.Rapido.Blocks.Components1461 @using Dynamicweb.Rapido.Blocks.Components.General1462 @using Dynamicweb.Rapido.Blocks.Components.Articles1463 @using Dynamicweb.Rapido.Blocks146414651466 @* Component for the articles *@14671468 @helper RenderArticleHeader(ArticleHeader settings) {1469 dynamic[] methodParameters = new dynamic[1];1470 methodParameters[0] = settings;1471 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleHeaderCustom");14721473 if (customMethod != null)1474 {1475 @customMethod.Invoke(this, methodParameters).ToString();1476 } else {1477 switch (settings.Layout)1478 {1479 case ArticleHeaderLayout.Clean:1480 @RenderArticleCleanHeader(settings);1481 break;1482 case ArticleHeaderLayout.Split:1483 @RenderArticleSplitHeader(settings);1484 break;1485 case ArticleHeaderLayout.Banner:1486 @RenderArticleBannerHeader(settings);1487 break;1488 case ArticleHeaderLayout.Overlay:1489 @RenderArticleOverlayHeader(settings);1490 break;1491 default:1492 @RenderArticleCleanHeader(settings);1493 break;1494 }1495 }1496 }14971498 @helper RenderArticleCleanHeader(ArticleHeader settings) {1499 dynamic[] methodParameters = new dynamic[1];1500 methodParameters[0] = settings;1501 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom");15021503 if (customMethod != null)1504 {1505 @customMethod.Invoke(this, methodParameters).ToString();1506 }1507 else1508 {1509 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12";15101511 <div class="grid grid--align-content-start grid--justify-start">1512 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod">1513 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0)1514 {1515 <div class="u-border-bottom u-padding-bottom">1516 @if (!String.IsNullOrEmpty(settings.Category))1517 {1518 <div class="u-pull--left">1519 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div>1520 </div>1521 }1522 <div class="u-pull--right">1523 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))1524 {1525 <small class="article__post-info dw-mod">@settings.Author @settings.Date</small>1526 }1527 @if (settings.RatingOutOf != 0)1528 {1529 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })1530 }1531 </div>1532 </div>1533 }15341535 <div class="grid__cell">1536 @if (!String.IsNullOrEmpty(settings.Heading))1537 {1538 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1>1539 }1540 @if (settings.Image != null)1541 {1542 if (settings.Image.Path != null)1543 {1544 <div class="u-padding-bottom--lg">1545 @RenderImage(settings.Image)1546 </div>1547 }1548 }1549 @if (!String.IsNullOrEmpty(settings.Subheading))1550 {1551 <div class="article__leadtext dw-mod">@settings.Subheading</div>1552 }1553 @if (!String.IsNullOrEmpty(settings.Link))1554 {1555 <div class="grid__cell">1556 @RenderButton(new Button { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })1557 </div>1558 }1559 </div>1560 </div>1561 @if (settings.ExternalParagraphId != 0)1562 {1563 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod">1564 @RenderParagraphContent(settings.ExternalParagraphId)1565 </div>1566 }1567 </div>1568 }1569 }15701571 @helper RenderArticleSplitHeader(ArticleHeader settings) {1572 dynamic[] methodParameters = new dynamic[1];1573 methodParameters[0] = settings;1574 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSplitHeaderCustom");15751576 if (customMethod != null)1577 {1578 @customMethod.Invoke(this, methodParameters).ToString();1579 }1580 else1581 {1582 string headerColumnWidth = settings.ExternalParagraphId != 0 ? "4" : "6";15831584 if (settings.Image != null)1585 {1586 if (settings.Image.Path != null)1587 {1588 <section class="multiple-paragraphs-container paragraph-container--full-width">1589 <div class="grid">1590 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod">1591 <div class="u-left-middle u-padding--lg">1592 <div>1593 @if (!String.IsNullOrEmpty(settings.Category))1594 {1595 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div>1596 }1597 @if (!String.IsNullOrEmpty(settings.Heading))1598 {1599 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1>1600 }1601 @if (!String.IsNullOrEmpty(settings.Subheading))1602 {1603 <div class="article__leadtext dw-mod">@settings.Subheading</div>1604 }1605 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))1606 {1607 <small class="article__post-info u-pull--left dw-mod">@settings.Author @settings.Date</small>1608 }1609 @if (settings.RatingOutOf != 0)1610 {1611 <div class="u-pull--right">1612 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })1613 </div>1614 }1615 @if (!String.IsNullOrEmpty(settings.Link)) {1616 @RenderButton(new Button { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })1617 }1618 </div>1619 </div>1620 </div>1621 <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>1622 @if (settings.ExternalParagraphId != 0)1623 {1624 <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">1625 @RenderParagraphContent(settings.ExternalParagraphId)1626 </div>1627 }1628 </div>1629 </section>1630 }1631 }1632 else1633 {1634 @RenderArticleCleanHeader(settings);1635 }1636 }1637 }16381639 @helper RenderArticleOverlayHeader(ArticleHeader settings) {1640 dynamic[] methodParameters = new dynamic[1];1641 methodParameters[0] = settings;1642 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleOverlayHeaderCustom");16431644 if (customMethod != null)1645 {1646 @customMethod.Invoke(this, methodParameters).ToString();1647 }1648 else1649 {1650 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12";1651 string contentAlignment = settings.TextLayout == ArticleHeaderTextLayout.Center ? "grid--justify-center" : "";16521653 if (settings.Image != null)1654 {1655 if (settings.Image.Path != null)1656 {1657 if (settings.ExternalParagraphId == 0)1658 {1659 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width">1660 <div class="background-image image-filter image-filter--darken dw-mod">1661 <div class="background-image__wrapper image-filter image-filter--darken dw-mod">1662 @{1663 settings.Image.CssClass += "background-image__cover dw-mod";1664 }1665 @RenderImage(settings.Image)1666 </div>1667 </div>1668 <div class="center-container dw-mod">1669 <div class="grid @contentAlignment">1670 <div class="grid__col-md-@contentColumns grid__col-xs-12 paragraph-container paragraph-container--height-xl u-no-padding dw-mod">1671 @if (!String.IsNullOrEmpty(settings.Heading))1672 {1673 <h1 class="article__header article__header--giant u-padding-top--lg dw-mod" style="color: @settings.TextColor">@settings.Heading</h1>1674 }1675 @if (!String.IsNullOrEmpty(settings.Subheading))1676 {1677 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div>1678 }1679 <div class="u-margin-top">1680 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))1681 {1682 <small class="article__post-info u-pull--left dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small>1683 }1684 @if (settings.RatingOutOf != 0)1685 {1686 <div class="u-pull--right">1687 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })1688 </div>1689 }1690 </div>1691 @if (!String.IsNullOrEmpty(settings.Link))1692 {1693 <div class="grid__cell">1694 @RenderButton(new Button { Link= settings.Link, Title= settings.LinkText, ButtonLayout= settings.ButtonLayout })1695 </div>1696 }1697 </div>1698 </div>1699 </div>1700 </section>1701 }1702 else1703 {1704 @RenderArticleBanner(settings);1705 }1706 }1707 }1708 else1709 {1710 @RenderArticleCleanHeader(settings);1711 }1712 }1713 }17141715 @helper RenderArticleBannerHeader(dynamic settings) {1716 dynamic[] methodParameters = new dynamic[1];1717 methodParameters[0] = settings;1718 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerHeaderCustom");17191720 if (customMethod != null)1721 {1722 @customMethod.Invoke(this, methodParameters).ToString();1723 }1724 else1725 {1726 @RenderArticleBanner(settings);1727 }1728 }1729 @using System.Reflection1730 @using System.Text.RegularExpressions;1731 @using Dynamicweb.Frontend1732 @using Dynamicweb.Content.Items1733 @using Dynamicweb.Rapido.Blocks.Components1734 @using Dynamicweb.Rapido.Blocks.Components.Articles1735 @using Dynamicweb.Rapido.Blocks17361737 @* Component for the articles *@17381739 @helper RenderArticleBodyRow(ArticleBodyRow settings)1740 {1741 dynamic[] methodParameters = new dynamic[1];1742 methodParameters[0] = settings;1743 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBodyRowCustom");17441745 if (customMethod != null)1746 {1747 @customMethod.Invoke(this, methodParameters).ToString();1748 } else {1749 string position = settings.TopLayout == "overlay" ? "article__overlay-offset" : "";1750 string contentAlignment = settings.TextLayout == "center" ? "grid--justify-center" : "";17511752 <div class="grid grid--align-content-start @contentAlignment @position dw-mod">1753 @RenderBlockList(settings.SubBlocks)1754 </div>1755 }1756 }1757 @using System.Reflection1758 @using Dynamicweb.Rapido.Blocks.Components1759 @using Dynamicweb.Rapido.Blocks.Components.General1760 @using Dynamicweb.Rapido.Blocks.Components.Articles1761 @using Dynamicweb.Rapido.Blocks17621763 @* Component for the articles *@17641765 @helper RenderArticleImage(ArticleImage settings)1766 {1767 dynamic[] methodParameters = new dynamic[1];1768 methodParameters[0] = settings;1769 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleImageCustom");17701771 if (customMethod != null)1772 {1773 @customMethod.Invoke(this, methodParameters).ToString();1774 }1775 else1776 {1777 if (settings.Image != null)1778 {1779 if (settings.Image.Path != null)1780 {1781 <div class="u-margin-bottom--lg">1782 @RenderImage(settings.Image)1783 </div>1784 }1785 }1786 }1787 }1788 @using System.Reflection1789 @using Dynamicweb.Rapido.Blocks.Components1790 @using Dynamicweb.Rapido.Blocks.Components.Articles179117921793 @* Component for the articles *@17941795 @helper RenderArticleSubHeader(ArticleSubHeader settings)1796 {1797 dynamic[] methodParameters = new dynamic[1];1798 methodParameters[0] = settings;1799 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSubHeaderCustom");18001801 if (customMethod != null)1802 {1803 @customMethod.Invoke(this, methodParameters).ToString();1804 } else {1805 if (!String.IsNullOrEmpty(settings.Title))1806 {1807 <h2 class="article__header">@settings.Title</h2>1808 }1809 }1810 }1811 @using System.Reflection1812 @using Dynamicweb.Rapido.Blocks.Components1813 @using Dynamicweb.Rapido.Blocks.Components.Articles1814 @using Dynamicweb.Rapido.Blocks181518161817 @* Component for the articles *@18181819 @helper RenderArticleText(ArticleText settings)1820 {1821 dynamic[] methodParameters = new dynamic[1];1822 methodParameters[0] = settings;1823 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleTextCustom");18241825 if (customMethod != null)1826 {1827 @customMethod.Invoke(this, methodParameters).ToString();1828 } else {1829 if (!String.IsNullOrEmpty(settings.Text))1830 {1831 string greatTextClass = settings.EnableLargeText == true ? "article__paragraph--great-text" : "";18321833 <div class="article__paragraph @greatTextClass">1834 @settings.Text1835 </div>1836 }1837 }1838 }1839 @using System.Reflection1840 @using Dynamicweb.Rapido.Blocks.Components1841 @using Dynamicweb.Rapido.Blocks.Components.Articles1842 @using Dynamicweb.Rapido.Blocks184318441845 @* Component for the articles *@18461847 @helper RenderArticleQuote(ArticleQuote settings)1848 {1849 dynamic[] methodParameters = new dynamic[1];1850 methodParameters[0] = settings;1851 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleQuoteCustom");18521853 if (customMethod != null)1854 {1855 @customMethod.Invoke(this, methodParameters).ToString();1856 } else {1857 string text = Regex.Replace(settings.Text, "<.*?>", String.Empty);18581859 <div class="grid u-padding-bottom--lg">1860 @if (settings.Image != null)1861 {1862 if (settings.Image.Path != null) {1863 <div class="grid__col-3">1864 <div class="grid__cell-img">1865 @{1866 settings.Image.Title = !String.IsNullOrEmpty(settings.Image.Title) ? settings.Image.Title : settings.Author;1867 settings.Image.CssClass += " article__image article__image--ball";1868 settings.Image.ImageDefault.Width = 200;1869 settings.Image.ImageDefault.Height = 200;1870 }1871 @RenderImage(settings.Image)1872 </div>1873 </div>1874 }1875 }1876 <div class="grid__col-auto">1877 @if (!String.IsNullOrEmpty(settings.Text))1878 {1879 <div class="article__quote dw-mod">1880 <i class="fas fa-quote-right u-margin-bottom--lg"></i>1881 @settings.Text1882 <i class="fas fa-quote-right"></i>1883 </div>1884 }1885 @if (!String.IsNullOrEmpty(settings.Author))1886 {1887 <div class="article__quote-author dw-mod">1888 - @settings.Author1889 </div>1890 }1891 </div>1892 </div>1893 }1894 }1895 @using System.Reflection1896 @using Dynamicweb.Rapido.Blocks.Components1897 @using Dynamicweb.Rapido.Blocks.Components.Articles1898 @using Dynamicweb.Rapido.Blocks18991900 @* Component for the articles *@19011902 @helper RenderArticleInfoTable(ArticleInfoTable settings)1903 {1904 dynamic[] methodParameters = new dynamic[1];1905 methodParameters[0] = settings;1906 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleInfoTableCustom");19071908 if (customMethod != null)1909 {1910 @customMethod.Invoke(this, methodParameters).ToString();1911 } else {1912 <table class="table table--clean">1913 @foreach (var row in settings.Rows)1914 {1915 string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two";19161917 <tr>1918 @if (!String.IsNullOrEmpty(row.Icon))1919 {1920 <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td>1921 }1922 <td class="u-no-margin-on-p-elements">1923 <div class="u-bold">@row.Title</div>1924 @if (!String.IsNullOrEmpty(row.SubTitle))1925 {1926 if (row.Link == null)1927 {1928 <div>@row.SubTitle</div>1929 }1930 else1931 {1932 <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a>1933 }1934 }1935 </td>1936 </tr>1937 }1938 </table>1939 }1940 }1941 @using System.Reflection1942 @using Dynamicweb.Rapido.Blocks.Components1943 @using Dynamicweb.Rapido.Blocks.Components.Articles1944 @using Dynamicweb.Rapido.Blocks19451946 @* Component for the articles *@19471948 @helper RenderArticleGalleryModal(ArticleGalleryModal settings)1949 {1950 dynamic[] methodParameters = new dynamic[1];1951 methodParameters[0] = settings;1952 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom");19531954 if (customMethod != null)1955 {1956 @customMethod.Invoke(this, methodParameters).ToString();1957 }1958 else1959 {1960 <input type="checkbox" id="ParagraphGalleryTrigger" class="modal-trigger" />1961 <div class="modal-container">1962 <label for="ParagraphGalleryTrigger" id="ParagraphGalleryOverlay" class="modal-overlay"></label>1963 <div class="modal modal--full" id="ParagraphGallery">1964 <div class="modal__body modal__body--full">1965 <img src="/Files/Images/placeholder.gif" alt="" id="ParagraphGalleryModalImage" style="margin: 0 auto;" />1966 <div class="u-padding u-ta-center" id="ParagraphGalleryModalCaption"></div>1967 <label class="modal__close-btn dw-mod" for="ParagraphGalleryTrigger"></label>1968 </div>1969 </div>1970 </div>1971 <script>1972 function showImageInModal(image) {1973 let imageNode = document.getElementById('ParagraphGalleryModalImage');1974 let captionNode = document.getElementById('ParagraphGalleryModalCaption');1975 let trigger = document.getElementById('ParagraphGalleryTrigger');1976 imageNode.src = image.src;1977 if (image.alt != "") {1978 captionNode.innerText = image.alt;1979 imageNode.alt = image.alt;1980 captionNode.style.display = "block";1981 } else {1982 captionNode.style.display = "none";1983 }1984 trigger.checked = true;1985 }1986 </script>1987 }1988 }1989 @using System.Reflection1990 @using Dynamicweb.Rapido.Blocks.Components1991 @using Dynamicweb.Rapido.Blocks.Components.Articles1992 @using Dynamicweb.Rapido.Blocks199319941995 @* Component for the articles *@19961997 @helper RenderArticleRelated(ArticleRelated settings)1998 {1999 string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : "";2000 string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : "";20012002 <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width">2003 <div class="center-container dw-mod">2004 <div class="grid u-padding">2005 <div class="grid__col-md-12 grid__col-xs-12">2006 <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2>2007 </div>2008 </div>20092010 <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>20112012 <script id="RelatedSimpleTemplate" type="text/x-template">2013 {{#.}}2014 <div class="grid u-padding-bottom--lg">2015 {{#Cases}}2016 <div class="grid__col-3 image-hover--zoom dw-mod">2017 <a href="{{link}}" class="u-full-height u-color-light--bg">2018 {{#if image}}2019 <div class="u-color-light--bg u-no-padding dw-mod">2020 <div class="flex-img image-hover__wrapper">2021 <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}}" />2022 </div>2023 </div>2024 {{/if}}20252026 <div class="card u-color-light--bg dw-mod">2027 <h3 class="article-list__item-header u-truncate-text dw-mod">{{title}}</h3>2028 <p class="article__short-summary dw-mod">{{summary}}</p>2029 </div>2030 </a>2031 </div>2032 {{/Cases}}2033 </div>2034 {{/.}}2035 </script>2036 </div>2037 </section>2038 }2039 @using System.Reflection2040 @using Dynamicweb.Rapido.Blocks.Components2041 @using Dynamicweb.Rapido.Blocks.Components.Articles2042 @using Dynamicweb.Rapido.Blocks204320442045 @* Component for the articles *@20462047 @helper RenderArticleMenu(ArticleMenu settings)2048 {2049 dynamic[] methodParameters = new dynamic[1];2050 methodParameters[0] = settings;2051 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleMenuCustom");20522053 if (customMethod != null)2054 {2055 @customMethod.Invoke(this, methodParameters).ToString();2056 } else {2057 if (!String.IsNullOrEmpty(settings.Title)) {2058 <div class="u-margin u-border-bottom">2059 <h3 class="u-no-margin">@settings.Title</h3>2060 </div>2061 }20622063 <ul class="menu-left u-margin-bottom dw-mod">2064 @foreach (var item in settings.Items)2065 {2066 @RenderArticleMenuItem(item)2067 }2068 </ul>2069 }2070 }20712072 @helper RenderArticleMenuItem(ArticleMenuItem settings)2073 {2074 dynamic[] methodParameters = new dynamic[1];2075 methodParameters[0] = settings;2076 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleMenuItemCustom");20772078 if (customMethod != null)2079 {2080 @customMethod.Invoke(this, methodParameters).ToString();2081 } else {2082 string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#";20832084 if (!String.IsNullOrEmpty(settings.Title)) {2085 <li class="menu-left__item dw-mod">2086 <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a>2087 </li>2088 }2089 }2090 }2091 @using System.Reflection2092 @using Dynamicweb.Rapido.Blocks.Components2093 @using Dynamicweb.Rapido.Blocks.Components.Articles2094 @using Dynamicweb.Rapido.Blocks20952096 @* Component for the articles *@20972098 @helper RenderArticleList(ArticleList settings)2099 {2100 dynamic[] methodParameters = new dynamic[1];2101 methodParameters[0] = settings;2102 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListCustom");21032104 if (customMethod != null)2105 {2106 @customMethod.Invoke(this, methodParameters).ToString();2107 } else {2108 if (Pageview != null)2109 {2110 bool isParagraph = Pageview.CurrentParagraph != null ? true : false;2111 string[] sortArticlesListBy = new string[2];21122113 if (isParagraph) {2114 sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" };2115 }2116 else {2117 sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" };2118 }21192120 string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString();21212122 @RenderItemList(new2123 {2124 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle",2125 ListSourceType = settings.SourceType,2126 ListSourcePage = sourcePage,2127 ItemFieldsList = "*",2128 Filter = settings.Filter,2129 ListOrderBy = sortArticlesListBy[0],2130 ListOrderByDirection = sortArticlesListBy[1],2131 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date",2132 ListSecondOrderByDirection = "ASC",2133 IncludeAllChildItems = true,2134 ListTemplate = settings.Template,2135 ListPageSize = settings.PageSize.ToString()2136 });2137 }2138 }2139 }2140 @using System.Reflection2141 @using Dynamicweb.Rapido.Blocks.Components.Articles214221432144 @* Component for the articles *@21452146 @helper RenderArticleSummary(ArticleSummary settings)2147 {2148 dynamic[] methodParameters = new dynamic[1];2149 methodParameters[0] = settings;2150 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSummaryCustom");21512152 if (customMethod != null)2153 {2154 @customMethod.Invoke(this, methodParameters).ToString();2155 } else {2156 if (!String.IsNullOrEmpty(settings.Text))2157 {2158 <div class="article__summary dw-mod">@settings.Text</div>2159 }2160 }2161 }2162 @using System.Reflection2163 @using Dynamicweb.Rapido.Blocks.Components2164 @using Dynamicweb.Rapido.Blocks.Components.Articles2165 @using Dynamicweb.Rapido.Blocks21662167 @* Component for the articles *@21682169 @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings)2170 {2171 dynamic[] methodParameters = new dynamic[1];2172 methodParameters[0] = settings;2173 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListCategoryFilterCustom");21742175 if (customMethod != null)2176 {2177 @customMethod.Invoke(this, methodParameters).ToString();2178 } else {2179 string pageId = Pageview.ID.ToString();2180 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All");2181 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString());21822183 foreach (var option in settings.Categories)2184 {2185 selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter;2186 }21872188 if (selectedFilter == pageId)2189 {2190 selectedFilter = Translate("All");2191 }21922193 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")2194 {2195 <div class="u-pull--right u-margin-left">2196 <div class="collection u-no-margin">2197 <h5>@Translate("Category")</h5>2198 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" />2199 <div class="dropdown u-w180px dw-mod">2200 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label>2201 <div class="dropdown__content dw-mod">2202 @foreach (var option in settings.Categories)2203 {2204 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div>2205 }2206 </div>2207 <label class="dropdown-trigger-off" for="CategorySelector"></label>2208 </div>2209 </div>2210 </div>2211 }2212 else2213 {2214 <div class="u-full-width u-margin-bottom">2215 <h5 class="u-no-margin">@Translate("Category")</h5>2216 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" />2217 <div class="dropdown u-full-width dw-mod">2218 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label>2219 <div class="dropdown__content dw-mod">2220 @foreach (var option in settings.Categories)2221 {2222 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div>2223 }2224 </div>2225 <label class="dropdown-trigger-off" for="CategorySelector"></label>2226 </div>2227 </div>2228 }2229 }2230 }2231 @using System.Reflection2232 @using Dynamicweb.Rapido.Blocks.Components2233 @using Dynamicweb.Rapido.Blocks.Components.Articles2234 @using Dynamicweb.Rapido.Blocks22352236 @* Component for the articles *@22372238 @helper RenderArticleListFilter(ArticleListFilter settings)2239 {2240 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All");2241 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString());22422243 if (settings.Options != null)2244 {2245 foreach (var option in settings.Options)2246 {2247 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter;2248 }22492250 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")2251 {2252 <div class="u-pull--right u-margin-left">2253 <div class="collection u-no-margin">2254 <h5>@settings.Label</h5>2255 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" />2256 <div class="dropdown u-w180px dw-mod">2257 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label>2258 <div class="dropdown__content dw-mod">2259 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div>2260 @foreach (var option in settings.Options)2261 {2262 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div>2263 }2264 </div>2265 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label>2266 </div>2267 </div>2268 </div>2269 }2270 else2271 {2272 <div class="u-full-width u-margin-bottom">2273 <h5 class="u-no-margin">@settings.Label</h5>2274 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" />2275 <div class="dropdown u-full-width w-mod">2276 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label>2277 <div class="dropdown__content dw-mod">2278 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div>2279 @foreach (var option in settings.Options)2280 {2281 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div>2282 }2283 </div>2284 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label>2285 </div>2286 </div>2287 }2288 }2289 }2290 @using System.Reflection2291 @using Dynamicweb.Rapido.Blocks.Components2292 @using Dynamicweb.Rapido.Blocks.Components.Articles2293 @using Dynamicweb.Rapido.Blocks22942295 @* Component for the articles *@22962297 @helper RenderArticleListSearch(ArticleListSearch settings)2298 {2299 dynamic[] methodParameters = new dynamic[1];2300 methodParameters[0] = settings;2301 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListSearchCustom");23022303 if (customMethod != null)2304 {2305 @customMethod.Invoke(this, methodParameters).ToString();2306 } else {2307 string searchString = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("Title")) ? HttpContext.Current.Request.QueryString.Get("Title").Trim('*') : "";2308 string className = "u-w340px u-pull--right u-margin-left";23092310 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet")2311 {2312 className = "u-full-width";2313 }23142315 <div class="typeahead u-color-inherit u-margin-bottom dw-mod @className">2316 <input type="text" class="typeahead-search-field u-no-margin dw-mod" placeholder="@Translate("Search in list")" value="@searchString" id="ArticleListSearchInput" onchange="QueryArray.setParameterInCurrentURL('Title', '*' + document.getElementById('ArticleListSearchInput').value + '*')">2317 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button>2318 </div>2319 }2320 }2321 @using System.Reflection2322 @using Dynamicweb.Rapido.Blocks.Components2323 @using Dynamicweb.Rapido.Blocks.Components.Articles2324 @using Dynamicweb.Rapido.Blocks23252326 @* Component for the articles *@23272328 @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings)2329 {2330 dynamic[] methodParameters = new dynamic[1];2331 methodParameters[0] = settings;2332 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListNoResultsInfoCustom");23332334 if (customMethod != null)2335 {2336 @customMethod.Invoke(this, methodParameters).ToString();2337 } else {2338 <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div>2339 }2340 }2341 @using System.Reflection2342 @using Dynamicweb.Rapido.Blocks.Components2343 @using Dynamicweb.Rapido.Blocks.Components.General2344 @using Dynamicweb.Rapido.Blocks.Components.Articles2345 @using Dynamicweb.Rapido.Blocks2346 @using System.Text.RegularExpressions23472348 @* Component for the articles *@23492350 @helper RenderArticleListItem(ArticleListItem settings)2351 {2352 switch (settings.Type) {2353 case ArticleListItemType.Card:2354 @RenderArticleListItemCard(settings);2355 break;2356 case ArticleListItemType.List:2357 @RenderArticleListItemList(settings);2358 break;2359 case ArticleListItemType.Simple:2360 @RenderArticleListItemSimple(settings);2361 break;2362 default:2363 @RenderArticleListItemCard(settings);2364 break;2365 }2366 }23672368 @helper RenderArticleListItemCard(ArticleListItem settings) {2369 <a href="@settings.Link" class="u-full-height u-color-light--bg">2370 <div class="u-color-light--bg u-no-padding dw-mod">2371 @if (settings.Logo != null)2372 {2373 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;" : "";2374 settings.Logo.ImageDefault.Crop = 5;2375 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width;2376 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height;2377 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage">2378 @if (settings.Stickers != null)2379 {2380 if (settings.Stickers.Position != StickersListPosition.Custom)2381 {2382 @RenderStickersCollection(settings.Stickers);2383 }2384 }2385 @RenderImage(settings.Logo)2386 </div>2387 } else if (settings.Image != null)2388 {2389 <div class="flex-img image-hover__wrapper u-position-relative dw-mod">2390 @if (settings.Stickers != null)2391 {2392 if (settings.Stickers.Position != StickersListPosition.Custom)2393 {2394 @RenderStickersCollection(settings.Stickers);2395 }2396 }2397 @RenderImage(settings.Image)2398 </div>2399 }2400 </div>24012402 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary))2403 {2404 <div class="card u-color-light--bg dw-mod">2405 @if (settings.Stickers != null)2406 {2407 if (settings.Stickers.Position == StickersListPosition.Custom)2408 {2409 @RenderStickersCollection(settings.Stickers);2410 }2411 }2412 @if (!String.IsNullOrEmpty(settings.Title))2413 {2414 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3>2415 }2416 @if (!String.IsNullOrEmpty(settings.SubTitle))2417 {2418 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>2419 }2420 @if (!String.IsNullOrEmpty(settings.Summary))2421 {2422 <p class="article__short-summary dw-mod">@settings.Summary</p>2423 }2424 </div>2425 }2426 </a>2427 }24282429 @helper RenderArticleListItemList(ArticleListItem settings) {2430 <a href="@settings.Link">2431 <div class="grid u-color-light--bg u-no-padding dw-mod">2432 <div class="grid__col-md-3">2433 <div class="u-color-light--bg u-no-padding dw-mod">2434 @if (settings.Logo != null)2435 {2436 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;" : "";2437 settings.Logo.ImageDefault.Crop = 5;2438 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width;2439 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height;2440 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage">2441 @if (settings.Stickers != null)2442 {2443 if (settings.Stickers.Position != StickersListPosition.Custom)2444 {2445 @RenderStickersCollection(settings.Stickers);2446 }2447 }2448 @RenderImage(settings.Logo)2449 </div>2450 } else if (settings.Image != null)2451 {2452 <div class="flex-img image-hover__wrapper dw-mod">2453 @if (settings.Stickers != null)2454 {2455 if (settings.Stickers.Position != StickersListPosition.Custom)2456 {2457 @RenderStickersCollection(settings.Stickers);2458 }2459 }2460 @RenderImage(settings.Image)2461 </div>2462 }2463 </div>2464 </div>24652466 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary))2467 {2468 <div class="grid__col-md-9">2469 @if (!String.IsNullOrEmpty(settings.Title))2470 {2471 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3>2472 }2473 @if (settings.Stickers != null)2474 {2475 if (settings.Stickers.Position == StickersListPosition.Custom)2476 {2477 @RenderStickersCollection(settings.Stickers);2478 }2479 }2480 @if (!String.IsNullOrEmpty(settings.SubTitle))2481 {2482 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>2483 }2484 @if (!String.IsNullOrEmpty(settings.Summary))2485 {2486 <p class="article__short-summary dw-mod">@settings.Summary</p>2487 }2488 </div>2489 }2490 </div>2491 </a>2492 }24932494 @helper RenderArticleListItemSimple(ArticleListItem settings) {2495 <a href="@settings.Link" class="u-color-inherit">2496 <div class="grid u-color-light--bg u-no-padding dw-mod">2497 <div class="grid__col-md-12">2498 @if (!String.IsNullOrEmpty(settings.Title))2499 {2500 <div class="article-list-item__header u-truncate-text u-no-margin dw-mod">@settings.Title</div>2501 }2502 @if (!String.IsNullOrEmpty(settings.SubTitle))2503 {2504 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>2505 }2506 </div>2507 </div>2508 </a>2509 }2510 @using System.Reflection2511 @using Dynamicweb.Rapido.Blocks.Components.Articles251225132514 @* Component for the articles *@25152516 @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings)2517 {2518 dynamic[] methodParameters = new dynamic[1];2519 methodParameters[0] = settings;2520 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleAuthorAndDateCustom");25212522 if (customMethod != null)2523 {2524 @customMethod.Invoke(this, methodParameters).ToString();2525 } else {2526 <small class="article__subscription">2527 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date)))2528 {2529 <text>@Translate("Written")</text>2530 }2531 @if (!string.IsNullOrWhiteSpace(settings.Author))2532 {2533 <text>@Translate("by") @settings.Author</text>2534 }2535 @if (!string.IsNullOrWhiteSpace(settings.Date))2536 {2537 <text>@Translate("on") @settings.Date</text>2538 }2539 </small>2540 }2541 }2542 @using System.Reflection2543 @using Dynamicweb.Rapido.Blocks.Components.Articles254425452546 @* Component for the articles *@25472548 @helper RenderArticleLink(ArticleLink settings)2549 {2550 dynamic[] methodParameters = new dynamic[1];2551 methodParameters[0] = settings;2552 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleLinkCustom");25532554 if (customMethod != null)2555 {2556 @customMethod.Invoke(this, methodParameters).ToString();2557 } else {2558 if (!String.IsNullOrEmpty(settings.Title))2559 {2560 <div class="grid__cell">2561 @RenderButton(settings)2562 </div>2563 }2564 }2565 }2566 @using System.Reflection2567 @using Dynamicweb.Rapido.Blocks2568 @using Dynamicweb.Rapido.Blocks.Components.Articles2569 @using Dynamicweb.Rapido.Blocks.Components.General257025712572 @* Component for the articles *@25732574 @helper RenderArticleCarousel(ArticleCarousel settings)2575 {2576 dynamic[] methodParameters = new dynamic[1];2577 methodParameters[0] = settings;2578 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom");25792580 if (customMethod != null)2581 {2582 @customMethod.Invoke(this, methodParameters).ToString();2583 } else {2584 <div class="grid">2585 <div class="grid__col-12">2586 <div class="carousel" id="carousel_@settings.Id">2587 <div class="carousel__container js-carousel-slides dw-mod">2588 @RenderBlockList(settings.SubBlocks)2589 </div>2590 </div>2591 </div>2592 </div>25932594 <script>2595 document.addEventListener("DOMContentLoaded", function () {2596 new CarouselModule("#carousel_@settings.Id", {2597 slideTime: 0,2598 dots: true2599 });2600 });2601 </script>2602 }2603 }26042605 @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings)2606 {2607 dynamic[] methodParameters = new dynamic[1];2608 methodParameters[0] = settings;2609 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom");26102611 if (customMethod != null)2612 {2613 @customMethod.Invoke(this, methodParameters).ToString();2614 }2615 else2616 {2617 string imageEngine = "/Admin/Public/GetImage.ashx?";26182619 string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image;2620 if (settings.ImageSettings != null)2621 {2622 defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : "";2623 defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : "";2624 defaultImage += "Crop=" + settings.ImageSettings.Crop + "&";2625 defaultImage += "Compression=" + settings.ImageSettings.Compression + "&";2626 defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&";2627 defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&";2628 }2629 defaultImage += "&Image=" + settings.Image;26302631 <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')">2632 <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title">2633 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2>2634 <div class="article-list__item-info">2635 @if (settings.Stickers != null)2636 {2637 settings.Stickers.Position = StickersListPosition.Custom;2638 @RenderStickersCollection(settings.Stickers);2639 }26402641 <small class="u-margin-top--lg u-color-light">2642 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date)))2643 {2644 <text>@Translate("Written")</text>2645 }2646 @if (!string.IsNullOrWhiteSpace(settings.Author))2647 {2648 <text>@Translate("by") @settings.Author</text>2649 }2650 @if (!string.IsNullOrWhiteSpace(settings.Date))2651 {2652 <text>@Translate("on") @settings.Date</text>2653 }2654 </small>2655 </div>26562657 <h3 class="article__short-summary u-color-light">@settings.Summary</h3>2658 </a>2659 @if (settings.UseFilters == true)2660 {2661 <div class="background-image image-filter image-filter--darken dw-mod"></div>2662 }2663 </div>2664 }2665 }2666 @using System.Text.RegularExpressions2667 @using Dynamicweb.Rapido.Blocks.Components2668 @using Dynamicweb.Rapido.Blocks.Components.General2669 @using Dynamicweb.Rapido.Blocks.Components.Articles2670 @using Dynamicweb.Rapido.Blocks26712672 @* Component for the articles *@26732674 @helper RenderArticleVideo(ArticleVideo settings)2675 {2676 dynamic[] methodParameters = new dynamic[1];2677 methodParameters[0] = settings;2678 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleTextCustom");26792680 if (customMethod != null)2681 {2682 @customMethod.Invoke(this, methodParameters).ToString();2683 } else {2684 if (settings.Url != null)2685 {2686 //getting video ID from youtube URL2687 string videoCode = settings.Url;2688 Regex regex = new Regex(@".be\/(.[^?]*)");2689 Match match = regex.Match(videoCode);2690 string videoId = "";2691 if (match.Success)2692 {2693 videoId = match.Groups[1].Value;2694 }2695 else2696 {2697 regex = new Regex(@"v=([^&]+)");2698 match = regex.Match(videoCode);2699 if (match.Success)2700 {2701 videoId = match.Groups[1].Value;2702 }2703 }27042705 int autoPlay = settings.AutoPlay == "true" ? 1 : 0;27062707 <div class="video-wrapper">2708 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div>2709 </div>2710 }2711 }2712 }2713271427152716 @* Simple helpers *@27172718 @*Requires the Gallery ItemType that comes with Rapido*@2719 @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) {2720 if (gallery != null && gallery.Count > 0)2721 {2722 int count = 1;27232724 foreach (var item in gallery)2725 {2726 if (item.GetFile("ImagePath") != null)2727 {2728 string image = item.GetFile("ImagePath").PathUrlEncoded;2729 string imagePrefix = "/Admin/Public/GetImage.ashx?width=1200&amp;height=820&amp;crop=5&amp;Compression=75&amp;DoNotUpscale=1&amp;image=";2730 int imagesCount = gallery.Count;27312732 if (count == 1)2733 {2734 <label class="gallery" for="GalleryModalTrigger" onclick="Gallery.openImage(this.querySelector('.js-gallery'))">2735 <span class="gallery__main-image">2736 <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="FullImage" data-image="@imagePrefix@image" />2737 </span>2738 <span class="gallery__image-counter">2739 <i class="fas fa-camera fa-2x"></i> <span class="gallery__image-counter__number">@imagesCount</span>2740 <span class="gallery__image-counter__text">@Translate("See all") <i class="fas fa-angle-right"></i></span>2741 </span>2742 </label>2743 }2744 else2745 {2746 <div class="u-hidden js-gallery" data-for="FullImage" data-image="@imagePrefix@image"></div>2747 }27482749 count++;2750 }2751 }2752 }2753 }27542755 @helper RenderArticleItemGalleryModal() {2756 <!-- Trigger for the gallery modal -->2757 <input type="checkbox" id="GalleryModalTrigger" class="modal-trigger" />27582759 <!-- Gallery modal -->2760 <div class="modal-container">2761 <label for="GalleryModalTrigger" id="GalleryModalOverlay" class="modal-overlay"></label>2762 <div class="modal modal--full" id="GalleryModal">2763 <div class="modal__body modal__body--full">2764 <div class="gallery-slider">2765 <div class="gallery-slider__image">2766 <img src="#" alt="" class="modal--full__img" id="FullImage" />2767 </div>2768 <div class="gallery-slider__image-counter" id="FullImage_counter"></div>2769 <label class="gallery-slider__close-btn" for="GalleryModalTrigger"></label>2770 <button class="gallery-slider__previous-btn" id="FullImage_prev" onclick="Gallery.prevImage('FullImage')"></button>2771 <button class="gallery-slider__next-btn" id="FullImage_next" onclick="Gallery.nextImage('FullImage')"></button>2772 </div>2773 </div>2774 </div>2775 </div>2776 }277727782779 @helper RenderMobileFilters(List<Block> subBlocks)2780 {2781 if (subBlocks.Count > 0)2782 {2783 <div class="grid__col-12">2784 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" />2785 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters">2786 @RenderBlockList(subBlocks)2787 </div>2788 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label>2789 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label>2790 </div>2791 }2792 }27932794 @if (File.Exists(HttpContext.Current.Server.MapPath("/Components/Custom/Custom__Components.cshtml")))2795 {2796 <text>@using Dynamicweb.Rapido.Blocks.Components.General2797 </text>2798 }279928002801 @* Include the Blocks for the page *@2802 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>28032804 @using System2805 @using System.Web2806 @using System.Collections.Generic2807 @using Dynamicweb.Rapido.Blocks.Extensibility2808 @using Dynamicweb.Rapido.Blocks28092810 @{2811 BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master");28122813 Block tagManager = new Block()2814 {2815 Id = "TagManager",2816 SortId = 1,2817 Template = RenderGoogleTagManager()2818 };28192820 Block facebookPixel = new Block()2821 {2822 Id = "FacebookPixel",2823 SortId = 2,2824 Template = RenderFacebookPixel()2825 };28262827 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManager);2828 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel);2829 }28302831 @helper RenderGoogleTagManager() {2832 string GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID");28332834 if (!string.IsNullOrWhiteSpace(GoogleTagManagerID))2835 {2836 <script>2837 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':2838 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],2839 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=2840 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);2841 })(window,document,'script','dataLayer','@GoogleTagManagerID');2842 </script>2843 <!-- Google Tag Manager (noscript) -->2844 <noscript>2845 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID"2846 height="0" width="0" style="display:none;visibility:hidden"></iframe>2847 </noscript>2848 <!-- End Google Tag Manager (noscript) -->2849 }2850 }28512852 @helper RenderFacebookPixel() {2853 string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID");28542855 if (!string.IsNullOrWhiteSpace(FacebookPixelID))2856 {2857 <!-- Facebook Pixel Code -->2858 <script>2859 !function(f,b,e,v,n,t,s)2860 {if(f.fbq)return;n=f.fbq=function(){n.callMethod?2861 n.callMethod.apply(n,arguments):n.queue.push(arguments)};2862 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';2863 n.queue=[];t=b.createElement(e);t.async=!0;2864 t.src=v;s=b.getElementsByTagName(e)[0];2865 s.parentNode.insertBefore(t,s)}(window, document,'script',2866 'https://connect.facebook.net/en_US/fbevents.js');2867 fbq('init', '@FacebookPixelID');2868 fbq('track', 'PageView');2869 </script>2870 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript>2871 }2872 }2873 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>28742875 @using System2876 @using System.Web2877 @using System.Collections.Generic2878 @using Dynamicweb.Rapido.Blocks2879 @using Dynamicweb.Rapido.Blocks.Extensibility2880 @using Dynamicweb.Security.UserManagement2881 @using Dynamicweb.Security.UserManagement.ExternalAuthentication2882 @{2883 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master");28842885 Block loginModal = new Block()2886 {2887 Id = "LoginModal",2888 SortId = 10,2889 Template = LoginModal()2890 };2891 Block signUpModal = new Block()2892 {2893 Id = "SignUpModal",2894 SortId = 11,2895 Template = SignUpModal()28962897 };28982899 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal);2900 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, signUpModal);2901 }29022903 @helper LoginModal()2904 {2905 int pageId = Model.TopPage.ID;2906 string userSignedInError = !Model.LogOnFailed ? "" : "checked";2907 string userSignedInErrorText = "";2908 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");2909 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery";2910 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");29112912 if (Model.LogOnFailed)2913 {2914 switch (Model.LogOnFailedReason)2915 {2916 case LogOnFailedReason.PasswordLengthInvalid:2917 userSignedInErrorText = Translate("Password length is invalid");2918 break;2919 case LogOnFailedReason.IncorrectLogin:2920 userSignedInErrorText = Translate("Invalid email or password");2921 break;2922 case LogOnFailedReason.ExceededFailedLogOnLimit:2923 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked");2924 break;2925 case LogOnFailedReason.LoginLocked:2926 userSignedInErrorText = Translate("The user account is temporarily locked");2927 break;2928 case LogOnFailedReason.PasswordExpired:2929 userSignedInErrorText = Translate("The password has expired and needs to be renewed");2930 break;2931 default:2932 userSignedInErrorText = Translate("An unknown error occured");2933 break;2934 }2935 }29362937 <!-- Trigger for the login modal -->2938 <input type="checkbox" id="SignInModalTrigger" class="modal-trigger" @userSignedInError />29392940 <!-- Login modal -->2941 <div class="modal-container">2942 <label for="SignInModalTrigger" id="SignInModalOverlay" class="modal-overlay"></label>2943 <div class="modal modal--xs" id="SignInModal">2944 <div class="modal__header">2945 <h2>@Translate("Sign in")</h2>2946 </div>2947 <div class="modal__body">2948 <form method="post" id="LoginForm" class="u-no-margin">2949 <input type="hidden" name="ID" value="@pageId" />2950 <input type="hidden" name="DWExtranetUsernameRemember" value="True" />2951 <input type="hidden" name="DWExtranetPasswordRemember" value="True" />2952 <input type="text" class="u-full-width" id="LoginUsername" name="username" placeholder="@Translate("Email")" />2953 <input type="password" class="u-full-width" id="LoginPassword" name="password" placeholder="@Translate("Password")" />2954 <div class="field-error dw-mod">@userSignedInErrorText</div>29552956 <div class="form__field-group dw-mod">2957 <input type="checkbox" id="LoginRememberMe" name="Autologin" checked="checked" value="True" class="form__control">2958 <label for="LoginRememberMe">2959 @Translate("Remember me", "Remember me")2960 </label>2961 </div>29622963 <button type="submit" class="btn btn--primary btn--full dw-mod" name="LoginAction" value="Login" onclick="Buttons.LockButton(event)">@Translate("Sign in")</button>2964 @{2965 ProviderCollection providers = Provider.GetActiveProviders();2966 }29672968 @foreach (Provider LoginProvider in providers)2969 {2970 var ProviderName = LoginProvider.Name.ToLower();2971 <a href="/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=@LoginProvider.ID" title="@LoginProvider.Name" class="btn btn--clean btn--condensed u-color-@ProviderName dw-mod"><i class="fab fa-@ProviderName fa-1_5x"></i></a>2972 }29732974 <a class="btn btn--link-clean dw-mod" href="@forgotPasswordPageLink">@Translate("Forgot your password?", "Forgot your password?")</a>29752976 @*<a class="btn btn--link-clean dw-mod" href="/default.aspx?ID=@createAccountPageId">@Translate("Create account")?</a>*@2977 </form>2978 </div>2979 </div>2980 </div>2981 }2982 @helper SignUpModal()2983 {2984 int pageId = Model.TopPage.ID;2985 string userSignedInError = !Model.LogOnFailed ? "" : "checked";2986 string userSignedInErrorText = "";2987 int signInProfilePageId = GetPageIdByNavigationTag("signinpage");2988 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery";2989 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");299029912992 if (Model.LogOnFailed)2993 {2994 switch (Model.LogOnFailedReason)2995 {2996 case LogOnFailedReason.PasswordLengthInvalid:2997 userSignedInErrorText = Translate("Password length is invalid");2998 break;2999 case LogOnFailedReason.IncorrectLogin:3000 userSignedInErrorText = Translate("Invalid email or password");3001 break;3002 case LogOnFailedReason.ExceededFailedLogOnLimit:3003 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked");3004 break;3005 case LogOnFailedReason.LoginLocked:3006 userSignedInErrorText = Translate("The user account is temporarily locked");3007 break;3008 case LogOnFailedReason.PasswordExpired:3009 userSignedInErrorText = Translate("The password has expired and needs to be renewed");3010 break;3011 default:3012 userSignedInErrorText = Translate("An unknown error occured");3013 break;3014 }3015 }3016 <input type="checkbox" id="SignupModalTrigger" class="modal-trigger" /><!-- Login modal --><div class="modal-container">3017 <label for="SignupModalTrigger" id="SignUpModalOverlay" class="modal-overlay"></label>3018 <div class="modal modal--s" id="SignUpModal">3019 @if (Pageview.AreaSettings.GetItem("Custom").GetInt32("SignUpParagraphID") > 0)3020 {3021 <div>3022 @RenderParagraphContent(Pageview.AreaSettings.GetItem("Custom").GetInt32("SignUpParagraphID"))3023 </div>3024 }3025 </div>3026 </div>30273028 }302930303031 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet")3032 {3033 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>30343035 @using System3036 @using System.Web3037 @using System.Collections.Generic3038 @using Dynamicweb.Rapido.Blocks.Extensibility3039 @using Dynamicweb.Rapido.Blocks3040 @using Dynamicweb.Security.UserManagement30413042 @functions {3043 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master");3044 }30453046 @{3047 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";3048 bool hideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");3049 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart");3050 bool hideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn");305130523053 Block mobileHeader = new Block()3054 {3055 Id = "MobileTop",3056 SortId = 10,3057 Template = RenderMobileTop(),3058 SkipRenderBlocksList = true3059 };3060 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader);30613062 Block mobileHeaderNavigation = new Block()3063 {3064 Id = "MobileHeaderNavigation",3065 SortId = 10,3066 Template = RenderMobileHeaderNavigation(),3067 SkipRenderBlocksList = true,3068 BlocksList = new List<Block> {3069 new Block {3070 Id = "MobileHeaderNavigationTrigger",3071 SortId = 10,3072 Template = RenderMobileHeaderNavigationTrigger()3073 }3074 }3075 };3076 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation);307730783079 Block mobileHeaderLogo = new Block()3080 {3081 Id = "MobileHeaderLogo",3082 SortId = 20,3083 Template = RenderMobileHeaderLogo(),3084 SkipRenderBlocksList = true3085 };3086 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo);30873088 Block mobileHeaderActions = new Block()3089 {3090 Id = "MobileHeaderActions",3091 SortId = 30,3092 Template = RenderMobileTopActions(),3093 SkipRenderBlocksList = true3094 };3095 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions);30963097 if (hideSearch == false)3098 {3099 Block mobileHeaderSearch = new Block3100 {3101 Id = "MobileHeaderSearch",3102 SortId = 10,3103 Template = RenderMobileTopSearch()3104 };3105 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch);3106 }31073108 Block mobileHeaderMiniCart;31093110 if (!hideCart)3111 {3112 mobileHeaderMiniCart = new Block3113 {3114 Id = "MobileHeaderMiniCart",3115 SortId = 20,3116 Template = RenderMobileTopMiniCart()3117 };31183119 Block miniCartCounterScriptTemplate = new Block3120 {3121 Id = "MiniCartCounterScriptTemplate",3122 Template = RenderMobileMiniCartCounterContent()3123 };3124 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate);3125 } else {3126 mobileHeaderMiniCart = new Block3127 {3128 Id = "MobileHeaderMiniCart",3129 SortId = 203130 };3131 }31323133 if (!hideSearch) {3134 Block mobileHeaderSearchBar = new Block()3135 {3136 Id = "MobileHeaderSearchBar",3137 SortId = 30,3138 Template = RenderMobileTopSearchBar()3139 };3140 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar);3141 }31423143 switch (mobileTopLayout)3144 {3145 case "nav-left":3146 mobileHeaderNavigation.SortId = 10;3147 mobileHeaderLogo.SortId = 20;3148 mobileHeaderActions.SortId = 30;3149 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart);3150 break;3151 case "nav-right":3152 mobileHeaderLogo.SortId = 10;3153 mobileHeaderActions.SortId = 20;3154 mobileHeaderNavigation.SortId = 30;3155 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart);3156 break;3157 case "nav-search-left":3158 mobileHeaderNavigation.SortId = 10;3159 mobileHeaderLogo.SortId = 20;3160 mobileHeaderActions.SortId = 30;3161 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart);3162 break;3163 case "search-left":3164 mobileHeaderActions.SortId = 10;3165 mobileHeaderLogo.SortId = 20;3166 mobileHeaderNavigation.SortId = 30;3167 mobileHeaderMiniCart.SortId = 0;3168 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart);3169 break;3170 }3171 }317231733174 @helper RenderMobileTop() {3175 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList();31763177 <nav class="main-navigation-mobile dw-mod">3178 <div class="center-container top-container__center-container dw-mod">3179 <div class="grid grid--align-center">3180 @RenderBlockList(subBlocks)3181 </div>3182 </div>3183 </nav>3184 }31853186 @helper RenderMobileHeaderNavigation() {3187 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList();31883189 <div class="grid__col-auto-width">3190 <ul class="menu dw-mod">3191 @RenderBlockList(subBlocks)3192 </ul>3193 </div>3194 }31953196 @helper RenderMobileHeaderNavigationTrigger() {3197 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">3198 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label>3199 </li>3200 }32013202 @helper RenderMobileHeaderLogo() {3203 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList();32043205 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";3206 string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : "";3207 string firstPageId = Model.Area.FirstActivePage.ID.ToString();3208 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName");3209 int currentUserID = Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUserId();3210 string currentUserName ="";3211 if (currentUserID != 0) {3212 User currentUser = Dynamicweb.Security.UserManagement.User.GetUserByID(currentUserID);3213 currentUserName = currentUser.UserName.ToString();3214 }321532163217 string mobileLogo = "/Files/Images/logo-dynamicweb.png";3218 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null)3219 {3220 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded;3221 }32223223 if (Path.GetExtension(mobileLogo).ToLower() != ".svg")3224 {3225 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&amp;crop=5&amp;Compression=75&amp;image=" + mobileLogo;3226 }3227 else3228 {3229 mobileLogo = HttpUtility.UrlDecode(mobileLogo);3230 }32313232 <div class="grid__col-auto grid__col--bleed">3233 <div class="grid__cell @centeredLogo">3234 <a href="/Default.aspx?ID=@firstPageId" class="logo logo--mobile u-inline-block dw-mod">3235 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" />3236 </a>32373238 @if (Pageview.User != null && Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet")3239 {3240 <a href="/Default.aspx?ID=2207" class="dw-mod u-block">3241 <span>3242 @currentUserName3243 </span>3244 </a>3245 }3246 </div>32473248 @RenderBlockList(subBlocks)3249 </div>3250 }32513252 @helper RenderMobileTopActions() {3253 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList();32543255 <div class="grid__col-auto-width">3256 <ul class="menu dw-mod">3257 @RenderBlockList(subBlocks)3258 </ul>3259 </div>3260 }32613262 @helper RenderMobileTopSearch() {3263 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">3264 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod">3265 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i>3266 </label>3267 </li>3268 }32693270 @helper RenderMobileTopMiniCart() {3271 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");3272 int cartPageId = GetPageIdByNavigationTag("CartPage");3273 double cartProductsCount = Model.Cart.TotalProductsCount;32743275 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper" onmouseenter="Cart.UpdateMiniCart('miniCartWrapper', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')">3276 <div class="mini-cart dw-mod">3277 <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">3278 <div class="u-inline u-position-relative">3279 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i>3280 <div class="mini-cart__counter dw-mod">3281 <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">3282 <div class="js-mini-cart-counter-content">3283 @cartProductsCount3284 </div>3285 </div>3286 </div>3287 </div>3288 </a>3289 @if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")3290 {3291 <div class="mini-cart-dropdown js-handlebars-root js-mini-cart dw-mod" id="miniCart" data-template="MiniCartContent" data-cart-id="@miniCartFeedPageId" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div>3292 }3293 </div>3294 </li>3295 }32963297 @helper RenderMobileTopSearchBar()3298 {3299 string searchFeedId = "";3300 string searchSecondFeedId = "";3301 int groupsFeedId;3302 int productsPageId = GetPageIdByNavigationTag("ProductsPage");3303 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;3304 string resultPageLink;3305 string searchPlaceholder;3306 string searchType = "product-search";3307 string searchTemplate;3308 string searchContentTemplate = "";3309 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? "";3310 bool showGroups = true;33113312 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch")3313 {3314 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true";3315 resultPageLink = contentSearchPageLink;3316 searchPlaceholder = Translate("Search page");3317 groupsFeedId = 0;3318 searchType = "content-search";3319 searchTemplate = "SearchPagesTemplate";3320 showGroups = false;3321 }3322 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch")3323 {3324 searchFeedId = productsPageId + "&feed=true";3325 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true";3326 resultPageLink = Converter.ToString(productsPageId);3327 searchPlaceholder = Translate("Search products or pages");3328 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed");3329 searchType = "combined-search";3330 searchTemplate = "SearchProductsTemplateWrap";3331 searchContentTemplate = "SearchPagesTemplateWrap";3332 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector");3333 }3334 else3335 {3336 resultPageLink = Converter.ToString(productsPageId);3337 searchFeedId = productsPageId + "&feed=true";3338 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed");3339 searchPlaceholder = Translate("Search products");3340 searchTemplate = "SearchProductsTemplate";3341 searchType = "product-search";3342 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector");3343 }334433453346 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" />33473348 <div class="main-navigation-mobile typeahead-mobile dw-mod">3349 <div class="center-container top-container__center-container dw-mod">3350 <div class="grid">3351 <div class="grid__col-auto">3352 <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">3353 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue">3354 @if (string.IsNullOrEmpty(searchSecondFeedId))3355 {3356 <ul class="dropdown dropdown--absolute-position u-min-w220px dropdown-list 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>3357 }3358 else3359 {3360 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid">3361 <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>3362 <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>3363 </div>3364 }3365 <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>3366 </div>3367 </div>3368 <div class="grid__col-auto-width">3369 <ul class="menu dw-mod">3370 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">3371 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod">3372 <i class="fas fa-times fa-1_5x"></i>3373 </label>3374 </li>3375 </ul>3376 </div>3377 </div>3378 </div>3379 </div>3380 }33813382 @helper RenderMobileMiniCartCounterContent()3383 {3384 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice");3385 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";3386 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice;33873388 <script id="MiniCartCounterContent" type="text/x-template">3389 {{#.}}3390 <div class="js-mini-cart-counter-content dw-mod">3391 @if (showPriceInMiniCartCounter)3392 {3393 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text>3394 }3395 else3396 {3397 <text>{{numberofproducts}}</text>3398 }3399 </div>3400 {{/.}}3401 </script>3402 }3403 </text>3404 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>34053406 @using System3407 @using System.Web3408 @using System.Collections.Generic3409 @using Dynamicweb.Rapido.Blocks.Extensibility3410 @using Dynamicweb.Rapido.Blocks34113412 @functions {3413 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master");3414 }34153416 @{3417 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn");3418 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");3419 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile");3420 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders");3421 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards");3422 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites");34233424 Block mobileNavigation = new Block()3425 {3426 Id = "MobileNavigation",3427 SortId = 10,3428 Template = MobileNavigation(),3429 SkipRenderBlocksList = true3430 };3431 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation);34323433 if (Model.CurrentUser.ID > 0 && !hideMyProfileLink)3434 {3435 Block mobileNavigationSignIn = new Block3436 {3437 Id = "MobileNavigationSignIn",3438 SortId = 10,3439 Template = RenderMobileNavigationSignIn()3440 };3441 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn);3442 }34433444 Block mobileNavigationMenu = new Block3445 {3446 Id = "MobileNavigationMenu",3447 SortId = 20,3448 Template = RenderMobileNavigationMenu()3449 };3450 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu);34513452 Block mobileNavigationActions = new Block3453 {3454 Id = "MobileNavigationActions",3455 SortId = 30,3456 Template = RenderMobileNavigationActions(),3457 SkipRenderBlocksList = true3458 };3459 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions);34603461 if (!navigationItemsHideSignIn)3462 {3463 if (Model.CurrentUser.ID <= 0)3464 {3465 Block mobileNavigationSignInAction = new Block3466 {3467 Id = "MobileNavigationSignInAction",3468 SortId = 10,3469 Template = RenderMobileNavigationSignInAction()3470 };3471 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction);34723473 if (!hideCreateAccountLink)3474 {3475 Block mobileNavigationCreateAccountAction = new Block3476 {3477 Id = "MobileNavigationCreateAccountAction",3478 SortId = 20,3479 Template = RenderMobileNavigationCreateAccountAction()3480 };3481 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction);3482 }3483 }3484 else3485 {3486 if (!hideMyOrdersLink)3487 {3488 Block mobileNavigationOrdersAction = new Block3489 {3490 Id = "MobileNavigationOrdersAction",3491 SortId = 20,3492 Template = RenderMobileNavigationOrdersAction()3493 };3494 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction);3495 }3496 if (!hideMyFavoritesLink)3497 {3498 Block mobileNavigationFavoritesAction = new Block3499 {3500 Id = "MobileNavigationFavoritesAction",3501 SortId = 30,3502 Template = RenderMobileNavigationFavoritesAction()3503 };3504 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction);3505 }3506 if (!hideMySavedCardsLink)3507 {3508 Block mobileNavigationSavedCardsAction = new Block3509 {3510 Id = "MobileNavigationFavoritesAction",3511 SortId = 30,3512 Template = RenderMobileNavigationSavedCardsAction()3513 };3514 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction);3515 }35163517 Block mobileNavigationSignOutAction = new Block3518 {3519 Id = "MobileNavigationSignOutAction",3520 SortId = 40,3521 Template = RenderMobileNavigationSignOutAction()3522 };3523 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction);3524 }3525 }35263527 if (Model.Languages.Count > 1)3528 {3529 Block mobileNavigationLanguagesAction = new Block3530 {3531 Id = "MobileNavigationLanguagesAction",3532 SortId = 50,3533 Template = RenderMobileNavigationLanguagesAction()3534 };3535 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction);3536 }3537 }353835393540 @helper MobileNavigation()3541 {3542 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList();35433544 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0;3545 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");3546 int cartFeedPageId = GetPageIdByNavigationTag("CartOrderlinesFeed");3547 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left";3548 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right";35493550 <!-- Trigger for mobile navigation -->3551 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" />35523553 <!-- Mobile navigation -->3554 <nav class="mobile-navigation mobile-navigation--@position dw-mod">3555 <div class="mobile-navigation__wrapper" id="mobileNavigationWrapper">3556 @RenderBlockList(subBlocks)3557 </div>3558 </nav>35593560 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label>35613562 if (!onlyPreview)3563 {3564 <div class="u-visually-hidden js-handlebars-root js-mini-cart" id="miniCart" data-template="MiniCartContent" data-cart-id="@cartFeedPageId" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div>3565 }3566 }35673568 @helper RenderMobileNavigationSignIn()3569 {3570 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");3571 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");3572 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";3573 string myProfilePageLink = linkStart + myProfilePageId;3574 string userName = Model.CurrentUser.FirstName ?? "";3575 userName += " " + (Model.CurrentUser.LastName ?? "");3576 userName += userName == "" && Model.CurrentUser.UserName != null ? Model.CurrentUser.UserName : "";35773578 <ul class="menu menu-mobile">3579 <li class="menu-mobile__item">3580 <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>3581 </li>3582 </ul>3583 }35843585 @helper RenderMobileNavigationMenu()3586 {3587 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides";3588 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt";3589 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3";3590 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");3591 int startLevel = renderPagesInToolBar ? 1 : 0;35923593 @RenderNavigation(new3594 {3595 id = "mobilenavigation",3596 cssclass = "menu menu-mobile dwnavigation",3597 startLevel = @startLevel,3598 ecomStartLevel = @startLevel + 1,3599 endlevel = @levels,3600 expandmode = "all",3601 template = @menuTemplate3602 })36033604 if (isSlidesDesign)3605 {3606 <script>3607 function goToLevel(level) {3608 document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%";3609 }36103611 document.addEventListener('DOMContentLoaded', function () {3612 goToLevel(document.getElementById('mobileNavigationWrapper').querySelectorAll('input[type=radio]:checked').length);3613 });3614 </script>3615 }36163617 if (renderPagesInToolBar)3618 {3619 @RenderNavigation(new3620 {3621 id = "topToolsMobileNavigation",3622 cssclass = "menu menu-mobile dwnavigation",3623 template = "ToolsMenuForMobile.xslt"3624 })3625 }3626 }36273628 @helper RenderMobileNavigationActions()3629 {3630 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ;36313632 <ul class="menu menu-mobile">3633 @RenderBlockList(subBlocks)3634 </ul>3635 }36363637 @helper RenderMobileNavigationSignInAction()3638 {3639 <li class="menu-mobile__item">3640 <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>3641 </li>3642 }36433644 @helper RenderMobileNavigationCreateAccountAction()3645 {3646 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");36473648 <li class="menu-mobile__item">3649 <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>3650 </li>3651 }36523653 @helper RenderMobileNavigationProfileAction()3654 {3655 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");3656 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";3657 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");3658 string myProfilePageLink = linkStart + myProfilePageId;36593660 <li class="menu-mobile__item">3661 <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>3662 </li>3663 }36643665 @helper RenderMobileNavigationOrdersAction()3666 {3667 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");3668 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";3669 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders");3670 string myOrdersPageLink = linkStart + myOrdersPageId;3671 string ordersIcon = "fas fa-list";36723673 <li class="menu-mobile__item">3674 <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>3675 </li>3676 }36773678 @helper RenderMobileNavigationFavoritesAction()3679 {3680 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");3681 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";3682 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");3683 string myFavoritesPageLink = linkStart + myFavoritesPageId;3684 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";368536863687 <li class="menu-mobile__item">3688 <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>3689 </li>3690 }36913692 @helper RenderMobileNavigationSavedCardsAction()3693 {3694 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");3695 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";3696 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards");3697 string mySavedCardsPageLink = linkStart + mySavedCardsPageId;3698 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";36993700 <li class="menu-mobile__item">3701 <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>3702 </li>3703 }37043705 @helper RenderMobileNavigationSignOutAction()3706 {3707 int pageId = Model.TopPage.ID;3708 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";37093710 <li class="menu-mobile__item">3711 <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>3712 </li>3713 }37143715 @helper RenderMobileNavigationLanguagesAction()3716 {3717 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides";37183719 string selectedLanguage = "";3720 foreach (var lang in Model.Languages)3721 {3722 if (lang.IsCurrent)3723 {3724 selectedLanguage = lang.Name;3725 }3726 }37273728 <li class="menu-mobile__item dw-mod">3729 @if (isSlidesDesign)3730 {3731 <input id="MobileMenuCheck_Language" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(1);">3732 }3733 else3734 {3735 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger">3736 }3737 <div class="menu-mobile__link__wrap">3738 <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>3739 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label>3740 </div>3741 <ul class="menu-mobile menu-mobile__submenu expand-menu">3742 @if (isSlidesDesign)3743 {3744 <li class="menu-mobile__item dw-mod">3745 <div class="menu-mobile__link__wrap">3746 <input id="MobileMenuCheck_Language_back" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(0);" />3747 <label for="MobileMenuCheck_Language_back" class="menu-mobile__trigger menu-mobile__trigger--back"></label>3748 <label for="MobileMenuCheck_Language_back" class="menu-mobile__link dw-mod ">@Translate("Back")</label>3749 </div>3750 </li>3751 }3752 @foreach (var lang in Model.Languages)3753 {3754 <li class="menu-mobile__item dw-mod">3755 <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>3756 </li>3757 }3758 </ul>3759 </li>3760 }</text>3761 }3762 else3763 {3764 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>37653766 @using System3767 @using System.Web3768 @using System.Collections.Generic3769 @using Dynamicweb.Rapido.Blocks.Extensibility3770 @using Dynamicweb.Rapido.Blocks37713772 @functions {3773 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master");3774 }37753776 @{3777 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")3778 {3779 Block masterTools = new Block()3780 {3781 Id = "MasterDesktopTools",3782 SortId = 10,3783 Template = RenderDesktopTools(),3784 SkipRenderBlocksList = true,3785 BlocksList = new List<Block>3786 {3787 new Block {3788 Id = "MasterDesktopToolsText",3789 SortId = 10,3790 Template = RenderDesktopToolsText(),3791 Design = new Design3792 {3793 Size = "auto",3794 HidePadding = true,3795 RenderType = RenderType.Column3796 }3797 },3798 new Block {3799 Id = "MasterDesktopToolsNavigation",3800 SortId = 20,3801 Template = RenderDesktopToolsNavigation(),3802 Design = new Design3803 {3804 Size = "auto-width",3805 HidePadding = true,3806 RenderType = RenderType.Column3807 }3808 }3809 }3810 };3811 headerBlocksPage.Add("MasterHeader", masterTools);3812 }38133814 Block masterDesktopExtra = new Block()3815 {3816 Id = "MasterDesktopExtra",3817 SortId = 10,3818 Template = RenderDesktopExtra(),3819 SkipRenderBlocksList = true3820 };3821 headerBlocksPage.Add("MasterHeader", masterDesktopExtra);38223823 Block masterDesktopNavigation = new Block()3824 {3825 Id = "MasterDesktopNavigation",3826 SortId = 20,3827 Template = RenderDesktopNavigation(),3828 SkipRenderBlocksList = true3829 };3830 headerBlocksPage.Add("MasterHeader", masterDesktopNavigation);3831 }38323833 @* Include the Blocks for the page *@3834 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>38353836 @using System3837 @using System.Web3838 @using Dynamicweb.Rapido.Blocks.Extensibility3839 @using Dynamicweb.Rapido.Blocks38403841 @{3842 Block masterDesktopLogo = new Block3843 {3844 Id = "MasterDesktopLogo",3845 SortId = 10,3846 Template = RenderDesktopLogo(),3847 Design = new Design3848 {3849 Size = "auto-width",3850 HidePadding = true,3851 RenderType = RenderType.Column,3852 CssClass = "grid--align-self-center"3853 }3854 };38553856 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo);3857 }385838593860 @helper RenderDesktopLogo()3861 {3862 string firstPageId = Model.Area.FirstActivePage.ID.ToString();3863 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";3864 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : "";3865 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png";3866 if (Path.GetExtension(logo).ToLower() != ".svg")3867 {3868 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight");3869 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40;3870 logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&amp;crop=5&amp;Compression=75&amp;image=" + logo;3871 }3872 else3873 {3874 logo = HttpUtility.UrlDecode(logo);3875 }38763877 <div class="logo @alignClass dw-mod">3878 <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block">3879 <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" />3880 </a>3881 </div>3882 }3883 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>38843885 @using System3886 @using System.Web3887 @using Dynamicweb.Rapido.Blocks.Extensibility3888 @using Dynamicweb.Rapido.Blocks38893890 @functions {3891 bool isMegaMenu;3892 }38933894 @{3895 isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false;3896 Block masterDesktopMenu = new Block3897 {3898 Id = "MasterDesktopMenu",3899 SortId = 10,3900 Template = RenderDesktopMenu(),3901 Design = new Design3902 {3903 Size = "auto",3904 HidePadding = true,3905 RenderType = RenderType.Column3906 }3907 };39083909 if (isMegaMenu)3910 {3911 masterDesktopMenu.Design.CssClass = "u-reset-position";3912 }39133914 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu);3915 }39163917 @helper RenderDesktopMenu()3918 {3919 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";3920 string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : "";3921 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : "";3922 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");3923 bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders");3924 int startLevel = renderPagesInToolBar ? 1 : 0;39253926 string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink");39273928 <div class="grid__cell u-flex @(isMegaMenu ? "u-reset-position" : "") @menuAlignment">3929 @if (!isMegaMenu)3930 {3931 @RenderNavigation(new3932 {3933 id = "topnavigation",3934 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap",3935 startLevel = startLevel,3936 ecomStartLevel = startLevel + 1,3937 endlevel = 5,3938 expandmode = "all",3939 template = "BaseMenuWithDropdown.xslt"3940 });3941 }3942 else3943 {3944 @RenderNavigation(new3945 {3946 id = "topnavigation",3947 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap",3948 startLevel = startLevel,3949 ecomStartLevel = startLevel + 1,3950 endlevel = 5,3951 promotionImage = megamenuPromotionImage,3952 promotionLink = promotionLink,3953 expandmode = "all",3954 showOnlyHeaders = showOnlyHeaders.ToString().ToLower(),3955 template = "BaseMegaMenu.xslt"3956 });3957 }3958 </div>3959 }3960 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>39613962 @using System3963 @using System.Web3964 @using Dynamicweb.Rapido.Blocks.Extensibility3965 @using Dynamicweb.Rapido.Blocks39663967 @{3968 Block masterDesktopActionsMenu = new Block3969 {3970 Id = "MasterDesktopActionsMenu",3971 SortId = 10,3972 Template = RenderDesktopActionsMenu(),3973 Design = new Design3974 {3975 CssClass = "u-flex"3976 },3977 SkipRenderBlocksList = true39783979 };3980 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu);39813982 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink")))3983 {3984 Block masterDesktopActionsHeaderButton = new Block3985 {3986 Id = "MasterDesktopActionsHeaderButton",3987 SortId = 60,3988 Template = RenderHeaderButton()3989 };3990 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton);3991 }3992 }39933994 @helper RenderDesktopActionsMenu()3995 {3996 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList();39973998 <ul class="menu u-flex dw-mod">3999 @RenderBlockList(subBlocks)4000 </ul>4001 }40024003 @helper RenderHeaderButton()4004 {4005 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText");4006 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink");4007 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : "";40084009 <li class="menu__item menu__item--horizontal menu--clean dw-mod">4010 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-top u-margin-left" href="@headerButtonLink">@headerButtonText</a>4011 </li>4012 }4013 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>40144015 @using System4016 @using System.Web4017 @using Dynamicweb.Core;4018 @using System.Text.RegularExpressions4019 @using Dynamicweb.Rapido.Blocks.Extensibility4020 @using Dynamicweb.Rapido.Blocks40214022 @{4023 Block masterDesktopActionsMenuLanguageSelector = new Block4024 {4025 Id = "MasterDesktopActionsMenuLanguageSelector",4026 SortId = 40,4027 Template = RenderLanguageSelector()4028 };40294030 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector);4031 }40324033 @helper RenderLanguageSelector()4034 {4035 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";4036 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";4037 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";4038 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() : "";40394040 if (Model.Languages.Count > 1)4041 {4042 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod">4043 <div class="@menuLinkClass dw-mod">4044 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i>4045 </div>4046 <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell">4047 @foreach (var lang in Model.Languages)4048 {4049 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name;4050 string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty);4051 cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1);40524053 if (languageViewType == "flag-culture")4054 {4055 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span> " + cultureName;4056 }40574058 if (languageViewType == "flag")4059 {4060 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span>";4061 }40624063 if (languageViewType == "name")4064 {4065 langInfo = lang.Name;4066 }40674068 if (languageViewType == "culture")4069 {4070 langInfo = cultureName;4071 }40724073 <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__item menu-dropdown__item--link dw-mod">@langInfo</a>4074 }4075 </div>4076 </li>4077 }4078 }4079 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>40804081 @using System4082 @using System.Web4083 @using Dynamicweb.Rapido.Blocks.Extensibility4084 @using Dynamicweb.Rapido.Blocks40854086 @{4087 Block masterDesktopActionsMenuSignIn = new Block4088 {4089 Id = "MasterDesktopActionsMenuSignIn",4090 SortId = 20,4091 Template = RenderSignIn()4092 };40934094 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuSignIn);4095 }40964097 @helper RenderSignIn()4098 {4099 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn");4100 string userInitials = "";4101 int pageId = Model.TopPage.ID;4102 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");4103 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard");4104 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");4105 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders");4106 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");4107 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards");4108 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");4109 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");4110 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile");4111 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders");4112 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards");4113 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites");4114 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink");41154116 string linkStart = "/Default.aspx?ID=";4117 if (Model.CurrentUser.ID <= 0)4118 {4119 linkStart += signInProfilePageId + "&RedirectPageId=";4120 }41214122 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery";4123 string myProfilePageLink = linkStart + myProfilePageId;4124 string myOrdersPageLink = linkStart + myOrdersPageId;4125 string myFavoritesPageLink = linkStart + myFavoritesPageId;4126 string mySavedCardsPageLink = linkStart + mySavedCardsPageId;41274128 string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user";4129 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";41304131 if (Model.CurrentUser.ID != 0)4132 {4133 if (!String.IsNullOrEmpty(Model.CurrentUser.Name))4134 {4135 string[] names = Model.CurrentUser.Name.Split(' ');4136 userInitials += Model.CurrentUser.Name.Substring(0, 1);41374138 if (names.Length > 1)4139 {4140 userInitials += names[names.Length - 1].Substring(0, 1);4141 }4142 }4143 else4144 {4145 userInitials += Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName != "" ? Model.CurrentUser.FirstName.Substring(0, 1) : "";4146 userInitials += Model.CurrentUser.LastName != null && Model.CurrentUser.LastName != "" ? Model.CurrentUser.LastName.Substring(0, 1) : "";4147 userInitials += userInitials.Length == 1 && Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName.Length > 1 ? Model.CurrentUser.FirstName.Substring(1, 2) : "";4148 userInitials += userInitials == "" && Model.CurrentUser.Email != null && Model.CurrentUser.Email.Length > 1 ? Model.CurrentUser.Email.Substring(0, 2) : "";4149 userInitials += userInitials == "" ? Model.CurrentUser.UserName.Substring(0, 2) : "";4150 }4151 }41524153 if (!navigationItemsHideSignIn)4154 {4155 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";4156 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean";4157 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";41584159 <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod">4160 <div class="@menuLinkClass dw-mod">4161 @if (Model.CurrentUser.ID <= 0)4162 {4163 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x"></i>4164 }4165 else4166 {4167 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a>4168 }4169 </div>4170 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod">4171 <ul class="list list--clean dw-mod">4172 @if (Model.CurrentUser.ID <= 0)4173 {4174 <li>4175 <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>4176 </li>41774178 if (!hideCreateAccountLink)4179 {4180 @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account"));4181 }4182 if (!hideForgotPasswordLink)4183 {4184 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?"))4185 }4186 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink)4187 {4188 @RenderSeparator()4189 }4190 }4191 @if (!hideMyProfileLink)4192 {4193 @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon)4194 }4195 @if (!hideMyOrdersLink)4196 {4197 @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list")4198 }4199 @if (!hideMyFavoritesLink)4200 {4201 @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon)4202 }4203 @if (!hideMySavedCardsLink)4204 {4205 @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card")4206 }4207 @if (Model.CurrentUser.ID > 0)4208 {4209 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink)4210 {4211 @RenderSeparator()4212 }42134214 @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out"))4215 }4216 </ul>4217 </div>4218 </li>4219 }4220 }42214222 @helper RenderListItem(string link, string text, string icon = null) {4223 <li>4224 <a href="@link" class="list__link dw-mod">4225 @if (!string.IsNullOrEmpty(icon))4226 {4227 <i class="@icon u-margin-right"></i>4228 }4229 @text4230 </a>4231 </li>4232 }42334234 @helper RenderSeparator()4235 {4236 <li class="list__seperator dw-mod"></li>4237 }4238 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>42394240 @using System4241 @using System.Web4242 @using Dynamicweb.Rapido.Blocks.Extensibility4243 @using Dynamicweb.Rapido.Blocks42444245 @{4246 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites");42474248 Block masterDesktopActionsMenuFavorites = new Block4249 {4250 Id = "MasterDesktopActionsMenuFavorites",4251 SortId = 30,4252 Template = RenderFavorites()4253 };42544255 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0)4256 {4257 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites);4258 }4259 }42604261 @helper RenderFavorites()4262 {4263 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");4264 string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId;42654266 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";4267 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";4268 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";42694270 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod">4271 <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod">4272 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i>4273 </a>4274 </li>4275 }4276 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>42774278 @using System4279 @using System.Web4280 @using Dynamicweb.Rapido.Blocks.Extensibility4281 @using Dynamicweb.Rapido.Blocks42824283 @{4284 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0;4285 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart");4286 string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown";42874288 if (!onlyPreview && !hideCart)4289 {4290 Block masterDesktopActionsMenuMiniCart = new Block4291 {4292 Id = "MasterDesktopActionsMenuMiniCart",4293 SortId = 50,4294 Template = RenderMiniCart(miniCartLayout == "dropdown"),4295 SkipRenderBlocksList = true,4296 BlocksList = new List<Block>()4297 };42984299 Block miniCartCounterScriptTemplate = new Block4300 {4301 Id = "MiniCartCounterScriptTemplate",4302 Template = RenderMiniCartCounterContent()4303 };43044305 //dropdown layout is default4306 RazorEngine.Templating.TemplateWriter layoutTemplate = RenderMiniCartDropdownLayout();4307 RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate = RenderMiniCartTriggerLink();43084309 switch (miniCartLayout)4310 {4311 case "panel":4312 layoutTemplate = RenderMiniCartPanelLayout();4313 miniCartTriggerTemplate = RenderMiniCartTriggerLabel();4314 break;4315 case "modal":4316 layoutTemplate = RenderMiniCartModalLayout();4317 miniCartTriggerTemplate = RenderMiniCartTriggerLabel();4318 break;4319 }43204321 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block4322 {4323 Id = "MiniCartTrigger",4324 Template = miniCartTriggerTemplate4325 });43264327 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")4328 {4329 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block4330 {4331 Id = "MiniCartLayout",4332 Template = layoutTemplate4333 });4334 }43354336 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuMiniCart);4337 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate);4338 }4339 }43404341 @helper RenderMiniCart(bool hasMouseEnterEvent)4342 {4343 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterDesktopActionsMenuMiniCart").OrderBy(item => item.SortId).ToList();4344 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";4345 string liClasses = topLayout != "normal" ? "menu__item--top-level" : "menu--clean";4346 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");4347 string mouseEvent = "";4348 string id = "MiniCart";4349 if (hasMouseEnterEvent) {4350 mouseEvent = "onmouseenter=\"Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=" + miniCartFeedPageId + "&feedType=MiniCart')\"";4351 id = "miniCartTrigger";4352 }4353 <li class="menu__item menu__item--horizontal menu__item--icon @liClasses dw-mod" id="@id" @mouseEvent>4354 @RenderBlockList(subBlocks)4355 </li>4356 }43574358 @helper RenderMiniCartTriggerLabel()4359 {4360 int cartPageId = GetPageIdByNavigationTag("CartPage");4361 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart";4362 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";4363 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";4364 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");43654366 <div class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')">4367 <div class="u-inline u-position-relative">4368 <i class="@cartIcon fa-1_5x"></i>4369 @RenderMiniCartCounter()4370 </div>4371 </div>4372 }43734374 @helper RenderMiniCartTriggerLink()4375 {4376 int cartPageId = GetPageIdByNavigationTag("CartPage");4377 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart";4378 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";4379 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";43804381 <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button">4382 <div class="u-inline u-position-relative">4383 <i class="@cartIcon fa-1_5x"></i>4384 @RenderMiniCartCounter()4385 </div>4386 </a>4387 }43884389 @helper RenderMiniCartCounter()4390 {4391 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");4392 string cartProductsCount = Model.Cart.TotalProductsCount.ToString();4393 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";4394 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice");4395 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : "";4396 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : "";43974398 if (showPrice && counterPosition == "right")4399 {4400 cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")";4401 }44024403 <div class="mini-cart__counter dw-mod">4404 <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">4405 <div class="js-mini-cart-counter-content" data-count="@Model.Cart.TotalProductsCount.ToString()">4406 @cartProductsCount4407 @cartProductsTotalPrice4408 </div>4409 </div>4410 </div>4411 }44124413 @helper RenderMiniCartCounterContent()4414 {4415 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice");4416 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";4417 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice;44184419 <script id="MiniCartCounterContent" type="text/x-template">4420 {{#.}}4421 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}">4422 @if (showPriceInMiniCartCounter)4423 {4424 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text>4425 }4426 else4427 {4428 <text>{{numberofproducts}}</text>4429 }4430 </div>4431 {{/.}}4432 </script>4433 }44344435 @helper RenderMiniCartDropdownLayout()4436 {4437 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");44384439 <div class="mini-cart mini-cart-dropdown js-mini-cart grid__cell dw-mod" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="dropdown">4440 <div class="mini-cart-dropdown__inner dw-mod">4441 <h3 class="u-ta-center dw-mod">@Translate("Shopping cart")</h3>4442 <div class="mini-cart-dropdown__body u-flex dw-mod">4443 <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>4444 </div>4445 </div>4446 </div>4447 }44484449 @helper RenderMiniCartPanelLayout()4450 {4451 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");44524453 <div class="mini-cart grid__cell dw-mod">4454 <input type="checkbox" id="miniCartTrigger" class="panel-trigger" />4455 <div class="panel panel--right panel--with-close-btn dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block">4456 <label for="miniCartTrigger" class="panel__close-btn" title="@Translate("Close panel")"><i class="fas fa-times"></i></label>4457 <div class="panel__content u-full-width dw-mod">4458 <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3>4459 <div class="panel__content-body panel__content-body--cart dw-mod">4460 <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>4461 </div>4462 </div>4463 </div>4464 </div>4465 }44664467 @helper RenderMiniCartModalLayout()4468 {4469 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");4470 <div class="mini-cart grid__cell dw-mod">4471 <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" />4472 <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block">4473 <label for="miniCartTrigger" class="modal-overlay"></label>4474 <div class="modal modal--top-right dw-mod">4475 <div class="modal__body u-flex grid--direction-column dw-mod">4476 <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3>4477 <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>4478 </div>4479 <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label>4480 </div>4481 </div>4482 </div>4483 }4484 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>44854486 @using System4487 @using System.Web4488 @using Dynamicweb.Rapido.Blocks.Extensibility4489 @using Dynamicweb.Rapido.Blocks44904491 @{4492 bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart");44934494 Block masterDesktopActionsMenuDownloadCart = new Block4495 {4496 Id = "MasterDesktopActionsMenuDownloadCart",4497 SortId = 35,4498 Template = RenderDownloadCart()4499 };45004501 if (showDownloadCartLink && Model.CurrentUser.ID > 0)4502 {4503 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuDownloadCart);4504 }4505 }45064507 @helper RenderDownloadCart()4508 {4509 int downloadCartPageId = GetPageIdByNavigationTag("DownloadCart");4510 string downloadCartPageLink = "/Default.aspx?ID=" + downloadCartPageId;45114512 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";4513 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";4514 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";45154516 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod">4517 <a href="@downloadCartPageLink" class="@menuLinkClass dw-mod">4518 <i class="fas fa-cart-arrow-down fa-1_5x"></i>4519 </a>4520 </li>4521 }4522 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>45234524 @using System4525 @using System.Web4526 @using Dynamicweb.Rapido.Blocks.Extensibility4527 @using Dynamicweb.Rapido.Blocks45284529 @functions {4530 public class SearchConfiguration4531 {4532 public string searchFeedId { get; set; }4533 public string searchSecondFeedId { get; set; }4534 public int groupsFeedId { get; set; }4535 public string resultPageLink { get; set; }4536 public string searchPlaceholder { get; set; }4537 public string searchType { get; set; }4538 public string searchTemplate { get; set; }4539 public string searchContentTemplate { get; set; }4540 public string searchValue { get; set; }4541 public bool showGroups { get; set; }45424543 public SearchConfiguration()4544 {4545 searchFeedId = "";4546 searchSecondFeedId = "";4547 searchType = "product-search";4548 searchContentTemplate = "";4549 showGroups = true;4550 }4551 }4552 }4553 @{4554 Block masterSearchBar = new Block4555 {4556 Id = "MasterSearchBar",4557 SortId = 40,4558 Template = RenderSearch("bar"),4559 Design = new Design4560 {4561 Size = "auto",4562 HidePadding = true,4563 RenderType = RenderType.Column4564 }4565 };45664567 Block masterSearchAction = new Block4568 {4569 Id = "MasterDesktopActionsMenuSearch",4570 SortId = 10,4571 Template = RenderSearch()4572 };45734574 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar);4575 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction);4576 }45774578 @helper RenderSearch(string type = "mini-search")4579 {4580 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage"));4581 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;4582 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch";45834584 SearchConfiguration searchConfiguration = null;45854586 switch (searchType)4587 {4588 case "contentSearch":4589 searchConfiguration = new SearchConfiguration()4590 {4591 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true",4592 resultPageLink = contentSearchPageLink,4593 searchPlaceholder = Translate("Search page"),4594 groupsFeedId = 0,4595 searchType = "content-search",4596 searchTemplate = "SearchPagesTemplate",4597 showGroups = false4598 };4599 break;4600 case "combinedSearch":4601 searchConfiguration = new SearchConfiguration()4602 {4603 searchFeedId = productsPageId + "&feed=true",4604 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true",4605 resultPageLink = Converter.ToString(productsPageId),4606 searchPlaceholder = Translate("Search products or pages"),4607 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"),4608 searchType = "combined-search",4609 searchTemplate = "SearchProductsTemplateWrap",4610 searchContentTemplate = "SearchPagesTemplateWrap",4611 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector")4612 };4613 break;4614 default: //productSearch4615 searchConfiguration = new SearchConfiguration()4616 {4617 resultPageLink = Converter.ToString(productsPageId),4618 searchFeedId = productsPageId + "&feed=true",4619 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"),4620 searchPlaceholder = Translate("Search products"),4621 searchTemplate = "SearchProductsTemplate",4622 searchType = "product-search",4623 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector")4624 };4625 break;4626 }4627 searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? "";46284629 if (type == "mini-search")4630 {4631 @RenderMiniSearch(searchConfiguration)4632 }4633 else4634 {4635 @RenderSearchBar(searchConfiguration)4636 }4637 }46384639 @helper RenderSearchBar(SearchConfiguration options)4640 {4641 <div class="custom-typeahead dw-mod">4642 <div class="typeahead typeahead-custom-width u-color-inherit js-typeahead dw-mod" id="ProductSearchBar"4643 data-page-size="7"4644 data-search-feed-id="@options.searchFeedId"4645 data-search-second-feed-id="@options.searchSecondFeedId"4646 data-result-page-id="@options.resultPageLink"4647 data-groups-page-id="@options.groupsFeedId"4648 data-search-type="@options.searchType">4649 @if (options.showGroups)4650 {4651 <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>4652 <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>4653 }4654 <div class="typeahead-search-field">4655 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field custom-search-field dw-mod" placeholder="@options.searchPlaceholder" value="@HttpUtility.HtmlEncode(options.searchValue)">4656 @if (string.IsNullOrEmpty(options.searchSecondFeedId))4657 {4658 <ul class="dropdown dropdown--absolute-position u-min-w220px search-bar-list 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>4659 }4660 else4661 {4662 <div class="dropdown dropdown--absolute-position dropdown--combined grid">4663 <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>4664 <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>4665 </div>4666 }4667 </div>4668 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn custom-search-btn dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button>4669 </div>4670 </div>4671 }46724673 @helper RenderMiniSearch(SearchConfiguration options)4674 {4675 <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" onmouseover="document.getElementById('headerSearch').focus()">4676 <div class="menu__link menu__link--icon dw-mod">4677 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i>4678 </div>4679 <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod">4680 <div class="typeahead js-typeahead" id="ProductSearchBar"4681 data-page-size="7"4682 data-search-feed-id="@options.searchFeedId"4683 data-search-second-feed-id="@options.searchSecondFeedId"4684 data-result-page-id="@options.resultPageLink"4685 data-search-type="@options.searchType">4686 <div class="typeahead-search-field">4687 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field custom-search-field dw-mod" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue">4688 @if (string.IsNullOrEmpty(options.searchSecondFeedId))4689 {4690 <ul class="dropdown dropdown--absolute-position u-min-w220px search-bar-list 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>4691 }4692 else4693 {4694 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned">4695 <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>4696 <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>4697 </div>4698 }4699 </div>4700 </div>4701 </div>4702 </li>4703 }4704 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>47054706 @using System4707 @using System.Web4708 @using Dynamicweb.Rapido.Blocks.Extensibility4709 @using Dynamicweb.Rapido.Blocks47104711 @{4712 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";4713 bool hideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");47144715 BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master");47164717 Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo");4718 headerConfigurationPage.RemoveBlock(configDesktopLogo);47194720 Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu");4721 headerConfigurationPage.RemoveBlock(configDesktopMenu);47224723 Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar");4724 headerConfigurationPage.RemoveBlock(configSearchBar);47254726 Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch");4727 headerConfigurationPage.RemoveBlock(configSearchAction);47284729 Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu");4730 headerConfigurationPage.RemoveBlock(configDesktopActionsMenu);47314732 Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra");47334734 switch (topLayout)4735 {4736 case "condensed": //24737 configDesktopLogo.Design.Size = "auto-width";4738 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);47394740 configDesktopMenu.SortId = 20;4741 configDesktopMenu.Design.Size = "auto";4742 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);47434744 configDesktopActionsMenu.SortId = 30;4745 configDesktopActionsMenu.Design.Size = "auto-width";4746 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);47474748 if (!hideSearch)4749 {4750 configSearchBar.SortId = 40;4751 configSearchBar.Design.Size = "12";4752 configDesktopExtra.SortId = 50;4753 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);4754 }4755 break;4756 case "splitted": //34757 configDesktopLogo.Design.Size = "auto";4758 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);47594760 if (!hideSearch)4761 {4762 configSearchBar.SortId = 20;4763 configSearchBar.Design.Size = "auto";4764 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);4765 }47664767 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);47684769 configDesktopActionsMenu.SortId = 20;4770 configDesktopActionsMenu.Design.Size = "auto-width";4771 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);4772 break;4773 case "minimal": //44774 configDesktopLogo.Design.Size = "auto-width";4775 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);47764777 configDesktopMenu.Design.Size = "auto";4778 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);47794780 configDesktopActionsMenu.SortId = 20;4781 configDesktopActionsMenu.Design.Size = "auto-width";4782 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);47834784 if (!hideSearch)4785 {4786 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);4787 }4788 break;4789 case "minimal-right": //54790 configDesktopLogo.Design.Size = "auto-width";4791 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);47924793 configDesktopMenu.Design.Size = "auto";4794 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);47954796 configDesktopActionsMenu.SortId = 20;4797 configDesktopActionsMenu.Design.Size = "auto-width";4798 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);47994800 if (!hideSearch)4801 {4802 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);4803 }4804 break;4805 case "two-lines": //64806 configDesktopLogo.Design.Size = "auto";4807 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);48084809 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);48104811 configDesktopActionsMenu.SortId = 20;4812 configDesktopActionsMenu.Design.Size = "auto-width";4813 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);48144815 if (!hideSearch)4816 {4817 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);4818 }4819 break;4820 case "two-lines-centered": //74821 configDesktopLogo.Design.Size = "auto";4822 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);48234824 configDesktopMenu.Design.Size = "auto-width";4825 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);48264827 configDesktopActionsMenu.SortId = 20;4828 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);48294830 if (!hideSearch)4831 {4832 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);4833 }4834 break;4835 case "normal": //14836 default:4837 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);48384839 if (!hideSearch)4840 {4841 configSearchBar.SortId = 20;4842 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);4843 }48444845 configDesktopActionsMenu.SortId = 30;4846 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu);48474848 configDesktopActionsMenu.Design.Size = "auto-width";4849 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);4850 break;4851 }4852 }4853 @if (File.Exists(HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/MasterBlocks/HeaderBlocks/Custom__Blocks.cshtml")))4854 {4855 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>48564857 @using System4858 @using System.Web4859 @using Dynamicweb.Rapido.Blocks.Extensibility4860 @using Dynamicweb.Rapido.Blocks48614862 @{48634864 }</text>4865 }486648674868 @helper RenderDesktopTools()4869 {4870 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList();48714872 <div class="tools-navigation dw-mod">4873 <div class="center-container grid top-container__center-container dw-mod">4874 @RenderBlockList(subBlocks)4875 </div>4876 </div>4877 }48784879 @helper RenderDesktopToolsText()4880 {4881 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText");4882 if (!string.IsNullOrEmpty(toolsText))4883 {4884 <div class="u-margin-top u-margin-bottom">@toolsText</div>4885 }4886 }48874888 @helper RenderDesktopToolsNavigation()4889 {4890 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");48914892 if (renderPagesInToolBar)4893 {4894 @RenderNavigation(new4895 {4896 id = "topToolsNavigation",4897 cssclass = "menu menu-tools dw-mod dwnavigation",4898 template = "TopMenu.xslt"4899 })4900 }4901 }49024903 @helper RenderDesktopNavigation()4904 {4905 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList();4906 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";4907 string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : "";4908 <nav class="main-navigation dw-mod">4909 <div class="center-container top-container__center-container grid @alignClass dw-mod">4910 @RenderBlockList(subBlocks)4911 </div>4912 </nav>4913 }49144915 @helper RenderDesktopExtra()4916 {4917 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList();49184919 if (subBlocks.Count > 0)4920 {4921 <div class="header header-top dw-mod">4922 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod">4923 @RenderBlockList(subBlocks)4924 </div>4925 </div>4926 }4927 }</text>4928 }49294930 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>49314932 @using System4933 @using System.Web4934 @using Dynamicweb.Rapido.Blocks.Extensibility4935 @using Dynamicweb.Rapido.Blocks49364937 @{4938 Block impersonationBar = new Block4939 {4940 Id = "ImpersonationBar",4941 SortId = 50,4942 Template = RenderImpersonationBar(),4943 Design = new Design4944 {4945 Size = "auto-width",4946 HidePadding = true,4947 RenderType = RenderType.Column4948 }4949 };49504951 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0)4952 {4953 BlocksPage.GetBlockPage("Master").Add("MasterHeader", impersonationBar);4954 }4955 }49564957 @helper RenderImpersonationBar()4958 {4959 int impersonationPageId = GetPageIdByNavigationTag("Impersonation");49604961 <div class="u-color-warning--bg">4962 <div class="center-container top-container__center-container dw-mod">4963 @*Impersonation*@4964 <div class="grid">4965 <div class="grid--align-self-center grid__col-x">4966 @if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0)4967 {4968 string stopImpersonateTranslation = Translate("Stop impersonation");4969 string username = "";4970 if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.FirstName) && !string.IsNullOrEmpty(Model.CurrentSecondaryUser.LastName))4971 {4972 username = Model.CurrentSecondaryUser.FirstName + " " + Model.CurrentSecondaryUser.LastName;4973 }4974 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Name))4975 {4976 username = Model.CurrentSecondaryUser.Name;4977 }4978 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Email))4979 {4980 username = Model.CurrentSecondaryUser.Email;4981 }4982 else4983 {4984 username = Model.CurrentSecondaryUser.UserName;4985 }4986 <div class="grid-cell">4987 <div class="u-pull--left u-bold u-margin-top">4988 <i class="fas fa-user-secret"></i>4989 @Pageview.User.UserName<text>&nbsp;</text>@Translate("is impersonating")<text>&nbsp;</text>@username4990 </div>4991 <form method="post" class="u-pull--right u-no-margin">4992 <input type="submit" class="btn btn--secondary dw-mod u-no-margin" name="DwExtranetRemoveSecondaryUser" value="@stopImpersonateTranslation">4993 </form>4994 </div>4995 }4996 else4997 {4998 string viewListTranslation = Translate("View the list of users you can impersonate");4999 <div class="grid-cell u-bold">5000 <i class="fas fa-user-secret"></i>5001 <a href="/Default.aspx?ID=@impersonationPageId" title="@viewListTranslation" class="u-color-font-black">@viewListTranslation</a>5002 </div>5003 }5004 </div>5005 </div>5006 </div>5007 </div>5008 }5009 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>50105011 @using System5012 @using System.Web5013 @using System.Collections.Generic5014 @using Dynamicweb.Rapido.Blocks.Extensibility5015 @using Dynamicweb.Rapido.Blocks50165017 @{5018 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master");5019 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table";50205021 Block orderLines = new Block5022 {5023 Id = "MiniCartOrderLines",5024 SkipRenderBlocksList = true,5025 BlocksList = new List<Block>5026 {5027 new Block {5028 Id = "MiniCartOrderLinesList",5029 SortId = 20,5030 Template = RenderMiniCartOrderLinesList()5031 }5032 }5033 };50345035 Block orderlinesScriptTemplates = new Block5036 {5037 Id = "OrderlinesScriptTemplates"5038 };50395040 if (orderlinesView == "table")5041 {5042 orderLines.Template = RenderMiniCartOrderLinesTable();5043 orderLines.BlocksList.Add(5044 new Block5045 {5046 Id = "MiniCartOrderlinesTableHeader",5047 SortId = 10,5048 Template = RenderMiniCartOrderLinesHeader()5049 }5050 );50515052 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates();5053 }5054 else5055 {5056 orderLines.Template = RenderMiniCartOrderLinesBlocks();5057 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates();5058 }50595060 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates);50615062 Block miniCartScriptTemplates = new Block()5063 {5064 Id = "MasterMiniCartTemplates",5065 SortId = 1,5066 Template = RenderMiniCartScriptTemplates(),5067 SkipRenderBlocksList = true,5068 BlocksList = new List<Block>5069 {5070 orderLines,5071 new Block {5072 Id = "MiniCartFooter",5073 Template = RenderMiniCartFooter(),5074 SortId = 50,5075 SkipRenderBlocksList = true,5076 BlocksList = new List<Block>5077 {5078 new Block {5079 Id = "MiniCartFees",5080 Template = RenderMiniCartFees(),5081 SortId = 305082 },5083 new Block {5084 Id = "MiniCartPoints",5085 Template = RenderMiniCartPoints(),5086 SortId = 405087 },50885089 new Block {5090 Id = "MiniCartTotal",5091 Template = RenderMiniCartTotal(),5092 SortId = 605093 },5094 new Block {5095 Id = "MiniCartActions",5096 Template = RenderMiniCartActions(),5097 SortId = 705098 }5099 }5100 }5101 }5102 };51035104 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates);5105 }51065107 @helper RenderMiniCartScriptsTableTemplates()5108 {5109 <script id="MiniCartOrderline" type="text/x-template">5110 {{#unless isEmpty}}5111 <tr>5112 <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}}"></a></td>5113 <td class="u-va-middle">5114 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a>5115 {{#if variantname}}5116 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a>5117 {{/if}}5118 {{#if unitname}}5119 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div>5120 {{/if}}5121 </td>5122 <td class="u-ta-right u-va-middle">{{quantity}}</td>5123 <td class="u-ta-right u-va-middle">5124 {{#if pointsTotal}}5125 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points")5126 {{else}}5127 {{totalprice}}5128 {{/if}}5129 </td>5130 </tr>5131 {{/unless}}5132 </script>51335134 <script id="MiniCartOrderlineDiscount" type="text/x-template">5135 {{#unless isEmpty}}5136 <tr class="table__row--no-border">5137 <td class="u-w60px">&nbsp;</td>5138 <td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td>5139 <td class="u-ta-right">&nbsp;</td>5140 <td class="u-ta-right">{{totalprice}}</td>5141 </tr>5142 {{/unless}}5143 </script>5144 }51455146 @helper RenderMiniCartScriptsListTemplates()5147 {5148 int cartOrderlinesFeedPageId = GetPageIdByNavigationTag("CartOrderlinesFeed");5149 <script id="MiniCartOrderline" type="text/x-template">5150 {{#unless isEmpty}}5151 <div class="mini-cart-orderline grid dw-mod">5152 <div class="grid__col-4">5153 <a href="{{link}}" class="{{hideimage}}">5154 <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}}">5155 </a>5156 </div>5157 <div class="grid__col-8">5158 <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>5159 {{#if variantname}}5160 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div>5161 {{/if}}5162 {{#if unitname}}5163 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div>5164 {{/if}}5165 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div>51665167 <div class="grid__cell-footer">5168 <div class="grid__cell">5169 <div class="u-pull--left mini-cart-orderline__price dw-mod">5170 {{#if pointsTotal}}5171 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points")5172 {{else}}5173 {{totalprice}}5174 {{/if}}5175 </div>5176 <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('Cart', '/Default.aspx?ID=@cartOrderlinesFeedPageId', 'CartCmd=DelOrderLine&key={{orderLineId}}', true);">@Translate("Remove")</button>5177 </div>5178 </div>5179 </div>5180 </div>5181 {{/unless}}5182 </script>51835184 <script id="MiniCartOrderlineDiscount" type="text/x-template">5185 {{#unless isEmpty}}5186 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod">5187 <div class="grid__col-4">5188 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div>5189 </div>5190 <div class="grid__col-8">{{totalprice}}</div>5191 </div>5192 {{/unless}}5193 </script>5194 }51955196 @helper RenderMiniCartScriptTemplates()5197 {5198 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList();5199 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));5200 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage"));52015202 <script id="MiniCartContent" type="text/x-template">5203 {{#.}}5204 {{#unless isEmpty}}5205 @if (useGoogleTagManager)5206 {5207 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text>5208 }5209 @RenderBlockList(subBlocks)5210 {{/unless}}5211 {{#if isEmpty}}5212 {{{locationReload '@cartPageLink'}}}5213 {{/if}}5214 {{/.}}5215 </script>5216 }52175218 @helper RenderMiniCartOrderLinesTable()5219 {5220 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList();52215222 <div class="u-overflow-auto">5223 <table class="table mini-cart-table dw-mod">5224 @RenderBlockList(subBlocks)5225 </table>5226 </div>5227 }52285229 @helper RenderMiniCartOrderLinesBlocks()5230 {5231 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList();52325233 <div class="u-overflow-auto">5234 @RenderBlockList(subBlocks)5235 </div>5236 }523752385239 @helper RenderMiniCartOrderLinesHeader()5240 {5241 <thead>5242 <tr>5243 <td>&nbsp;</td>5244 <td>@Translate("Product")</td>5245 <td class="u-ta-right">@Translate("Qty")</td>5246 <td class="u-ta-right" width="120">@Translate("Price")</td>5247 </tr>5248 </thead>5249 }52505251 @helper RenderMiniCartOrderLinesList()5252 {5253 <text>5254 {{#OrderLines}}5255 {{#ifCond template "===" "CartOrderline"}}5256 {{>MiniCartOrderline}}5257 {{/ifCond}}5258 {{#ifCond template "===" "CartOrderlineMobile"}}5259 {{>MiniCartOrderline}}5260 {{/ifCond}}5261 {{#ifCond template "===" "CartOrderlineDiscount"}}5262 {{>MiniCartOrderlineDiscount}}5263 {{/ifCond}}5264 {{/OrderLines}}5265 </text>5266 }52675268 @helper RenderMiniCartFees()5269 {5270 <div class="grid u-border-top grid--external-bleed-bottom {{hidePaymentFee}}">5271 <div class="grid__col-6">5272 {{paymentmethod}}5273 </div>5274 <div class="grid__col-6 grid--align-end">{{paymentfee}}</div>5275 </div>5276 <div class="grid grid--external-bleed-bottom {{hideShippingFee}}">5277 <div class="grid__col-6">5278 {{shippingmethod}}5279 </div>5280 <div class="grid__col-6 grid--align-end">{{shippingfee}}</div>5281 </div>5282 }52835284 @helper RenderMiniCartFooter()5285 {5286 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList();52875288 <div class="mini-cart__footer dw-mod">5289 @RenderBlockList(subBlocks)5290 </div>5291 }52925293 @helper RenderMiniCartActions()5294 {5295 int cartPageId = GetPageIdByNavigationTag("CartPage");52965297 <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>5298 <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>5299 }53005301 @helper RenderMiniCartPoints()5302 {5303 <text>5304 {{#if earnings}}5305 <div class="grid grid--external-bleed-bottom">5306 <div class="grid__col-6">@Translate("Earnings")</div>5307 <div class="grid__col-6 grid--align-end">5308 <div>5309 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points")5310 </div>5311 </div>5312 </div>5313 {{/if}}5314 </text>5315 }53165317 @helper RenderMiniCartTotal()5318 {5319 <div class="mini-cart-totals grid u-margin-bottom dw-mod">5320 <div class="grid__col-6">@Translate("Total")</div>5321 <div class="grid__col-6 grid--align-end">{{totalprice}}</div>5322 </div>5323 }5324 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>53255326 @using Dynamicweb.Rapido.Blocks.Extensibility5327 @using Dynamicweb.Rapido.Blocks53285329 @{5330 bool addToCartNotificationOnlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0;5331 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : "";53325333 if (!addToCartNotificationOnlyPreview && !string.IsNullOrEmpty(addToCartNotificationType)) {5334 if (addToCartNotificationType == "modal")5335 {5336 Block addToCartNotificationModal = new Block5337 {5338 Id = "AddToCartNotificationModal",5339 Template = RenderAddToCartNotificationModal()5340 };53415342 Block addToCartNotificationScript = new Block5343 {5344 Id = "AddToCartNotificationScript",5345 Template = RenderAddToCartNotificationModalScript()5346 };5347 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal);5348 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript);5349 }5350 else if (addToCartNotificationType == "toggle")5351 {5352 Block addToCartNotificationScript = new Block5353 {5354 Id = "AddToCartNotificationScript",5355 Template = RenderAddToCartNotificationToggleScript()5356 };5357 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript);5358 }5359 }5360 }53615362 @helper RenderAddToCartNotificationModal()5363 {5364 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div>5365 }53665367 @helper RenderAddToCartNotificationModalScript()5368 {5369 int cartPageId = GetPageIdByNavigationTag("CartPage");53705371 <script id="LastAddedProductTemplate" type="text/x-template">5372 <!-- Trigger for the login modal -->5373 <input type="checkbox" id="LastAddedProductModalTrigger" class="modal-trigger" />53745375 <!-- Login modal -->5376 <div class="modal-container">5377 <label for="LastAddedProductModalTrigger" class="modal-overlay"></label>5378 <div class="modal modal--md">5379 <div class="modal__header">5380 <h2>@Translate("Product is added to the cart")</h2>5381 </div>5382 <div class="modal__body">5383 <div class="grid">5384 <div class="grid__col-2">5385 <a href="{{productInfo.link}}">5386 <img src="{{productInfo.image}}" alt="{{productInfo.name}}" class="dw-mod" />5387 </a>5388 </div>5389 <div class="u-padding grid--align-self-center">5390 <span>{{quantity}}</span> x5391 </div>5392 <div class="grid__col-auto grid--align-self-center">5393 <div>{{productInfo.name}}</div>5394 {{#if productInfo.variantName}}5395 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small>5396 {{/if}}5397 {{#if productInfo.unitName}}5398 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small>5399 {{/if}}5400 </div>5401 </div>5402 <div class="modal__footer u-margin-top--lg">5403 <label class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" for="LastAddedProductModalTrigger">@Translate("Continue shopping")</label>5404 <a href="/Default.aspx?ID=@cartPageId" class="btn btn--primary u-pull--right u-no-margin dw-mod btn--sm">@Translate("Proceed to checkout")</a>5405 </div>5406 </div>5407 <label class="modal__close-btn" for="LastAddedProductModalTrigger"></label>5408 </div>5409 </div>5410 </script>5411 <script>5412 document.addEventListener('addToCart', function (event) {5413 Cart.ShowLastAddedProductModal(event.detail);5414 });5415 </script>5416 }54175418 @helper RenderAddToCartNotificationToggleScript()5419 {5420 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");54215422 <script>5423 document.addEventListener('addToCart', function () {5424 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId');5425 });5426 </script>5427 }5428 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>54295430 @using System5431 @using System.Web5432 @using System.Collections.Generic5433 @using Dynamicweb.Rapido.Blocks.Extensibility5434 @using Dynamicweb.Rapido.Blocks54355436 @functions {5437 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master");5438 }54395440 @{5441 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content");5442 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content");5443 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content");5444 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header");5445 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header");5446 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header");54475448 Block masterFooterContent = new Block()5449 {5450 Id = "MasterFooterContent",5451 SortId = 10,5452 Template = RenderFooter(),5453 SkipRenderBlocksList = true5454 };5455 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent);54565457 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader))5458 {5459 Block masterFooterColumnOne = new Block5460 {5461 Id = "MasterFooterColumnOne",5462 SortId = 10,5463 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent),5464 Design = new Design {5465 Size = "auto",5466 RenderType = RenderType.Column5467 }5468 };5469 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne);5470 }54715472 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader))5473 {5474 Block masterFooterColumnTwo = new Block5475 {5476 Id = "MasterFooterColumnTwo",5477 SortId = 20,5478 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent),5479 Design = new Design5480 {5481 Size = "auto",5482 RenderType = RenderType.Column5483 }5484 };5485 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo);5486 }54875488 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader))5489 {5490 Block masterFooterColumnThree = new Block5491 {5492 Id = "MasterFooterColumnThree",5493 SortId = 30,5494 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent),5495 Design = new Design5496 {5497 Size = "auto",5498 RenderType = RenderType.Column5499 }5500 };5501 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree);5502 }55035504 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp"))5505 {5506 Block masterFooterNewsletterSignUp = new Block5507 {5508 Id = "MasterFooterNewsletterSignUp",5509 SortId = 40,5510 Template = RenderFooterNewsletterSignUp(),5511 Design = new Design5512 {5513 Size = "auto",5514 RenderType = RenderType.Column5515 }5516 };5517 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp);5518 }55195520 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0)5521 {5522 Block masterFooterSocialLinks = new Block5523 {5524 Id = "MasterFooterSocialLinks",5525 SortId = 50,5526 Template = RenderFooterSocialLinks(),5527 Design = new Design5528 {5529 Size = "auto",5530 RenderType = RenderType.Column5531 }5532 };5533 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks);5534 }55355536 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0)5537 {5538 Block masterFooterPayments = new Block5539 {5540 Id = "MasterFooterPayments",5541 SortId = 60,5542 Template = RenderFooterPayments(),5543 Design = new Design5544 {5545 Size = "12",5546 RenderType = RenderType.Column5547 }5548 };5549 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments);5550 }55515552 Block masterFooterCopyright = new Block5553 {5554 Id = "MasterFooterCopyright",5555 SortId = 70,5556 Template = RenderFooterCopyright(),5557 Design = new Design5558 {5559 Size = "12",5560 RenderType = RenderType.Column5561 }5562 };5563 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright);5564 }55655566 @helper RenderFooter() {5567 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList();55685569 <footer class="footer dw-mod">5570 <div class="center-container top-container__center-container dw-mod">5571 <div class="grid grid--external-bleed-x">5572 @RenderBlockList(subBlocks)5573 </div>5574 </div>5575 </footer>5576 }55775578 @helper RenderFooterColumn(string header, string content) {5579 <h3 class="footer__heading dw-mod">@header</h3>5580 <div class="footer__content dw-mod">5581 @content5582 </div>5583 }55845585 @helper RenderFooterNewsletterSignUp() {5586 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString();55875588 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3>5589 <div class="footer__content dw-mod">5590 <form class="form dw-mod" name="NewsletterRedirect" action='/Default.aspx' method="get" enctype="multipart/form-data">5591 <input name="ID" value="@newsletterSignUpPageId" type="hidden" />5592 <label for="NewsletterEmail" class="u-margin-bottom">@Translate("Sign up if you would like to receive occasional treats from us", "Sign up if you would like to receive occasional treats from us")</label>5593 <div class="form__field-combi">5594 <input name="NewsletterEmail" id="NewsletterEmail" type="text" placeholder='@Translate("Your email address", "Your email address")' class="u-full-width use-btn-primary-height" />5595 <input class="btn btn--primary btn--condensed dw-mod" type="submit" id="Submitter" value='@Translate("Go", "Go")' />5596 </div>5597 </form>5598 </div>5599 }56005601 @helper RenderFooterSocialLinks() {5602 <h3 class="footer__heading dw-mod">@Translate("Social links")</h3>5603 <div class="footer__content dw-mod">5604 <div class="collection dw-mod">5605 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks"))5606 {5607 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel;5608 string socialIconClass = socialIcon.SelectedValue;5609 string socialIconTitle = socialIcon.SelectedName;5610 string socialLink = socialitem.GetString("Link");56115612 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a>5613 }5614 </div>5615 </div>5616 }56175618 @helper RenderFooterPayments() {5619 <div class="footer__content dw-mod">5620 <div class="collection dw-mod">5621 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments"))5622 {5623 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel;5624 string paymentImage = null;5625 string paymentTitle = paymentItem.SelectedName;5626 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault();5627 if (selected != null)5628 {5629 paymentImage = selected.Icon;5630 }56315632 <div class="footer__card-type">5633 <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" />5634 </div>5635 }5636 </div>5637 </div>5638 }56395640 @helper RenderFooterCopyright() {5641 <div class="grid__col-12 footer__copyright dw-mod">5642 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p>5643 </div>5644 }5645 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>56465647 @using System5648 @using System.Web5649 @using System.Collections.Generic5650 @using Dynamicweb.Rapido.Blocks.Extensibility5651 @using Dynamicweb.Rapido.Blocks5652 @using Dynamicweb.Ecommerce.Common56535654 @{5655 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master");56565657 Block masterScriptReferences = new Block()5658 {5659 Id = "MasterScriptReferences",5660 SortId = 1,5661 Template = RenderMasterScriptReferences()5662 };5663 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences);5664 }56655666 @helper RenderMasterScriptReferences()5667 {5668 var partStreamNavTag = GetPageIdByNavigationTag("PartStreamPage");5669 var currentPageId = Pageview.ID;56705671 if (partStreamNavTag == currentPageId)5672 {56735674 }5675 else5676 {56775678 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js" defer></script>5679 <script src="/Files/Templates/Designs/Rapido/js/master.min.js" defer></script>56805681 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript"))5682 {5683 <script src="/Files/Templates/Designs/Rapido/js/custom.min.js" defer></script>5684 PushPromise("/Files/Templates/Designs/Rapido/js/custom.min.js");5685 }56865687 PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js");5688 PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js");5689 }5690 }569156925693 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>56945695 @using System5696 @using System.Web5697 @using System.Collections.Generic5698 @using Dynamicweb.Rapido.Blocks.Extensibility5699 @using Dynamicweb.Rapido.Blocks57005701 @{5702 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master");5703 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");57045705 if (!navigationItemsHideSearch)5706 {5707 Block masterSearchScriptTemplates = new Block()5708 {5709 Id = "MasterSearchScriptTemplates",5710 SortId = 1,5711 Template = RenderSearchScriptTemplates()5712 };57135714 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates);5715 }5716 }57175718 @helper RenderSearchScriptTemplates()5719 {5720 int productsPageId = GetPageIdByNavigationTag("ProductsPage");5721 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;5722 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID"));5723 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0;5724 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID"));5725 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults");5726 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton");5727 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton");5728 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton");5729 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");5730 bool isUserLoggedIn = false;57315732 if (Pageview.User != null)5733 {5734 isUserLoggedIn = true;5735 }573657375738 <script id="SearchGroupsTemplate" type="text/x-template">5739 {{#.}}5740 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li>5741 {{/.}}5742 </script>57435744 <script id="SearchProductsTemplate" type="text/x-template">5745 {{#each .}}5746 {{#Product}}5747 {{#ifCond template "!==" "SearchMore"}}5748 <li class="dropdown__item dropdown__item--seperator dw-mod search-text-list">5749 @if (useFacebookPixel)5750 {5751 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text>5752 }5753 @if (useGoogleTagManager)5754 {5755 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text>5756 }5757 <div>5758 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}">5759 <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=115&height=115&crop=5&FillCanvas=True&Compression=75&image={{image}}" alt="{{name}}"></div>5760 <div class="u-margin-right u-pull--left {{noimage}} mobile-img"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=76&height=76&crop=5&FillCanvas=True&Compression=75&image={{image}}" alt="{{name}}"></div>5761 <div class="search-text-wrapper-parent">5762 <div class="u-pull--left search-text-wrapper">5763 <div class="js-typeahead-name search-text">{{name}} ({{number}})</div>5764 @if (showPrice && !onlyPreview)5765 {5766 if (pointShopOnly)5767 {5768 <text>5769 {{#if havePointPrice}}5770 <div>5771 <span class="u-color--loyalty-points">{{points}} </span> @Translate("points")57725773 </div>5774 {{else}}5775 <small class="help-text u-no-margin">@Translate("Not available")</small>5776 {{/if}}5777 {{#unless canBePurchasedWithPoints}}5778 {{#if havePointPrice}}5779 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small>5780 {{/if}}5781 {{/unless}}5782 </text>5783 }5784 else5785 {578657875788 <text>5789 {{#unless preventWebSale}}5790 {{#if HidePrice}}5791 <div class="item-price">@Translate("*Sign in for pricing")</div>5792 {{/if}}5793 {{#unless HidePrice}}5794 {{#if price}}5795 <div class="item-price">{{price}}</div>5796 {{/if}}5797 {{/unless}}5798 {{/unless}}5799 </text>580058015802 }58035804 }5805 </div>5806 </div>5807 </a>5808 @if (!onlyPreview)5809 {5810 <text>5811 {{#unless preventWebSale}}5812 <div class="icon-cart">58135814 @if (showAddToCartButton)5815 {58165817 if (pointShopOnly)5818 {5819 <text>58205821 {{#unless HidePrice}}582258235824 <button type="button" class="btn btn--primary btn-color-grey btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside {{#unless canBePurchasedWithPoints}}js-stay-disabled{{/unless}}" name="CartCmd" value="addWithPoints"5825 onclick="Cart.AddToCart(event, {5826 id: '{{productId}}',5827 quantity: 1,5828 buyForPoints: true,5829 productInfo: {{productInfo}},5830 }); {{facebookPixelAction}}" {{disabledBuyButton}}>58315832 <i class="icon-color-red @Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i>5833 </button>5834 {{/unless}}5835 </text>5836 }58375838 else5839 {5840 <text>58415842 {{#if HidePrice}}5843 <label for="SignInModalTrigger" onclick="document.getElementById('MobileNavTrigger').checked = false;" class="btn btn-color-grey btn--condensed btn--full u-no-margin dw-mod">5844 <p class="btn-cta"><span class="cta-wrapper">@Translate("Sign in")</span><span>@Translate(" for pricing")</span></p>5845 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon icon-color-red u-hidden-sm"></i>5846 </label>58475848 {{/if}}5849 {{#unless HidePrice}}5850 {{#if price}}5851 <button type="button" class="btn btn-color-grey btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside"5852 onclick="Cart.AddToCart(event, {5853 id: '{{productId}}',5854 quantity: 1,5855 productInfo: {{productInfo}},5856 }); {{facebookPixelAction}}">5857 <p class="btn-cta"><span class="cta-wrapper">@Translate("Add ")</span><span>@Translate("to cart")</span></p>5858 <i class="icon-color-red fa-xl @Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside u-hidden-sm"></i>5859 </button>5860 {{/if}}5861 {{/unless}}5862 </text>586358645865 }5866 <a href="{{link}}" onclick="{{googleImpressionClick}}" class="btn btn--secondary btn--condensed btn--full u-no-margin dw-mod {{hideViewMore}} js-ignore-click-outside" title="@Translate("View")">@Translate("View")</a>5867 }5868 else if (showViewButton)5869 {5870 <a href="{{link}}" onclick="{{googleImpressionClick}}" class="btn btn--secondary btn--condensed btn--full u-no-margin dw-mod js-ignore-click-outside" title="@Translate("View")">@Translate("View")</a>5871 }5872 @if (showAddToDownloadButton)5873 {5874 <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}}">5875 <i class="fas fa-plus js-button-icon"></i>5876 </button>5877 }5878 </div>5879 {{/unless }}5880 </text>5881 }5882 </div>5883 </li>5884 {{/ifCond}}5885 {{#ifCond template "===" "SearchMore"}}5886 {{>SearchMoreProducts}}5887 {{/ifCond}}5888 {{/Product}}5889 {{else}}5890 <li class="dropdown__item dropdown__item--seperator dw-mod">5891 @Translate("Your search gave 0 results")5892 </li>5893 {{/each}}5894 </script>58955896 <script id="SearchMoreProducts" type="text/x-template">5897 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod">5898 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link">5899 @Translate("View all")5900 </a>5901 </li>5902 </script>59035904 <script id="SearchMorePages" type="text/x-template">5905 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod">5906 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link">5907 @Translate("View all")5908 </a>5909 </li>5910 </script>59115912 <script id="SearchPagesTemplate" type="text/x-template">5913 {{#each .}}5914 {{#ifCond template "!==" "SearchMore"}}5915 <li class="dropdown__item dropdown__item--seperator dw-mod">5916 <div>5917 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit">5918 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div>5919 <div class="u-pull--left">5920 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div>5921 </div>5922 </a>5923 </div>5924 </li>5925 {{/ifCond}}5926 {{#ifCond template "===" "SearchMore"}}5927 {{>SearchMorePages}}5928 {{/ifCond}}5929 {{else}}5930 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable dw-mod">5931 @Translate("Your search gave 0 results ")5932 </li>5933 {{/each}}5934 </script>59355936 <script id="SearchPagesTemplateWrap" type="text/x-template">5937 <div class="dropdown__column-header">@Translate("Pages")</div>5938 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod">5939 {{>SearchPagesTemplate}}5940 </ul>5941 </script>59425943 <script id="SearchProductsTemplateWrap" type="text/x-template">5944 <div class="dropdown__column-header">@Translate("Products")</div>5945 <ul class="dropdown__list u-min-w220px search-bar u-margin-bottom dw-mod">5946 {{>SearchProductsTemplate}}5947 </ul>5948 </script>5949 }595059515952 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>59535954 @using System5955 @using System.Web5956 @using System.Collections.Generic5957 @using Dynamicweb.Rapido.Blocks.Extensibility5958 @using Dynamicweb.Rapido.Blocks59595960 @{5961 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master");59625963 Block primaryBottomSnippets = new Block()5964 {5965 Id = "MasterJavascriptInitializers",5966 SortId = 100,5967 Template = RenderPrimaryBottomSnippets()5968 };5969 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets);5970 }59715972 @helper RenderPrimaryBottomSnippets() {5973 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode");5974 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));59755976 if (isWireframeMode)5977 {5978 <script>5979 Wireframe.Init(true);5980 </script>5981 }598259835984 if (useGoogleTagManager)5985 {5986 <script>5987 document.addEventListener('addToCart', function(event) {5988 var googleImpression = event.detail.productInfo.googleImpression;5989 dataLayer.push({5990 'event': 'addToCart',5991 'ecommerce': {5992 'currencyCode': '@Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency().Code',5993 'add': {5994 'products': [{5995 'name': googleImpression.name,5996 'id': googleImpression.id,5997 'price': googleImpression.price,5998 'brand': googleImpression.brand,5999 'category': googleImpression.category,6000 'variant': googleImpression.variant,6001 'quantity': event.detail.quantity6002 }]6003 }6004 }6005 });6006 });6007 </script>6008 }60096010 //if digitalwarehouse6011 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart"))6012 {6013 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]);60146015 if (string.IsNullOrEmpty(cartContextId)) {6016 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2");6017 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps);6018 cartContextId = cartSettings.OrderContextID;6019 HttpContext.Current.Application["DownloadCartContext"] = cartContextId;6020 }60216022 <script>6023 let downloadCart = new DownloadCart({6024 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"),6025 contextId: "@cartContextId",6026 addButtonText: "@Translate("Add")",6027 removeButtonText: "@Translate("Remove")"6028 });6029 </script>6030 }60316032 <!--@Javascripts-->6033 }6034 @if (File.Exists(HttpContext.Current.Server.MapPath("/MasterBlocks/Custom__Blocks.cshtml")))6035 {6036 <text>@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>60376038 @using System6039 @using System.Web6040 @using System.Collections.Generic6041 @using Dynamicweb.Rapido.Blocks60426043 @{6044 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master");60456046 }</text>6047 }604860496050 @functions {6051 public class ManifestIcon6052 {6053 public string src { get; set; }6054 public string type { get; set; }6055 public string sizes { get; set; }6056 }60576058 public class Manifest6059 {6060 public string name { get; set; }6061 public string short_name { get; set; }6062 public string start_url { get; set; }6063 public string display { get; set; }6064 public string background_color { get; set; }6065 public string theme_color { get; set; }6066 public List<ManifestIcon> icons { get; set; }6067 }6068 }6069 @{6070 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) {6071 Manifest manifest = new Manifest6072 {6073 name = Model.Area.Item.GetItem("Settings").GetString("AppName"),6074 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"),6075 start_url = "/",6076 display = "standalone",6077 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"),6078 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor")6079 };60806081 manifest.icons = new List<ManifestIcon> {6082 new ManifestIcon {6083 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,6084 sizes = "192x192",6085 type = "image/png"6086 },6087 new ManifestIcon {6088 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,6089 sizes = "512x512",6090 type = "image/png"6091 },6092 new ManifestIcon {6093 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,6094 sizes = "1024x1024",6095 type = "image/png"6096 }6097 };60986099 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json");6100 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest);6101 string currentManifest = File.ReadAllText(manifestFilePath);61026103 if (manifestJSON != currentManifest)6104 {6105 File.WriteAllText(manifestFilePath, manifestJSON);6106 }6107 }6108 }61096110 @{6111 var swatches = new Dynamicweb.Content.Items.ColorSwatchService();6112 var brandColors = swatches.GetColorSwatch(1);6113 string brandColorOne = brandColors.Palette["BrandColor1"];61146115 HttpCookie ProductPageId = new HttpCookie("ProductPageId", Model.Area.Item.GetItem("Custom").GetString("ProductPage"));6116 ProductPageId.Expires = DateTime.Now.AddDays(7);6117 HttpContext.Current.Response.Cookies.Set(ProductPageId);61186119 HttpCookie PartStreamProductNotFound = new HttpCookie("PartStreamProductNotFoundID", Model.Area.Item.GetItem("Custom").GetString("PartStreamProductNotFound"));6120 PartStreamProductNotFound.Expires = DateTime.Now.AddDays(7);6121 HttpContext.Current.Response.Cookies.Set(PartStreamProductNotFound);6122 }61236124 <!DOCTYPE html>61256126 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName">6127 <head>61286129 <!-- Rapido version 3.1 -->6130 <meta charset="utf-8" />6131 <title>@Model.Title</title>6132 <meta name="viewport" content="width=device-width, initial-scale=1.0">6133 @if (HttpContext.Current.Request.Url.Host.Contains(".stagingsite.dk") || HttpContext.Current.Request.Url.Host.Contains(".ditnyewebsite.dk") || HttpContext.Current.Request.Url.Host.Contains("beta"))6134 {6135 <meta name="robots" content="noindex, nofollow">6136 }6137 else6138 {6139 <meta name="robots" content="index, follow">6140 }6141 <meta name="theme-color" content="@brandColorOne" />6142 @Spaldings.Website.CustomModule.Helpers.Helpers.createCanonical()6143 @Model.MetaTags61446145 <!--Cookiebot -->6146 <!-- <script id="Cookiebot" src="https://consent.cookiebot.com/uc.js" data-cbid="a44b3598-fb04-49f0-a43c-70d512b58837" data-blockingmode="auto" type="text/javascript"></script> -->61476148 <!-- Favicon -->6149 <link href="@favicon" rel="icon" type="image/png">6150 <link rel="preload" as="font" href="/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/webfonts/fa-solid-900.woff2" type="font/woff2" crossorigin>6151 <link rel="preload" as="font" href="/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/webfonts/fa-light-300.woff2" type="font/woff2" crossorigin>6152 <link rel="preload" as="font" href="/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/webfonts/fa-regular-400.woff2" type="font/woff2" crossorigin>6153 <link rel="preload" as="font" href="/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/webfonts/fa-brands-400.woff2" type="font/woff2" crossorigin>6154 <!-- Base (Default, wireframe) styles -->6155 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css?v=1" type="text/css">61566157 <!-- Rapido Css from Website Settings -->6158 <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css">61596160 <!-- Ignite Css (Custom site specific styles) -->6161 <link rel="stylesheet" id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css?v=1">61626163 <!-- Font awesome -->6164 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css">61656166 <!-- Flag icon -->6167 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css">61686169 <!-- Google fonts -->6170 @{6171 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)));6172 }6173 <link rel="preload" href="https://fonts.googleapis.com/css?family=@family" as="style">6174 @{6175 PushPromise(favicon);6176 PushPromise(fontAwesomeCssLink);6177 PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css");6178 PushPromise(autoCssLink);6179 PushPromise("/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css");6180 PushPromise("/Files/Images/placeholder.gif");6181 PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css");6182 }61836184 @if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")))6185 {6186 <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json">6187 PushPromise("/Files/Templates/Designs/Rapido/manifest.json");6188 }61896190 <!-- AddressNow -->6191 <link rel="stylesheet" type="text/css" href="https://api.addressnow.co.uk/css/addressnow-2.20.min.css?key=ra65-gd41-wt49-cr14" /><script type="text/javascript" src="https://api.addressnow.co.uk/js/addressnow-2.20.min.js?key=ra65-gd41-wt49-cr14"></script>61926193 <!--ShareThis-->6194 <!-- <script type="text/javascript" src="https://platform-api.sharethis.com/js/sharethis.js#property=672df6a5fb20e60013270b1a&product=sticky-share-buttons&source=platform" async="async"></script>-->61956196 <!--Plausible -->6197 <script>6198 var script = document.createElement('script');6199 script.defer = true;6200 script.dataset.domain = "spl.stagingsite.dk";6201 script.dataset.api = https://plausible.io/api/event;6202 script.src = https://plausible.io/js/script.hash.revenue.tagged-events.js;6203 document.getElementsByTagName('head')[0].appendChild(script);6204 </script>62056206 <!-- Captcha -->6207 <script src="https://www.google.com/recaptcha/api.js" async defer></script>6208 </head>62096210 <body>62116212 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@6213 @RenderBlockList(masterPage.BlocksRoot.BlocksList)621462156216 @helper RenderMasterHeader()6217 {6218 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList();6219 bool isNavigationStickyMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop");6220 <!--Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop");-->6221 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : "";62226223 <header class="top-container @stickyTop dw-mod" id="Top">6224 @RenderBlockList(subBlocks)6225 </header>6226 }62276228 @helper RenderMain()6229 {6230 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList();62316232 <main class="site dw-mod">6233 @RenderBlockList(subBlocks)6234 </main>6235 }62366237 @helper RenderPageContent()6238 {6239 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop");6240 string pagePos = isNavigationStickyMenu ? "js-page-pos" : "";62416242 <div id="Page" class="page @pagePos">6243 <section class="center-container content-container dw-mod" id="content">6244 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>624562466247 @using Dynamicweb.Rapido.Blocks.Components6248 @using Dynamicweb.Rapido.Blocks.Components.Articles6249 @using Dynamicweb.Rapido.Blocks.Components.General6250 @using Dynamicweb.Rapido.Blocks62516252 @functions {6253 BlocksPage articlePage = BlocksPage.GetBlockPage("BlogArticle");6254 }62556256 @{6257 ArticleHeader topBanner = new ArticleHeader6258 {6259 Layout = ArticleHeaderLayout.Banner,6260 Image = new Image { Path = Model.Item.GetFile("Image").PathUrlEncoded },6261 Heading = Model.Item.GetString("Title"),6262 Subheading = Model.Item.GetString("Summary"),6263 TextColor = "#fff",6264 Category = Model.Item.GetString("Author"),6265 Date = Model.Item.GetString("Date"),6266 ButtonLayout = ButtonLayout.Primary,6267 TextLayout = ArticleHeaderTextLayout.Full6268 };62696270 Block articleContainer = new Block6271 {6272 Id = "ArticleContainer",6273 SortId = 10,6274 Design = new Design6275 {6276 RenderType = RenderType.Row6277 },6278 BlocksList = new List<Block> {6279 new Block {6280 Id = "ArticleHeader",6281 SortId = 20,6282 Component = topBanner,6283 Design = new Design {6284 RenderType = RenderType.Column,6285 Size = "12",6286 HidePadding = true,6287 CssClass = "article-head"6288 }6289 },6290 new Block {6291 Id = "ArticleBody",6292 SortId = 30,6293 Design = new Design {6294 RenderType = RenderType.Column,6295 Size = "8"6296 },6297 BlocksList = new List<Block> {6298 new Block {6299 Id = "ArticleBodyRow",6300 SortId = 10,6301 Design = new Design {6302 RenderType = RenderType.Row6303 },6304 BlocksList = new List<Block> {6305 new Block {6306 Id = "ArticleText",6307 SortId = 10,6308 Component = new ArticleText { Text = Model.Item.GetString("Text") },6309 Design = new Design {6310 RenderType = RenderType.Column,6311 Size = "12",6312 CssClass = "u-padding--lg"6313 }6314 },6315 new Block {6316 Id = "ArticleLink",6317 SortId = 20,6318 Component = new ArticleLink { Link = Model.Item.GetString("Link"), Title = Model.Item.GetString("LinkText"), ButtonLayout = ButtonLayout.Primary },6319 Design = new Design {6320 RenderType = RenderType.Column,6321 Size = "12",6322 CssClass = "u-padding--lg u-ta-right"6323 }6324 }6325 }6326 }6327 }6328 }6329 }6330 };6331 articlePage.Add(articleContainer);63326333 if (Model.PropertyItem.GetList("ShowBreadcrumb").SelectedValue == "True")6334 {6335 Block breadcrumb = new Block6336 {6337 Id = "ArticleBreadcrumb",6338 SortId = 10,6339 Component = new BreadcrumbNavigation { },6340 Design = new Design6341 {6342 RenderType = RenderType.Column,6343 Size = "12"6344 }6345 };6346 articlePage.Add("ArticleContainer", breadcrumb);6347 }6348 }63496350 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@6351 @RenderBlockList(articlePage.BlocksRoot.BlocksList)63526353 </section>6354 </div>6355 }6356635763586359 </body>6360 </html>63616362