Error executing template "Designs/Rapido/_parsed/Page.parsed.cshtml"System.NullReferenceException: Object reference not set to an instance of an object.at CompiledRazorTemplates.Dynamic.RazorEngine_99750b24105a40b89852782ec85071b2.b__194_0(TextWriter __razor_helper_writer) in F:\Domains\Sites\precisionathleticsvb.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7308at CompiledRazorTemplates.Dynamic.RazorEngine_99750b24105a40b89852782ec85071b2.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in F:\Domains\Sites\precisionathleticsvb.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 251at CompiledRazorTemplates.Dynamic.RazorEngine_99750b24105a40b89852782ec85071b2.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in F:\Domains\Sites\precisionathleticsvb.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 159at CompiledRazorTemplates.Dynamic.RazorEngine_99750b24105a40b89852782ec85071b2.b__193_0(TextWriter __razor_helper_writer) in F:\Domains\Sites\precisionathleticsvb.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7249at CompiledRazorTemplates.Dynamic.RazorEngine_99750b24105a40b89852782ec85071b2.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in F:\Domains\Sites\precisionathleticsvb.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 251at CompiledRazorTemplates.Dynamic.RazorEngine_99750b24105a40b89852782ec85071b2.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in F:\Domains\Sites\precisionathleticsvb.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 159at CompiledRazorTemplates.Dynamic.RazorEngine_99750b24105a40b89852782ec85071b2.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in F:\Domains\Sites\precisionathleticsvb.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 282at CompiledRazorTemplates.Dynamic.RazorEngine_99750b24105a40b89852782ec85071b2.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in F:\Domains\Sites\precisionathleticsvb.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 159at CompiledRazorTemplates.Dynamic.RazorEngine_99750b24105a40b89852782ec85071b2.Execute() in F:\Domains\Sites\precisionathleticsvb.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7239at 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.Linq 12 @using System.Collections.Generic 13 @using System.Web 14 @using System.IO 15 @using Dynamicweb.Rapido.Blocks 16 @using System.Net 17 18 19 20 @functions { 21 BlocksPage masterPage = BlocksPage.GetBlockPage("Master"); 22 23 string getFontFamily(params string[] items) 24 { 25 var itemParent = Pageview.AreaSettings; 26 foreach (var item in items) 27 { 28 itemParent = itemParent.GetItem(item); 29 if (itemParent == null) 30 { 31 return null; 32 } 33 } 34 35 var googleFont = itemParent.GetGoogleFont("FontFamily"); 36 if (googleFont == null) 37 { 38 return null; 39 } 40 return googleFont.Family.Replace(" ", "+"); 41 } 42 } 43 44 @{ 45 Block root = new Block 46 { 47 Id = "Root", 48 SortId = 10, 49 BlocksList = new List<Block> 50 { 51 new Block { 52 Id = "Head", 53 SortId = 10, 54 SkipRenderBlocksList = true, 55 Template = RenderMasterHead(), 56 BlocksList = new List<Block> 57 { 58 new Block { 59 Id = "HeadMetadata", 60 SortId = 10, 61 Template = RenderMasterMetadata(), 62 }, 63 new Block { 64 Id = "HeadCss", 65 SortId = 20, 66 Template = RenderMasterCss(), 67 }, 68 new Block { 69 Id = "HeadManifest", 70 SortId = 30, 71 Template = RenderMasterManifest(), 72 } 73 } 74 }, 75 new Block { 76 Id = "Body", 77 SortId = 20, 78 SkipRenderBlocksList = true, 79 Template = RenderMasterBody(), 80 BlocksList = new List<Block> 81 { 82 new Block() 83 { 84 Id = "Master", 85 SortId = 10, 86 BlocksList = new List<Block> { 87 new Block { 88 Id = "MasterTopSnippets", 89 SortId = 10 90 }, 91 new Block { 92 Id = "MasterMain", 93 SortId = 20, 94 Template = RenderMain(), 95 SkipRenderBlocksList = true, 96 BlocksList = new List<Block> { 97 new Block { 98 Id = "MasterHeader", 99 SortId = 10,100 Template = RenderMasterHeader(),101 SkipRenderBlocksList = true102 },103 new Block {104 Id = "MasterPageContent",105 SortId = 20,106 Template = RenderPageContent()107 }108 }109 },110 new Block {111 Id = "MasterFooter",112 SortId = 30113 },114 new Block {115 Id = "MasterReferences",116 SortId = 40117 },118 new Block {119 Id = "MasterBottomSnippets",120 SortId = 50121 }122 }123 }124 }125 }126 }127 };128129 masterPage.Add(root);130 }131132 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@133 @using System.Text.RegularExpressions134 @using System.Collections.Generic135 @using System.Reflection136 @using System.Web137 @using System.Web.UI.HtmlControls138 @using Dynamicweb.Rapido.Blocks.Components139 @using Dynamicweb.Rapido.Blocks.Components.Articles140 @using Dynamicweb.Rapido.Blocks.Components.Documentation141 @using Dynamicweb.Rapido.Blocks142143144 @*--- START: Base block renderers ---*@145146 @helper RenderBlockList(List<Block> blocks)147 {148 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false;149 blocks = blocks.OrderBy(item => item.SortId).ToList();150151 foreach (Block item in blocks)152 {153 if (debug) {154 <!-- Block START: @item.Id -->155 }156157 if (item.Design == null)158 {159 @RenderBlock(item)160 }161 else if (item.Design.RenderType == RenderType.None) {162 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : "";163164 <div class="@cssClass dw-mod">165 @RenderBlock(item)166 </div>167 }168 else if (item.Design.RenderType != RenderType.Hide)169 {170 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : "";171172 if (!item.SkipRenderBlocksList) {173 if (item.Design.RenderType == RenderType.Row)174 {175 <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id">176 @RenderBlock(item)177 </div>178 }179180 if (item.Design.RenderType == RenderType.Column)181 {182 string hidePadding = item.Design.HidePadding ? "u-no-padding" : "";183 string size = item.Design.Size ?? "12";184 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size;185186 <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">187 @RenderBlock(item)188 </div>189 }190191 if (item.Design.RenderType == RenderType.Table)192 {193 <table class="table @cssClass dw-mod" id="Block__@item.Id">194 @RenderBlock(item)195 </table>196 }197198 if (item.Design.RenderType == RenderType.TableRow)199 {200 <tr class="@cssClass dw-mod" id="Block__@item.Id">201 @RenderBlock(item)202 </tr>203 }204205 if (item.Design.RenderType == RenderType.TableColumn)206 {207 <td class="@cssClass dw-mod" id="Block__@item.Id">208 @RenderBlock(item)209 </td>210 }211212 if (item.Design.RenderType == RenderType.CardHeader)213 {214 <div class="card-header @cssClass dw-mod">215 @RenderBlock(item)216 </div>217 }218219 if (item.Design.RenderType == RenderType.CardBody)220 {221 <div class="card @cssClass dw-mod">222 @RenderBlock(item)223 </div>224 }225226 if (item.Design.RenderType == RenderType.CardFooter)227 {228 <div class="card-footer @cssClass dw-mod">229 @RenderBlock(item)230 </div>231 }232 }233 else234 {235 @RenderBlock(item)236 }237 }238239 if (debug) {240 <!-- Block END: @item.Id -->241 }242 }243 }244245 @helper RenderBlock(Block item)246 {247 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false;248249 if (item.Template != null)250 {251 @BlocksPage.RenderTemplate(item.Template)252 }253254 if (item.Component != null)255 {256 string customSufix = "Custom";257 string methodName = item.Component.HelperName;258259 ComponentBase[] methodParameters = new ComponentBase[1];260 methodParameters[0] = item.Component;261 Type methodType = this.GetType();262263 MethodInfo customMethod = methodType.GetMethod(methodName + customSufix);264 MethodInfo generalMethod = methodType.GetMethod(methodName);265266 try {267 if (debug) {268 <!-- Component: @methodName.Replace("Render", "") -->269 }270 @customMethod.Invoke(this, methodParameters).ToString();271 } catch {272 try {273 @generalMethod.Invoke(this, methodParameters).ToString();274 } catch(Exception ex) {275 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked", ex);276 }277 }278 }279280 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList)281 {282 @RenderBlockList(item.BlocksList)283 }284 }285286 @*--- END: Base block renderers ---*@287288289 @* Include the components *@290 @using Dynamicweb.Rapido.Blocks.Components291 @using Dynamicweb.Rapido.Blocks.Components.General292 @using Dynamicweb.Rapido.Blocks293 @using System.IO294295 @* Required *@296 @using Dynamicweb.Rapido.Blocks.Components297 @using Dynamicweb.Rapido.Blocks.Components.General298 @using Dynamicweb.Rapido.Blocks299300301 @helper Render(ComponentBase component)302 {303 if (component != null)304 {305 @component.Render(this)306 }307 }308309310 @* Components *@311 @using System.Reflection312 @using Dynamicweb.Rapido.Blocks.Components.General313314315 @* Component *@316317 @helper RenderIcon(Icon settings) {318 if (settings != null)319 {320 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : "";321322 if (settings.Name != null)323 {324 if (string.IsNullOrEmpty(settings.Label))325 {326 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i>327 }328 else329 {330 if (settings.LabelPosition == IconLabelPosition.Before)331 {332 <span>@settings.Label <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i></span>333 }334 else335 {336 <span><i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> @settings.Label</span>337 }338 }339 }340 }341 }342 @using System.Reflection343 @using Dynamicweb.Rapido.Blocks.Components.General344 @using Dynamicweb.Rapido.Blocks.Components345 @using Dynamicweb.Core346347 @* Component *@348349 @helper RenderButton(Button settings)350 {351 if (settings != null && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null))352 {353 Dictionary<string, string> attributes = new Dictionary<string, string>();354 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>();355 if (settings.Disabled) {356 attributes.Add("disabled", "true");357 classList.Add("disabled");358 }359360 if (!string.IsNullOrEmpty(settings.ConfirmText) || !string.IsNullOrEmpty(settings.ConfirmTitle))361 {362 settings.Id = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N");363 @RenderConfirmDialog(settings);364 settings.OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = true";365 }366367 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }368 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }369 if (!string.IsNullOrEmpty(settings.AltText))370 {371 attributes.Add("title", settings.AltText);372 }373 else if (!string.IsNullOrEmpty(settings.Title))374 {375 attributes.Add("title", settings.Title);376 }377378 var onClickEvents = new List<string>();379 if (!string.IsNullOrEmpty(settings.OnClick))380 {381 onClickEvents.Add(settings.OnClick);382 }383 if (!string.IsNullOrEmpty(settings.Href))384 {385 onClickEvents.Add("location.href='" + settings.Href + "'");386 }387 if (onClickEvents.Count > 0)388 {389 attributes.Add("onClick", string.Join(";", onClickEvents));390 }391392 if (settings.ButtonLayout != ButtonLayout.None)393 {394 classList.Add("btn");395 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower();396 if (btnLayout == "linkclean")397 {398 btnLayout = "link-clean"; //fix399 }400 classList.Add("btn--" + btnLayout);401 }402403 string content = settings.Title;404 if (settings.Icon != null)405 {406 content = settings.Icon.LabelPosition == IconLabelPosition.Before ?407 Converter.ToString(Render(settings.Icon)) + content :408 content + Converter.ToString(Render(settings.Icon));409 }410411 attributes.Add("type", Enum.GetName(typeof(ButtonType), settings.ButtonType).ToLower());412413 <button class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@content</button>414 }415 }416417 @helper RenderConfirmDialog(Button settings)418 {419 Modal confirmDialog = new Modal {420 Id = settings.Id,421 Width = ModalWidth.Sm,422 Heading = new Heading423 {424 Level = 2,425 Title = settings.ConfirmTitle426 },427 BodyText = settings.ConfirmText428 };429430 confirmDialog.AddAction(new Button { Title = Translate("Cancel"), ButtonLayout = ButtonLayout.Secondary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false"});431 confirmDialog.AddAction(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false;" + settings.OnClick });432433 @Render(confirmDialog)434 }435 @using System.Reflection436 @using Dynamicweb.Rapido.Blocks.Components.General437 @using Dynamicweb.Rapido.Blocks.Components438 @using Dynamicweb.Core439440 @* Component *@441442 @helper RenderLink(Link settings)443 {444 if (settings != null && !string.IsNullOrEmpty(settings.Href) && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null))445 {446 Dictionary<string, string> attributes = new Dictionary<string, string>();447 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>();448 if (settings.Disabled)449 {450 attributes.Add("disabled", "true");451 classList.Add("disabled");452 }453454 if (!string.IsNullOrEmpty(settings.AltText))455 {456 attributes.Add("title", settings.AltText);457 }458 else if (!string.IsNullOrEmpty(settings.Title))459 {460 attributes.Add("title", settings.Title);461 }462463 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }464 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }465 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onClick", settings.OnClick); }466 attributes.Add("href", settings.Href);467468 if (settings.ButtonLayout != ButtonLayout.None)469 {470 classList.Add("btn");471 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower();472 if (btnLayout == "linkclean")473 {474 btnLayout = "link-clean"; //fix475 }476 classList.Add("btn--" + btnLayout);477 }478479 string content = settings.Title;480 if (settings.Icon != null)481 {482 content = settings.Icon.LabelPosition == IconLabelPosition.Before ?483 Converter.ToString(Render(settings.Icon)) + content :484 content + Converter.ToString(Render(settings.Icon));485 }486487 if (settings.Target == LinkTargetType.Blank && settings.Rel == LinkRelType.None)488 {489 settings.Rel = LinkRelType.Noopener;490 }491 if (settings.Target != LinkTargetType.None)492 {493 attributes.Add("target", "_" + Enum.GetName(typeof(LinkTargetType), settings.Target).ToLower());494 }495 if (settings.Download)496 {497 attributes.Add("download", "true");498 }499 if (settings.Rel != LinkRelType.None)500 {501 attributes.Add("rel", Enum.GetName(typeof(LinkRelType), settings.Rel).ToLower());502 }503504 <a class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@content</a>505 }506 }507 @using System.Reflection508 @using Dynamicweb.Rapido.Blocks.Components509 @using Dynamicweb.Rapido.Blocks.Components.General510 @using Dynamicweb.Rapido.Blocks511512513 @* Component *@514515 @helper RenderRating(Rating settings)516 {517 if (settings.Score > 0)518 {519 int rating = settings.Score;520 string iconType = "fa-star";521522 switch (settings.Type.ToString()) {523 case "Stars":524 iconType = "fa-star";525 break;526 case "Hearts":527 iconType = "fa-heart";528 break;529 case "Lemons":530 iconType = "fa-lemon";531 break;532 case "Bombs":533 iconType = "fa-bomb";534 break;535 }536537 <div class="u-ta-right">538 @for (int i = 0; i < settings.OutOf; i++)539 {540 <i class="@(rating > i ? "fas" : "far") @iconType"></i>541 }542 </div>543 }544 }545 @using System.Reflection546 @using Dynamicweb.Rapido.Blocks.Components.General547 @using Dynamicweb.Rapido.Blocks.Components548549550 @* Component *@551552 @helper RenderSelectFieldOption(SelectFieldOption settings)553 {554 Dictionary<string, string> attributes = new Dictionary<string, string>();555 if (settings.Checked) { attributes.Add("selected", "true"); }556 if (settings.Disabled) { attributes.Add("disabled", "true"); }557 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); }558559 <option @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Label</option>560 }561 @using System.Reflection562 @using Dynamicweb.Rapido.Blocks.Components.General563 @using Dynamicweb.Rapido.Blocks.Components564565566 @* Component *@567568 @helper RenderNavigation(Navigation settings) {569 @RenderNavigation(new570 {571 id = settings.Id,572 cssclass = settings.CssClass,573 startLevel = settings.StartLevel,574 endlevel = settings.EndLevel,575 expandmode = settings.Expandmode,576 template = settings.Template577 })578 }579 @using Dynamicweb.Rapido.Blocks.Components.General580 @using Dynamicweb.Rapido.Blocks.Components581582583 @* Component *@584585 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) {586 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id;587 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template;588 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel;589 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel;590 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode;591592 @RenderNavigation(settings)593 }594 @using Dynamicweb.Rapido.Blocks.Components.General595 @using Dynamicweb.Rapido.Blocks.Components596597598 @* Component *@599600 @helper RenderLeftNavigation(LeftNavigation settings) {601 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id;602 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template;603 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel;604 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel;605 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode;606607 <div class="grid__cell">608 @RenderNavigation(settings)609 </div>610 }611 @using System.Reflection612 @using Dynamicweb.Rapido.Blocks.Components.General613 @using Dynamicweb.Core614615 @* Component *@616617 @helper RenderHeading(Heading settings)618 {619 if (settings != null && !string.IsNullOrEmpty(settings.Title))620 {621 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : "";622 string tagName = "h" + settings.Level.ToString();623624 @("<" + tagName + " class=\"" + settings.CssClass + " dw-mod\" " + color + ">")625 if (!string.IsNullOrEmpty(settings.Link))626 {627 @Render(new Link { Href = settings.Link, Icon = settings.Icon, Title = settings.Title, ButtonLayout = ButtonLayout.None })628 }629 else630 {631 string content = settings.Title;632 if (settings.Icon != null)633 {634 content = settings.Icon.LabelPosition == IconLabelPosition.Before ?635 Converter.ToString(Render(settings.Icon)) + content :636 content + Converter.ToString(Render(settings.Icon));637 }638 @content639 }640 @("</" + tagName + ">");641 }642 }643 @using Dynamicweb.Rapido.Blocks.Components644 @using Dynamicweb.Rapido.Blocks.Components.General645 @using Dynamicweb.Rapido.Blocks646647648 @* Component *@649650 @helper RenderImage(Image settings)651 {652 if (settings.FilterPrimary != ImageFilter.None || settings.FilterSecondary != ImageFilter.None)653 {654 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>();655 if (!String.IsNullOrEmpty(settings.FilterColor)) { optionalAttributes.Add("style", "background-color: " + settings.FilterColor); }656657 if (settings.Caption != null)658 {659 @:<div>660 }661662 <div class="image-filter image-filter--@settings.FilterPrimary.ToString().ToLower() u-position-relative dw-mod" @ComponentMethods.AddAttributes(optionalAttributes)>663 <div class="image-filter image-filter--@settings.FilterSecondary.ToString().ToLower() dw-mod">664 @if (settings.Link != null)665 {666 <a href="@settings.Link">667 @RenderTheImage(settings)668 </a>669 }670 else671 {672 @RenderTheImage(settings)673 }674 </div>675 </div>676677 if (settings.Caption != null)678 {679 <span class="image-caption dw-mod">@settings.Caption</span>680 @:</div>681 }682 }683 else684 {685 if (settings.Caption != null)686 {687 @:<div>688 }689 if (!string.IsNullOrEmpty(settings.Link))690 {691 <a href="@settings.Link">692 @RenderTheImage(settings)693 </a>694 }695 else696 {697 @RenderTheImage(settings)698 }699700 if (settings.Caption != null)701 {702 <span class="image-caption dw-mod">@settings.Caption</span>703 @:</div>704 }705 }706 }707708 @functions {709 string getImagePathFromSettings(ImageSettings settings)710 {711 string result = "";712713 if (settings != null)714 {715 result += settings.Width != 0 ? "Width=" + settings.Width + "&" : "";716 result += settings.Height != 0 ? "Height=" + settings.Height + "&" : "";717 result += "Crop=" + settings.Crop + "&";718 result += "Compression=" + settings.Compression + "&";719 result += "DoNotUpscale=" + settings.DoNotUpscale.ToString() + "&";720 result += "FillCanvas=" + settings.FillCanvas.ToString() + "&";721 }722723 return result;724 }725 }726727 @helper RenderTheImage(Image settings)728 {729 if (settings != null)730 {731 string placeholderImage = "/Files/Images/placeholder.gif";732 string imageEngine = "/Admin/Public/GetImage.ashx?";733734 string imageStyle = "";735736 switch (settings.Style)737 {738 case ImageStyle.Ball:739 imageStyle = "grid__cell-img--ball";740 break;741 }742743 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle)744 {745 if (settings.ImageDefault != null)746 {747 settings.ImageDefault.Height = settings.ImageDefault.Width;748 }749 if (settings.ImageMedium != null)750 {751 settings.ImageMedium.Height = settings.ImageMedium.Width;752 }753 if (settings.ImageSmall != null)754 {755 settings.ImageSmall.Height = settings.ImageSmall.Width;756 }757 }758759 string defaultImage = imageEngine;760 string imageSmall = "";761 string imageMedium = "";762763 if (settings.DisableImageEngine) {764 defaultImage = settings.Path;765 } else {766 if (settings.ImageDefault != null)767 {768 defaultImage += getImagePathFromSettings(settings.ImageDefault);769770 if (settings.Path.GetType() != typeof(string))771 {772 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";773 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";774 }775 else776 {777 defaultImage += settings.Path != null ? "Image=" + settings.Path : "";778 }779 }780781 if (settings.ImageSmall != null)782 {783 imageSmall = "data-src-small=\"" + imageEngine;784 imageSmall += getImagePathFromSettings(settings.ImageSmall);785786 if (settings.Path.GetType() != typeof(string))787 {788 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";789 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";790 }791 else792 {793 imageSmall += settings.Path != null ? "Image=" + settings.Path : "";794 }795796 imageSmall += "\"";797 }798799 if (settings.ImageMedium != null)800 {801 imageMedium = "data-src-medium=\"" + imageEngine;802 imageMedium += getImagePathFromSettings(settings.ImageMedium);803804 if (settings.Path.GetType() != typeof(string))805 {806 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";807 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";808 }809 else810 {811 imageMedium += settings.Path != null ? "Image=" + settings.Path : "";812 }813814 imageMedium += "\"";815 }816 }817818 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>();819 if (!string.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); }820 if (!string.IsNullOrEmpty(settings.Title))821 {822 optionalAttributes.Add("alt", settings.Title);823 optionalAttributes.Add("title", settings.Title);824 }825826 if (settings.DisableLazyLoad) {827 <img id="@settings.Id" class="@imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) />828 } else {829 <img id="@settings.Id" class="b-lazy @imageStyle @settings.CssClass dw-mod" src="@placeholderImage" data-src="@defaultImage" @imageSmall @imageMedium @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) />830 }831 }832 }833 @using System.Reflection834 @using Dynamicweb.Rapido.Blocks.Components.General835 @using Dynamicweb.Rapido.Blocks.Components836837 @* Component *@838839 @helper RenderFileField(FileField settings)840 {841 var attributes = new Dictionary<string, string>();842 if (string.IsNullOrEmpty(settings.Id))843 {844 settings.Id = Guid.NewGuid().ToString("N");845 }846847 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }848 if (settings.Disabled) { attributes.Add("disabled", "true"); }849 if (settings.Required) { attributes.Add("required", "true"); }850 if (settings.Multiple) { attributes.Add("multiple", "true"); }851 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }852 if (string.IsNullOrEmpty(settings.ChooseFileText))853 {854 settings.ChooseFileText = Translate("Choose file");855 }856 if (string.IsNullOrEmpty(settings.NoFilesChosenText))857 {858 settings.NoFilesChosenText = Translate("No files chosen...");859 }860 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }861862 string setValueToFakeInput = "FileUpload.setValueToFakeInput(this)";863 attributes.Add("onchange", setValueToFakeInput + (!string.IsNullOrEmpty(settings.OnChange) ? settings.OnChange : ""));864865 attributes.Add("type", "file");866 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); }867 settings.CssClass = "u-full-width " + settings.CssClass;868869 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);870871 <div class="form__field-group u-full-width dw-mod">872 @if (!string.IsNullOrEmpty(settings.Label))873 {874 <label for="@settings.Id">@settings.Label</label>875 }876 @if (!string.IsNullOrEmpty(settings.HelpText))877 {878 <small class="form__help-text">@settings.HelpText</small>879 }880881 <div class="form__field-combi file-input u-no-margin dw-mod">882 <input @ComponentMethods.AddAttributes(resultAttributes) class="file-input__real-input" data-no-files-text="@settings.NoFilesChosenText" data-many-files-text="@Translate("files")" />883 <label for="@settings.Id" class="file-input__btn btn--secondary btn dw-mod">@settings.ChooseFileText</label>884 <label for="@settings.Id" class="@settings.CssClass file-input__fake-input js-fake-input dw-mod">@settings.NoFilesChosenText</label>885 @if (settings.UploadButton != null)886 {887 settings.UploadButton.CssClass += " btn--condensed u-no-margin";888 @Render(settings.UploadButton)889 }890 </div>891 @Render(new NotificationMessage { Message = settings.ErrorMessage })892 </div>893 }894 @using System.Reflection895 @using Dynamicweb.Rapido.Blocks.Components.General896 @using Dynamicweb.Rapido.Blocks.Components897 @using Dynamicweb.Core898899 @* Component *@900901 @helper RenderDateTimeField(DateTimeField settings)902 {903 if (string.IsNullOrEmpty(settings.Id))904 {905 settings.Id = Guid.NewGuid().ToString("N");906 }907908 var textField = new TextField {909 Name = settings.Name,910 Id = settings.Id,911 Label = settings.Label,912 HelpText = settings.HelpText,913 Value = settings.Value,914 Disabled = settings.Disabled,915 Required = settings.Required,916 ErrorMessage = settings.ErrorMessage,917 CssClass = settings.CssClass,918 OnChange = settings.OnChange,919 OnClick = settings.OnClick,920 ExtraAttributes = settings.ExtraAttributes,921 //922 Placeholder = settings.Placeholder923 };924925 @Render(textField)926927 List<string> jsAttributes = new List<string>();928929 jsAttributes.Add("mode: '" + Enum.GetName(typeof(DateTimeFieldMode), settings.Mode).ToLower() + "'");930931 if (!string.IsNullOrEmpty(settings.DateFormat))932 {933 jsAttributes.Add("dateFormat: '" + settings.DateFormat + "'");934 }935 if (!string.IsNullOrEmpty(settings.MinDate))936 {937 jsAttributes.Add("minDate: '" + settings.MinDate + "'");938 }939 if (!string.IsNullOrEmpty(settings.MaxDate))940 {941 jsAttributes.Add("maxDate: '" + settings.MaxDate + "'");942 }943 if (settings.IsInline)944 {945 jsAttributes.Add("inline: " + Converter.ToString(settings.IsInline).ToLower());946 }947 if (settings.EnableTime)948 {949 jsAttributes.Add("enableTime: " + Converter.ToString(settings.EnableTime).ToLower());950 }951 if (settings.EnableWeekNumbers)952 {953 jsAttributes.Add("weekNumbers: " + Converter.ToString(settings.EnableWeekNumbers).ToLower());954 }955956 <script>957 document.addEventListener("DOMContentLoaded", function () {958 flatpickr("#@textField.Id", {959 @string.Join(",", jsAttributes)960 });961 });962 </script>963 }964 @using System.Reflection965 @using Dynamicweb.Rapido.Blocks.Components.General966 @using Dynamicweb.Rapido.Blocks.Components967968 @* Component *@969970 @helper RenderTextField(TextField settings)971 {972 var attributes = new Dictionary<string, string>();973 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))974 {975 settings.Id = Guid.NewGuid().ToString("N");976 }977978 /*base settings*/979 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }980 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }981 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }982 if (settings.Disabled) { attributes.Add("disabled", "true"); }983 if (settings.Required) { attributes.Add("required", "true"); }984 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }985 /*end*/986987 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }988 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }989 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }990 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }991 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); }992 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); }993 attributes.Add("type", Enum.GetName(typeof(TextFieldType), settings.Type).ToLower());994 if (settings.Type == TextFieldType.Password) { attributes.Add("autocomplete", "off"); };995 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); }996 settings.CssClass = "u-full-width " + settings.CssClass;997998 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);9991000 <div class="form__field-group u-full-width dw-mod">1001 @if (!string.IsNullOrEmpty(settings.Label))1002 {1003 <label for="@settings.Id">@settings.Label</label>1004 }1005 @if (!string.IsNullOrEmpty(settings.HelpText))1006 {1007 <small class="form__help-text">@settings.HelpText</small>1008 }10091010 @if (settings.ActionButton != null)1011 {1012 settings.ActionButton.CssClass += " btn--condensed u-no-margin";1013 <div class="form__field-combi u-no-margin dw-mod">1014 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />1015 @Render(settings.ActionButton)1016 </div>1017 }1018 else1019 {1020 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />1021 }10221023 @Render(new NotificationMessage { Message = settings.ErrorMessage })1024 </div>1025 }1026 @using System.Reflection1027 @using Dynamicweb.Rapido.Blocks.Components.General1028 @using Dynamicweb.Rapido.Blocks.Components10291030 @* Component *@10311032 @helper RenderNumberField(NumberField settings)1033 {1034 var attributes = new Dictionary<string, string>();1035 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))1036 {1037 settings.Id = Guid.NewGuid().ToString("N");1038 }10391040 /*base settings*/1041 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }1042 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }1043 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }1044 if (settings.Disabled) { attributes.Add("disabled", "true"); }1045 if (settings.Required) { attributes.Add("required", "true"); }1046 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }1047 /*end*/10481049 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }1050 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }1051 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }1052 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }1053 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); }1054 if (settings.Min != null) { attributes.Add("min", settings.Min.ToString()); }1055 if (settings.Step != 0) { attributes.Add("step", settings.Step.ToString()); }1056 if (settings.Value != null && !string.IsNullOrEmpty(settings.Value.ToString())) { attributes.Add("value", settings.Value.ToString()); }1057 attributes.Add("type", "number");10581059 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);10601061 <div class="form__field-group u-full-width dw-mod">1062 @if (!string.IsNullOrEmpty(settings.Label))1063 {1064 <label for="@settings.Id">@settings.Label</label>1065 }1066 @if (!string.IsNullOrEmpty(settings.HelpText))1067 {1068 <small class="form__help-text">@settings.HelpText</small>1069 }10701071 @if (settings.ActionButton != null)1072 {1073 settings.ActionButton.CssClass += " btn--condensed u-no-margin";1074 <div class="form__field-combi u-no-margin dw-mod">1075 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />1076 @Render(settings.ActionButton)1077 </div>1078 }1079 else1080 {1081 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />1082 }10831084 @Render(new NotificationMessage { Message = settings.ErrorMessage })1085 </div>1086 }1087 @using System.Reflection1088 @using Dynamicweb.Rapido.Blocks.Components.General1089 @using Dynamicweb.Rapido.Blocks.Components109010911092 @* Component *@10931094 @helper RenderTextareaField(TextareaField settings)1095 {1096 Dictionary<string, string> attributes = new Dictionary<string, string>();1097 string id = settings.Id;1098 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(id))1099 {1100 id = Guid.NewGuid().ToString("N");1101 }11021103 if (!string.IsNullOrEmpty(id)) { attributes.Add("id", id); }1104 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }1105 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }1106 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }1107 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }1108 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }1109 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); }1110 if (settings.Disabled) { attributes.Add("disabled", "true"); }1111 if (settings.Required) { attributes.Add("required", "true"); }1112 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }1113 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); }1114 if (settings.Rows != 0) { attributes.Add("rows", settings.Rows.ToString()); }1115 attributes.Add("name", settings.Name);11161117 <div class="form__field-group dw-mod">1118 @if (!string.IsNullOrEmpty(settings.Label))1119 {1120 <label for="@id">@settings.Label</label>1121 }1122 @if (!string.IsNullOrEmpty(settings.HelpText))1123 {1124 <small class="form__help-text">@settings.HelpText</small>1125 }11261127 <textarea class="u-full-width @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Value</textarea>11281129 @Render(new NotificationMessage { Message = settings.ErrorMessage })1130 </div>1131 }1132 @using System.Reflection1133 @using Dynamicweb.Rapido.Blocks.Components.General1134 @using Dynamicweb.Rapido.Blocks.Components113511361137 @* Component *@11381139 @helper RenderHiddenField(HiddenField settings) {1140 var attributes = new Dictionary<string, string>();1141 attributes.Add("type", "hidden");1142 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }1143 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); }1144 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }11451146 <input @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)/>1147 }1148 @using System.Reflection1149 @using Dynamicweb.Rapido.Blocks.Components.General1150 @using Dynamicweb.Rapido.Blocks.Components11511152 @* Component *@11531154 @helper RenderCheckboxField(CheckboxField settings)1155 {1156 var attributes = new Dictionary<string, string>();1157 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))1158 {1159 settings.Id = Guid.NewGuid().ToString("N");1160 }11611162 /*base settings*/1163 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }1164 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }1165 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }1166 if (settings.Disabled) { attributes.Add("disabled", "true"); }1167 if (settings.Required) { attributes.Add("required", "true"); }1168 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }1169 /*end*/11701171 attributes.Add("type", "checkbox");1172 if (settings.Checked) { attributes.Add("checked", "true"); }1173 settings.CssClass = "form__control " + settings.CssClass;1174 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); }11751176 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);11771178 <div class="form__field-group dw-mod">1179 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />1180 @if (!string.IsNullOrEmpty(settings.Label))1181 {1182 <label for="@settings.Id" class="dw-mod">@settings.Label</label>1183 }1184 @if (!string.IsNullOrEmpty(settings.HelpText))1185 {1186 <small class="form__help-text">@settings.HelpText</small>1187 }1188 @Render(new NotificationMessage { Message = settings.ErrorMessage })1189 </div>1190 }1191 @using System.Reflection1192 @using Dynamicweb.Rapido.Blocks.Components.General1193 @using Dynamicweb.Rapido.Blocks.Components119411951196 @* Component *@11971198 @helper RenderCheckboxListField(CheckboxListField settings)1199 {1200 <div class="form__field-group @settings.CssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>1201 @if (!string.IsNullOrEmpty(settings.Label))1202 {1203 <label>@settings.Label</label>1204 }1205 @if (!string.IsNullOrEmpty(settings.HelpText))1206 {1207 <small class="form__help-text">@settings.HelpText</small>1208 }12091210 @foreach (var item in settings.Options)1211 {1212 if (settings.Required)1213 {1214 item.Required = true;1215 }1216 if (settings.Disabled)1217 {1218 item.Disabled = true;1219 }1220 if (!string.IsNullOrEmpty(settings.Name))1221 {1222 item.Name = settings.Name;1223 }12241225 /* value is not supported */12261227 if (!string.IsNullOrEmpty(settings.OnClick))1228 {1229 item.OnClick = settings.OnClick;1230 }1231 if (!string.IsNullOrEmpty(settings.OnChange))1232 {1233 item.OnChange = settings.OnChange;1234 }1235 @Render(item)1236 }12371238 @Render(new NotificationMessage { Message = settings.ErrorMessage })1239 </div>1240 }1241 @using System.Reflection1242 @using Dynamicweb.Rapido.Blocks.Components.General1243 @using Dynamicweb.Rapido.Blocks.Components124412451246 @* Component *@12471248 @helper RenderSelectField(SelectField settings)1249 {1250 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))1251 {1252 settings.Id = Guid.NewGuid().ToString("N");1253 }12541255 <div class="form__field-group u-full-width dw-mod">1256 @if (!string.IsNullOrEmpty(settings.Label))1257 {1258 <label for="@settings.Id">@settings.Label</label>1259 }1260 @if (!string.IsNullOrEmpty(settings.HelpText))1261 {1262 <small class="form__help-text">@settings.HelpText</small>1263 }12641265 @if (settings.ActionButton != null)1266 {1267 settings.ActionButton.CssClass += " btn--condensed u-no-margin";1268 <div class="form__field-combi u-no-margin dw-mod">1269 @RenderSelectBase(settings)1270 @Render(settings.ActionButton)1271 </div>1272 }1273 else1274 {1275 @RenderSelectBase(settings)1276 }12771278 @Render(new NotificationMessage { Message = settings.ErrorMessage })1279 </div>1280 }12811282 @helper RenderSelectBase(SelectField settings)1283 {1284 var attributes = new Dictionary<string, string>();12851286 /*base settings*/1287 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }1288 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }1289 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }1290 if (settings.Disabled) { attributes.Add("disabled", "true"); }1291 if (settings.Required) { attributes.Add("required", "true"); }1292 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }1293 /*end*/12941295 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);12961297 <select @ComponentMethods.AddAttributes(resultAttributes) class="u-full-width @settings.CssClass dw-mod">1298 @if (settings.Default != null)1299 {1300 @Render(settings.Default)1301 }13021303 @foreach (var item in settings.Options)1304 {1305 if (!string.IsNullOrEmpty(settings.Value)) {1306 item.Checked = item.Value == settings.Value;1307 }1308 @Render(item)1309 }1310 </select>1311 }1312 @using System.Reflection1313 @using Dynamicweb.Rapido.Blocks.Components.General1314 @using Dynamicweb.Rapido.Blocks.Components13151316 @* Component *@13171318 @helper RenderRadioButtonField(RadioButtonField settings)1319 {1320 var attributes = new Dictionary<string, string>();1321 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))1322 {1323 settings.Id = Guid.NewGuid().ToString("N");1324 }13251326 /*base settings*/1327 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }1328 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }1329 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }1330 if (settings.Disabled) { attributes.Add("disabled", "true"); }1331 if (settings.Required) { attributes.Add("required", "true"); }1332 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }1333 /*end*/13341335 attributes.Add("type", "radio");1336 if (settings.Checked) { attributes.Add("checked", "true"); }1337 settings.CssClass = "form__control " + settings.CssClass;1338 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); }13391340 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);13411342 <div class="form__field-group dw-mod">1343 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />1344 @if (!string.IsNullOrEmpty(settings.Label))1345 {1346 <label for="@settings.Id" class="dw-mod">@settings.Label</label>1347 }1348 @if (!string.IsNullOrEmpty(settings.HelpText))1349 {1350 <small class="form__help-text">@settings.HelpText</small>1351 }1352 @Render(new NotificationMessage { Message = settings.ErrorMessage })1353 </div>1354 }1355 @using System.Reflection1356 @using Dynamicweb.Rapido.Blocks.Components.General1357 @using Dynamicweb.Rapido.Blocks.Components135813591360 @* Component *@13611362 @helper RenderRadioButtonListField(RadioButtonListField settings)1363 {1364 <div class="form__field-group @settings.CssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>1365 @if (!string.IsNullOrEmpty(settings.Label))1366 {1367 <label>@settings.Label</label>1368 }1369 @if (!string.IsNullOrEmpty(settings.HelpText))1370 {1371 <small class="form__help-text">@settings.HelpText</small>1372 }13731374 @foreach (var item in settings.Options)1375 {1376 if (settings.Required)1377 {1378 item.Required = true;1379 }1380 if (settings.Disabled)1381 {1382 item.Disabled = true;1383 }1384 if (!string.IsNullOrEmpty(settings.Name))1385 {1386 item.Name = settings.Name;1387 }1388 if (!string.IsNullOrEmpty(settings.Value) && settings.Value == item.Value)1389 {1390 item.Checked = true;1391 }1392 if (!string.IsNullOrEmpty(settings.OnClick))1393 {1394 item.OnClick = settings.OnClick;1395 }1396 if (!string.IsNullOrEmpty(settings.OnChange))1397 {1398 item.OnChange = settings.OnChange;1399 }1400 @Render(item)1401 }14021403 @Render(new NotificationMessage { Message = settings.ErrorMessage })1404 </div>1405 }1406 @using System.Reflection1407 @using Dynamicweb.Rapido.Blocks.Components.General1408 @using Dynamicweb.Rapido.Blocks.Components140914101411 @* Component *@14121413 @helper RenderNotificationMessage(NotificationMessage settings) {1414 if (!string.IsNullOrEmpty(settings.Message))1415 {1416 string messageTypeClass = Enum.GetName(typeof(NotificationMessageType), settings.MessageType).ToLower();1417 <div class="field-@messageTypeClass @settings.CssClass u-full-width dw-mod">@settings.Message</div>1418 }1419 }1420 @using Dynamicweb.Rapido.Blocks.Components.General142114221423 @* Component *@14241425 @helper RenderHandlebarsRoot(HandlebarsRoot settings) {1426 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : "";14271428 <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>1429 @if (settings.SubBlocks != null) {1430 @RenderBlockList(settings.SubBlocks)1431 }1432 </div>1433 }1434 @using System.Reflection1435 @using Dynamicweb.Rapido.Blocks.Components.General1436 @using Dynamicweb.Rapido.Blocks.Components1437 @using System.Text.RegularExpressions143814391440 @* Component *@14411442 @helper RenderSticker(Sticker settings) {1443 if (!String.IsNullOrEmpty(settings.Title)) {1444 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : "";1445 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : "";14461447 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>();1448 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) {1449 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : "";1450 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : "";1451 optionalAttributes.Add("style", styleTag);1452 }14531454 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div>1455 }1456 }14571458 @using System.Reflection1459 @using Dynamicweb.Rapido.Blocks.Components.General1460 @using Dynamicweb.Rapido.Blocks.Components146114621463 @* Component *@14641465 @helper RenderStickersCollection(StickersCollection settings)1466 {1467 if (settings.Stickers.Count > 0)1468 {1469 string position = "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower();14701471 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>1472 @foreach (Sticker sticker in settings.Stickers)1473 {1474 @Render(sticker)1475 }1476 </div>1477 }1478 }14791480 @using Dynamicweb.Rapido.Blocks.Components.General148114821483 @* Component *@14841485 @helper RenderForm(Form settings) {1486 if (settings != null)1487 {1488 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>();1489 if (!string.IsNullOrEmpty(settings.Action)) { optionalAttributes.Add("action", settings.Action); };1490 if (!string.IsNullOrEmpty(settings.Name)) { optionalAttributes.Add("name", settings.Name); };1491 if (!string.IsNullOrEmpty(settings.OnSubmit)) { optionalAttributes.Add("onsubmit", settings.OnSubmit); };1492 var enctypes = new Dictionary<string, string>1493 {1494 { "multipart", "multipart/form-data" },1495 { "text", "text/plain" },1496 { "application", "application/x-www-form-urlencoded" }1497 };1498 if (settings.Enctype != FormEnctype.none) { optionalAttributes.Add("enctype", enctypes[Enum.GetName(typeof(FormEnctype), settings.Enctype).ToLower()]); };1499 optionalAttributes.Add("method", settings.Method.ToString());15001501 if (!string.IsNullOrEmpty(settings.FormStartMarkup))1502 {1503 @settings.FormStartMarkup1504 }1505 else1506 {1507 @:<form class="@settings.CssClass u-no-margin dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>1508 }15091510 foreach (var field in settings.GetFields())1511 {1512 @Render(field)1513 }15141515 @:</form>1516 }1517 }1518 @using System.Reflection1519 @using Dynamicweb.Rapido.Blocks.Components.General1520 @using Dynamicweb.Rapido.Blocks.Components152115221523 @* Component *@15241525 @helper RenderText(Text settings)1526 {1527 @settings.Content1528 }1529 @using System.Reflection1530 @using Dynamicweb.Rapido.Blocks.Components.General1531 @using Dynamicweb.Rapido.Blocks.Components153215331534 @* Component *@15351536 @helper RenderContentModule(ContentModule settings) {1537 if (!string.IsNullOrEmpty(settings.Content))1538 {1539 @settings.Content1540 }1541 }1542 @using System.Reflection1543 @using Dynamicweb.Rapido.Blocks.Components.General1544 @using Dynamicweb.Rapido.Blocks.Components154515461547 @* Component *@15481549 @helper RenderModal(Modal settings) {1550 if (settings != null)1551 {1552 string modalId = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N");15531554 <input type="checkbox" id="@(modalId)ModalTrigger" class="modal-trigger" />15551556 <div class="modal-container">1557 @if (!settings.DisableDarkOverlay)1558 {1559 <label for="@(modalId)ModalTrigger" id="@(modalId)ModalOverlay" class="modal-overlay"></label>1560 }1561 <div class="modal modal--@settings.Width.ToString().ToLower()" id="@(modalId)Modal">1562 @if (settings.Heading != null)1563 {1564 if (!string.IsNullOrEmpty(settings.Heading.Title))1565 {1566 <div class="modal__header">1567 @Render(settings.Heading)1568 </div>1569 }1570 }1571 <div class="modal__body @(settings.Width.ToString().ToLower() == "full" ? "modal__body--full" : "")">1572 @if (!string.IsNullOrEmpty(settings.BodyText))1573 {1574 @settings.BodyText1575 }1576 @if (settings.BodyTemplate != null)1577 {1578 @settings.BodyTemplate1579 }1580 @{1581 var actions = settings.GetActions();1582 }1583 </div>1584 @if (actions.Length > 0)1585 {1586 <div class="modal__footer">1587 @foreach (var action in actions)1588 {1589 action.CssClass += " u-no-margin";1590 @Render(action)1591 }1592 </div>1593 }1594 <label class="modal__close-btn" for="@(modalId)ModalTrigger"></label>1595 </div>1596 </div>1597 }1598 }1599 @using Dynamicweb.Rapido.Blocks.Components.General16001601 @* Component *@16021603 @helper RenderMediaListItem(MediaListItem settings)1604 {1605 <div class="media-list-item @settings.CssClass dw-mod" @(!string.IsNullOrEmpty(settings.Id) ? "id=\"" + settings.Id + "\"" : "")>1606 @if (!string.IsNullOrEmpty(settings.Label))1607 {1608 if (!string.IsNullOrEmpty(settings.Link))1609 {1610 @Render(new Link1611 {1612 Href = settings.Link,1613 CssClass = "media-list-item__sticker dw-mod",1614 ButtonLayout = ButtonLayout.None,1615 Title = settings.Label,1616 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : ""1617 })1618 }1619 else if (!string.IsNullOrEmpty(settings.OnClick))1620 {1621 <span class="media-list-item__sticker dw-mod" onclick="@(settings.OnClick)">1622 <span class="u-uppercase">@settings.Label</span>1623 </span>1624 }1625 else1626 {1627 <span class="media-list-item__sticker media-list-item__sticker--no-link dw-mod">1628 <span class="u-uppercase">@settings.Label</span>1629 </span>1630 }1631 }1632 <div class="media-list-item__info dw-mod">1633 <div class="media-list-item__header dw-mod">1634 @if (!string.IsNullOrEmpty(settings.Title))1635 {1636 if (!string.IsNullOrEmpty(settings.Link))1637 {1638 @Render(new Link1639 {1640 Href = settings.Link,1641 CssClass = "media-list-item__name dw-mod",1642 ButtonLayout = ButtonLayout.None,1643 Title = settings.Title,1644 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : ""1645 })1646 }1647 else if (!string.IsNullOrEmpty(settings.OnClick))1648 {1649 <span class="media-list-item__name dw-mod" onclick="@(settings.OnClick)">@settings.Title</span>1650 }1651 else1652 {1653 <span class="media-list-item__name media-list-item__name--no-link dw-mod">@settings.Title</span>1654 }1655 }16561657 @if (!string.IsNullOrEmpty(settings.Status))1658 {1659 <div class="media-list-item__state dw-mod">@settings.Status</div>1660 }1661 </div>1662 @{1663 settings.InfoTable.CssClass += " media-list-item__parameters-table";1664 }1665 @Render(settings.InfoTable)1666 </div>1667 <div class="media-list-item__actions dw-mod">1668 @{1669 var actions = settings.GetActions();16701671 foreach (ButtonBase action in actions)1672 {1673 action.ButtonLayout = ButtonLayout.None;1674 action.CssClass += " media-list-item__action link";16751676 @Render(action)1677 }1678 }1679 </div>1680 </div>1681 }1682 @using Dynamicweb.Rapido.Blocks.Components.General1683 @using Dynamicweb.Rapido.Blocks.Components16841685 @helper RenderTable(Table settings)1686 {1687 Dictionary<string, string> attributes = new Dictionary<string, string>();1688 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }16891690 var enumToClasses = new Dictionary<TableDesign, string>1691 {1692 { TableDesign.Clean, "table--clean" },1693 { TableDesign.Bordered, "table--bordered" },1694 { TableDesign.Striped, "table--striped" },1695 { TableDesign.Hover, "table--hover" },1696 { TableDesign.Compact, "table--compact" },1697 { TableDesign.Condensed, "table--condensed" },1698 { TableDesign.NoTopBorder, "table--no-top-border" }1699 };1700 string tableDesignClass = "";1701 if (settings.Design != TableDesign.None)1702 {1703 tableDesignClass = enumToClasses[settings.Design];1704 }17051706 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableDesign.None) { attributes.Add("class", "table " + tableDesignClass + " " + settings.CssClass + " dw-mod"); }17071708 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);17091710 <table @ComponentMethods.AddAttributes(resultAttributes)>1711 @if (settings.Header != null)1712 {1713 <thead>1714 @Render(settings.Header)1715 </thead>1716 }1717 <tbody>1718 @foreach (var row in settings.GetRows())1719 {1720 @Render(row)1721 }1722 </tbody>1723 @if (settings.Footer != null)1724 {1725 <tfoot>1726 @Render(settings.Footer)1727 </tfoot>1728 }1729 </table>1730 }1731 @using Dynamicweb.Rapido.Blocks.Components.General1732 @using Dynamicweb.Rapido.Blocks.Components17331734 @helper RenderTableRow(TableRow settings)1735 {1736 Dictionary<string, string> attributes = new Dictionary<string, string>();1737 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }17381739 var enumToClasses = new Dictionary<TableRowDesign, string>1740 {1741 { TableRowDesign.NoBorder, "table__row--no-border" },1742 { TableRowDesign.Border, "table__row--border" },1743 { TableRowDesign.TopBorder, "table__row--top-line" },1744 { TableRowDesign.BottomBorder, "table__row--bottom-line" },1745 { TableRowDesign.Solid, "table__row--solid" }1746 };17471748 string tableRowDesignClass = "";1749 if (settings.Design != TableRowDesign.None)1750 {1751 tableRowDesignClass = enumToClasses[settings.Design];1752 }17531754 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableRowDesign.None) { attributes.Add("class", "table__row " + tableRowDesignClass + " " + settings.CssClass + " dw-mod"); }17551756 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);17571758 <tr @ComponentMethods.AddAttributes(resultAttributes)>1759 @foreach (var cell in settings.GetCells())1760 {1761 if (settings.IsHeaderRow)1762 {1763 cell.IsHeader = true;1764 }1765 @Render(cell)1766 }1767 </tr>1768 }1769 @using Dynamicweb.Rapido.Blocks.Components.General1770 @using Dynamicweb.Rapido.Blocks.Components1771 @using Dynamicweb.Core17721773 @helper RenderTableCell(TableCell settings)1774 {1775 Dictionary<string, string> attributes = new Dictionary<string, string>();1776 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }1777 if (settings.Colspan != 0) { attributes.Add("colspan", Converter.ToString(settings.Colspan)); }1778 if (settings.Rowspan != 0) { attributes.Add("rowspan", Converter.ToString(settings.Rowspan)); }1779 if (!string.IsNullOrEmpty(settings.CssClass)) { attributes.Add("class", settings.CssClass + " dw-mod"); }17801781 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);17821783 string tagName = settings.IsHeader ? "th" : "td";17841785 @("<" + tagName + " " + ComponentMethods.AddAttributes(resultAttributes) + ">")1786 @settings.Content1787 @("</" + tagName + ">");1788 }178917901791 @using Dynamicweb.Rapido.Blocks.Components.General1792 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce179317941795 @using Dynamicweb.Frontend1796 @using System.Reflection1797 @using Dynamicweb.Content.Items1798 @using System.Web.UI.HtmlControls1799 @using Dynamicweb.Rapido.Blocks.Components1800 @using Dynamicweb.Rapido.Blocks1801 @using Dynamicweb.Rapido.Blocks.Components.Articles18021803 @* Components for the articles *@1804 @using System.Reflection1805 @using Dynamicweb.Rapido.Blocks.Components.Articles180618071808 @* Component for the articles *@18091810 @helper RenderArticleBanner(dynamic settings) {1811 string filterClasses = "image-filter image-filter--darken";1812 settings.Layout = ArticleHeaderLayout.Banner;18131814 if (settings.Image != null)1815 {1816 if (settings.Image.Path != null)1817 {1818 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width">1819 <div class="background-image @filterClasses dw-mod">1820 <div class="background-image__wrapper @filterClasses dw-mod">1821 @{1822 settings.Image.CssClass += "background-image__cover dw-mod";1823 }1824 @Render(settings.Image)1825 </div>1826 </div>1827 <div class="center-container dw-mod">1828 <div class="grid">1829 <div class="grid__col-md-8 grid__col-xs-12 paragraph-container paragraph-container--height-lg">1830 <div class="u-left-middle">1831 <div>1832 @if (!String.IsNullOrEmpty(settings.Heading))1833 {1834 <h1 class="article__header article__header--giant dw-mod" style="color: @settings.TextColor">@settings.Heading</h1>1835 }1836 @if (!String.IsNullOrEmpty(settings.Subheading))1837 {1838 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div>1839 }1840 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))1841 {1842 <small class="article__post-info u-margin-bottom--lg dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small>1843 }1844 @if (!String.IsNullOrEmpty(settings.Link)) {1845 <div class="grid__cell">1846 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })1847 </div>1848 }1849 </div>1850 </div>1851 </div>1852 @if (settings.ExternalParagraphId != 0)1853 {1854 <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod">1855 <div class="u-color-light-gray--bg u-color-dark dw-mod">1856 @RenderParagraphContent(settings.ExternalParagraphId)1857 </div>1858 </div>1859 }1860 </div>1861 </div>1862 </section>1863 }1864 else1865 {1866 settings.Layout = ArticleHeaderLayout.Clean;1867 @RenderArticleCleanHeader(settings);1868 }1869 }1870 else1871 {1872 settings.Layout = ArticleHeaderLayout.Clean;1873 @RenderArticleCleanHeader(settings);1874 }1875 }1876 @using System.Reflection1877 @using Dynamicweb.Rapido.Blocks.Components1878 @using Dynamicweb.Rapido.Blocks.Components.General1879 @using Dynamicweb.Rapido.Blocks.Components.Articles1880 @using Dynamicweb.Rapido.Blocks188118821883 @* Component for the articles *@18841885 @helper RenderArticleHeader(ArticleHeader settings) {1886 dynamic[] methodParameters = new dynamic[1];1887 methodParameters[0] = settings;1888 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleHeaderCustom");18891890 if (customMethod != null)1891 {1892 @customMethod.Invoke(this, methodParameters).ToString();1893 } else {1894 switch (settings.Layout)1895 {1896 case ArticleHeaderLayout.Clean:1897 @RenderArticleCleanHeader(settings);1898 break;1899 case ArticleHeaderLayout.Split:1900 @RenderArticleSplitHeader(settings);1901 break;1902 case ArticleHeaderLayout.Banner:1903 @RenderArticleBannerHeader(settings);1904 break;1905 case ArticleHeaderLayout.Overlay:1906 @RenderArticleOverlayHeader(settings);1907 break;1908 default:1909 @RenderArticleCleanHeader(settings);1910 break;1911 }1912 }1913 }19141915 @helper RenderArticleCleanHeader(ArticleHeader settings) {1916 dynamic[] methodParameters = new dynamic[1];1917 methodParameters[0] = settings;1918 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom");19191920 if (customMethod != null)1921 {1922 @customMethod.Invoke(this, methodParameters).ToString();1923 }1924 else1925 {1926 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12";19271928 <div class="grid grid--align-content-start grid--justify-start">1929 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod">1930 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0)1931 {1932 <div class="u-border-bottom u-padding-bottom">1933 @if (!String.IsNullOrEmpty(settings.Category))1934 {1935 <div class="u-pull--left">1936 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div>1937 </div>1938 }1939 <div class="u-pull--right">1940 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))1941 {1942 <small class="article__post-info dw-mod">@settings.Author @settings.Date</small>1943 }1944 @if (settings.RatingOutOf != 0)1945 {1946 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })1947 }1948 </div>1949 </div>1950 }19511952 <div class="grid__cell">1953 @if (!String.IsNullOrEmpty(settings.Heading))1954 {1955 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1>1956 }1957 @if (settings.Image != null)1958 {1959 if (settings.Image.Path != null)1960 {1961 <div class="u-padding-bottom--lg">1962 @Render(settings.Image)1963 </div>1964 }1965 }1966 @if (!String.IsNullOrEmpty(settings.Subheading))1967 {1968 <div class="article__leadtext dw-mod">@settings.Subheading</div>1969 }1970 @if (!String.IsNullOrEmpty(settings.Link))1971 {1972 <div class="grid__cell">1973 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })1974 </div>1975 }1976 </div>1977 </div>1978 @if (settings.ExternalParagraphId != 0)1979 {1980 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod">1981 @RenderParagraphContent(settings.ExternalParagraphId)1982 </div>1983 }1984 </div>1985 }1986 }19871988 @helper RenderArticleSplitHeader(ArticleHeader settings) {1989 dynamic[] methodParameters = new dynamic[1];1990 methodParameters[0] = settings;1991 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSplitHeaderCustom");19921993 if (customMethod != null)1994 {1995 @customMethod.Invoke(this, methodParameters).ToString();1996 }1997 else1998 {1999 string headerColumnWidth = settings.ExternalParagraphId != 0 ? "4" : "6";20002001 if (settings.Image != null)2002 {2003 if (settings.Image.Path != null)2004 {2005 <section class="multiple-paragraphs-container paragraph-container--full-width">2006 <div class="grid">2007 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod">2008 <div class="u-left-middle u-padding--lg">2009 <div>2010 @if (!String.IsNullOrEmpty(settings.Category))2011 {2012 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div>2013 }2014 @if (!String.IsNullOrEmpty(settings.Heading))2015 {2016 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1>2017 }2018 @if (!String.IsNullOrEmpty(settings.Subheading))2019 {2020 <div class="article__leadtext dw-mod">@settings.Subheading</div>2021 }2022 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))2023 {2024 <small class="article__post-info u-pull--left dw-mod">@settings.Author @settings.Date</small>2025 }2026 @if (settings.RatingOutOf != 0)2027 {2028 <div class="u-pull--right">2029 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })2030 </div>2031 }2032 @if (!String.IsNullOrEmpty(settings.Link)) {2033 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })2034 }2035 </div>2036 </div>2037 </div>2038 <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>2039 @if (settings.ExternalParagraphId != 0)2040 {2041 <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">2042 @RenderParagraphContent(settings.ExternalParagraphId)2043 </div>2044 }2045 </div>2046 </section>2047 }2048 }2049 else2050 {2051 @RenderArticleCleanHeader(settings);2052 }2053 }2054 }20552056 @helper RenderArticleOverlayHeader(ArticleHeader settings) {2057 dynamic[] methodParameters = new dynamic[1];2058 methodParameters[0] = settings;2059 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleOverlayHeaderCustom");20602061 if (customMethod != null)2062 {2063 @customMethod.Invoke(this, methodParameters).ToString();2064 }2065 else2066 {2067 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12";2068 string contentAlignment = settings.TextLayout == ArticleHeaderTextLayout.Center ? "grid--justify-center" : "";20692070 if (settings.Image != null)2071 {2072 if (settings.Image.Path != null)2073 {2074 if (settings.ExternalParagraphId == 0)2075 {2076 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width">2077 <div class="background-image image-filter image-filter--darken dw-mod">2078 <div class="background-image__wrapper image-filter image-filter--darken dw-mod">2079 @{2080 settings.Image.CssClass += "background-image__cover dw-mod";2081 }2082 @Render(settings.Image)2083 </div>2084 </div>2085 <div class="center-container dw-mod">2086 <div class="grid @contentAlignment">2087 <div class="grid__col-md-@contentColumns grid__col-xs-12 paragraph-container paragraph-container--height-xl u-no-padding dw-mod">2088 @if (!String.IsNullOrEmpty(settings.Heading))2089 {2090 <h1 class="article__header article__header--giant u-padding-top--lg dw-mod" style="color: @settings.TextColor">@settings.Heading</h1>2091 }2092 @if (!String.IsNullOrEmpty(settings.Subheading))2093 {2094 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div>2095 }2096 <div class="u-margin-top">2097 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))2098 {2099 <small class="article__post-info u-pull--left dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small>2100 }2101 @if (settings.RatingOutOf != 0)2102 {2103 <div class="u-pull--right">2104 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })2105 </div>2106 }2107 </div>2108 @if (!String.IsNullOrEmpty(settings.Link))2109 {2110 <div class="grid__cell">2111 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })2112 </div>2113 }2114 </div>2115 </div>2116 </div>2117 </section>2118 }2119 else2120 {2121 @RenderArticleBanner(settings);2122 }2123 }2124 }2125 else2126 {2127 @RenderArticleCleanHeader(settings);2128 }2129 }2130 }21312132 @helper RenderArticleBannerHeader(dynamic settings) {2133 dynamic[] methodParameters = new dynamic[1];2134 methodParameters[0] = settings;2135 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerHeaderCustom");21362137 if (customMethod != null)2138 {2139 @customMethod.Invoke(this, methodParameters).ToString();2140 }2141 else2142 {2143 @RenderArticleBanner(settings);2144 }2145 }2146 @using System.Reflection2147 @using System.Text.RegularExpressions;2148 @using Dynamicweb.Frontend2149 @using Dynamicweb.Content.Items2150 @using Dynamicweb.Rapido.Blocks.Components2151 @using Dynamicweb.Rapido.Blocks.Components.Articles2152 @using Dynamicweb.Rapido.Blocks21532154 @* Component for the articles *@21552156 @helper RenderArticleBodyRow(ArticleBodyRow settings)2157 {2158 string position = settings.TopLayout == "overlay" ? "article__overlay-offset" : "";2159 string contentAlignment = settings.TextLayout == "center" ? "grid--justify-center" : "";21602161 <div class="grid grid--align-content-start @contentAlignment @position dw-mod">2162 @RenderBlockList(settings.SubBlocks)2163 </div>2164 }2165 @using System.Reflection2166 @using Dynamicweb.Rapido.Blocks.Components2167 @using Dynamicweb.Rapido.Blocks.Components.General2168 @using Dynamicweb.Rapido.Blocks.Components.Articles2169 @using Dynamicweb.Rapido.Blocks21702171 @* Component for the articles *@21722173 @helper RenderArticleImage(ArticleImage settings)2174 {2175 if (settings.Image != null)2176 {2177 if (settings.Image.Path != null)2178 {2179 <div class="u-margin-bottom--lg">2180 @Render(settings.Image)2181 </div>2182 }2183 }2184 }2185 @using System.Reflection2186 @using Dynamicweb.Rapido.Blocks.Components2187 @using Dynamicweb.Rapido.Blocks.Components.Articles218821892190 @* Component for the articles *@21912192 @helper RenderArticleSubHeader(ArticleSubHeader settings)2193 {2194 if (!String.IsNullOrEmpty(settings.Title))2195 {2196 <h2 class="article__header">@settings.Title</h2>2197 }2198 }2199 @using System.Reflection2200 @using Dynamicweb.Rapido.Blocks.Components2201 @using Dynamicweb.Rapido.Blocks.Components.Articles2202 @using Dynamicweb.Rapido.Blocks220322042205 @* Component for the articles *@22062207 @helper RenderArticleText(ArticleText settings)2208 {2209 if (!String.IsNullOrEmpty(settings.Text))2210 {2211 string greatTextClass = settings.EnableLargeText == true ? "article__paragraph--great-text" : "";22122213 <div class="article__paragraph @greatTextClass">2214 @settings.Text2215 </div>2216 }2217 }2218 @using System.Reflection2219 @using Dynamicweb.Rapido.Blocks.Components2220 @using Dynamicweb.Rapido.Blocks.Components.Articles2221 @using Dynamicweb.Rapido.Blocks222222232224 @* Component for the articles *@22252226 @helper RenderArticleQuote(ArticleQuote settings)2227 {2228 string text = Regex.Replace(settings.Text, "<.*?>", String.Empty);22292230 <div class="grid u-padding-bottom--lg">2231 @if (settings.Image != null)2232 {2233 if (settings.Image.Path != null) {2234 <div class="grid__col-3">2235 <div class="grid__cell-img">2236 @{2237 settings.Image.Title = !String.IsNullOrEmpty(settings.Image.Title) ? settings.Image.Title : settings.Author;2238 settings.Image.CssClass += " article__image article__image--ball";2239 settings.Image.ImageDefault.Width = 200;2240 settings.Image.ImageDefault.Height = 200;2241 }2242 @Render(settings.Image)2243 </div>2244 </div>2245 }2246 }2247 <div class="grid__col-auto">2248 @if (!String.IsNullOrEmpty(settings.Text))2249 {2250 <div class="article__quote dw-mod">2251 <i class="fas fa-quote-right u-margin-bottom--lg"></i>2252 @settings.Text2253 <i class="fas fa-quote-right"></i>2254 </div>2255 }2256 @if (!String.IsNullOrEmpty(settings.Author))2257 {2258 <div class="article__quote-author dw-mod">2259 - @settings.Author2260 </div>2261 }2262 </div>2263 </div>2264 }2265 @using System.Reflection2266 @using Dynamicweb.Rapido.Blocks.Components2267 @using Dynamicweb.Rapido.Blocks.Components.Articles2268 @using Dynamicweb.Rapido.Blocks22692270 @* Component for the articles *@22712272 @helper RenderArticleInfoTable(ArticleInfoTable settings)2273 {2274 <table class="table table--clean">2275 @foreach (var row in settings.Rows)2276 {2277 string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two";22782279 <tr>2280 @if (!String.IsNullOrEmpty(row.Icon))2281 {2282 <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td>2283 }2284 <td class="u-no-margin-on-p-elements">2285 <div class="u-bold">@row.Title</div>2286 @if (!String.IsNullOrEmpty(row.SubTitle))2287 {2288 if (row.Link == null)2289 {2290 <div>@row.SubTitle</div>2291 }2292 else2293 {2294 <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a>2295 }2296 }2297 </td>2298 </tr>2299 }2300 </table>2301 }2302 @using System.Reflection2303 @using Dynamicweb.Rapido.Blocks.Components2304 @using Dynamicweb.Rapido.Blocks.Components.General2305 @using Dynamicweb.Rapido.Blocks.Components.Articles2306 @using Dynamicweb.Rapido.Blocks23072308 @* Component for the articles *@23092310 @helper RenderArticleGalleryModal(ArticleGalleryModal settings)2311 {2312 Modal galleryModal = new Modal2313 {2314 Id = "ParagraphGallery",2315 Width = ModalWidth.Full,2316 BodyTemplate = RenderArticleGalleryModalContent()2317 };23182319 @Render(galleryModal)2320 }23212322 @helper RenderArticleGalleryModalContent() {2323 <div class="modal__image-min-size-wrapper">2324 @Render(new Image {2325 Id = "ParagraphGallery",2326 Path = "#",2327 CssClass = "modal--full__img",2328 DisableLazyLoad = true,2329 DisableImageEngine = true2330 })2331 </div>23322333 <div class="modal__images-counter" id="ParagraphGallery_counter"></div>23342335 @Render(new Button {2336 Id = "ParagraphGallery_prev",2337 ButtonType = ButtonType.Button,2338 ButtonLayout = ButtonLayout.None,2339 CssClass = "modal__prev-btn",2340 Icon = new Icon { Prefix = "far", Name = "fa-angle-left" },2341 OnClick = "Gallery.prevImage('ParagraphGallery')"2342 })23432344 @Render(new Button {2345 Id = "ParagraphGallery_next",2346 ButtonType = ButtonType.Button,2347 ButtonLayout = ButtonLayout.None,2348 CssClass = "modal__next-btn",2349 Icon = new Icon { Prefix = "far", Name = "fa-angle-right" },2350 OnClick = "Gallery.nextImage('ParagraphGallery')"2351 })2352 }2353 @using System.Reflection2354 @using Dynamicweb.Rapido.Blocks.Components2355 @using Dynamicweb.Rapido.Blocks.Components.Articles2356 @using Dynamicweb.Rapido.Blocks235723582359 @* Component for the articles *@23602361 @helper RenderArticleRelated(ArticleRelated settings)2362 {2363 string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : "";2364 string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : "";23652366 <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width">2367 <div class="center-container dw-mod">2368 <div class="grid u-padding">2369 <div class="grid__col-md-12 grid__col-xs-12">2370 <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2>2371 </div>2372 </div>23732374 <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>23752376 <script id="RelatedSimpleTemplate" type="text/x-template">2377 {{#.}}2378 <div class="grid u-padding-bottom--lg">2379 {{#Cases}}2380 <div class="grid__col-3 image-hover--zoom dw-mod">2381 <a href="{{link}}" class="u-full-height u-color-light--bg">2382 {{#if image}}2383 <div class="u-color-light--bg u-no-padding dw-mod">2384 <div class="flex-img image-hover__wrapper">2385 <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}}" />2386 </div>2387 </div>2388 {{/if}}23892390 <div class="card u-color-light--bg dw-mod">2391 <h3 class="article-list__item-header u-truncate-text dw-mod">{{title}}</h3>2392 <p class="article__short-summary dw-mod">{{summary}}</p>2393 </div>2394 </a>2395 </div>2396 {{/Cases}}2397 </div>2398 {{/.}}2399 </script>2400 </div>2401 </section>2402 }2403 @using System.Reflection2404 @using Dynamicweb.Rapido.Blocks.Components2405 @using Dynamicweb.Rapido.Blocks.Components.Articles2406 @using Dynamicweb.Rapido.Blocks240724082409 @* Component for the articles *@24102411 @helper RenderArticleMenu(ArticleMenu settings)2412 {2413 if (!String.IsNullOrEmpty(settings.Title)) {2414 <div class="u-margin u-border-bottom">2415 <h3 class="u-no-margin">@settings.Title</h3>2416 </div>2417 }24182419 <ul class="menu-left u-margin-bottom dw-mod">2420 @foreach (var item in settings.Items)2421 {2422 @Render(item)2423 }2424 </ul>2425 }24262427 @helper RenderArticleMenuItem(ArticleMenuItem settings)2428 {2429 string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#";24302431 if (!String.IsNullOrEmpty(settings.Title)) {2432 <li class="menu-left__item dw-mod">2433 <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a>2434 </li>2435 }2436 }2437 @using System.Reflection2438 @using Dynamicweb.Rapido.Blocks.Components2439 @using Dynamicweb.Rapido.Blocks.Components.Articles2440 @using Dynamicweb.Rapido.Blocks24412442 @* Component for the articles *@24432444 @helper RenderArticleList(ArticleList settings)2445 {2446 if (Pageview != null)2447 {2448 bool isParagraph = Pageview.CurrentParagraph != null ? true : false;2449 string[] sortArticlesListBy = new string[2];24502451 if (isParagraph) {2452 sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" };2453 }2454 else {2455 sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" };2456 }24572458 string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString();24592460 @RenderItemList(new2461 {2462 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle",2463 ListSourceType = settings.SourceType,2464 ListSourcePage = sourcePage,2465 ItemFieldsList = "*",2466 Filter = settings.Filter,2467 ListOrderBy = sortArticlesListBy[0],2468 ListOrderByDirection = sortArticlesListBy[1],2469 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date",2470 ListSecondOrderByDirection = "ASC",2471 IncludeAllChildItems = true,2472 ListTemplate = settings.Template,2473 ListPageSize = settings.PageSize.ToString()2474 });2475 }2476 }2477 @using System.Reflection2478 @using Dynamicweb.Rapido.Blocks.Components.Articles247924802481 @* Component for the articles *@24822483 @helper RenderArticleSummary(ArticleSummary settings)2484 {2485 if (!String.IsNullOrEmpty(settings.Text))2486 {2487 <div class="article__summary dw-mod">@settings.Text</div>2488 }2489 }2490 @using System.Reflection2491 @using Dynamicweb.Rapido.Blocks.Components2492 @using Dynamicweb.Rapido.Blocks.Components.Articles2493 @using Dynamicweb.Rapido.Blocks24942495 @* Component for the articles *@24962497 @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings)2498 {2499 string pageId = Pageview.ID.ToString();2500 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All");2501 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString());25022503 foreach (var option in settings.Categories)2504 {2505 selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter;2506 }25072508 if (selectedFilter == pageId)2509 {2510 selectedFilter = Translate("All");2511 }25122513 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")2514 {2515 <div class="u-pull--right u-margin-left">2516 <div class="collection u-no-margin">2517 <h5>@Translate("Category")</h5>2518 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" />2519 <div class="dropdown u-w180px dw-mod">2520 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label>2521 <div class="dropdown__content dw-mod">2522 @foreach (var option in settings.Categories)2523 {2524 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div>2525 }2526 </div>2527 <label class="dropdown-trigger-off" for="CategorySelector"></label>2528 </div>2529 </div>2530 </div>2531 }2532 else2533 {2534 <div class="u-full-width u-margin-bottom">2535 <h5 class="u-no-margin">@Translate("Category")</h5>2536 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" />2537 <div class="dropdown u-full-width dw-mod">2538 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label>2539 <div class="dropdown__content dw-mod">2540 @foreach (var option in settings.Categories)2541 {2542 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div>2543 }2544 </div>2545 <label class="dropdown-trigger-off" for="CategorySelector"></label>2546 </div>2547 </div>2548 }2549 }2550 @using System.Reflection2551 @using Dynamicweb.Rapido.Blocks.Components2552 @using Dynamicweb.Rapido.Blocks.Components.Articles2553 @using Dynamicweb.Rapido.Blocks25542555 @* Component for the articles *@25562557 @helper RenderArticleListFilter(ArticleListFilter settings)2558 {2559 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All");2560 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString());25612562 if (settings.Options != null)2563 {2564 foreach (var option in settings.Options)2565 {2566 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter;2567 }25682569 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")2570 {2571 <div class="u-pull--right u-margin-left">2572 <div class="collection u-no-margin">2573 <h5>@settings.Label</h5>2574 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" />2575 <div class="dropdown u-w180px dw-mod">2576 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label>2577 <div class="dropdown__content dw-mod">2578 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div>2579 @foreach (var option in settings.Options)2580 {2581 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div>2582 }2583 </div>2584 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label>2585 </div>2586 </div>2587 </div>2588 }2589 else2590 {2591 <div class="u-full-width u-margin-bottom">2592 <h5 class="u-no-margin">@settings.Label</h5>2593 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" />2594 <div class="dropdown u-full-width w-mod">2595 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label>2596 <div class="dropdown__content dw-mod">2597 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div>2598 @foreach (var option in settings.Options)2599 {2600 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div>2601 }2602 </div>2603 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label>2604 </div>2605 </div>2606 }2607 }2608 }2609 @using System.Reflection2610 @using Dynamicweb.Rapido.Blocks.Components2611 @using Dynamicweb.Rapido.Blocks.Components.Articles2612 @using Dynamicweb.Rapido.Blocks26132614 @* Component for the articles *@26152616 @helper RenderArticleListSearch(ArticleListSearch settings)2617 {2618 string searchString = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("Title")) ? HttpContext.Current.Request.QueryString.Get("Title").Trim('*') : "";2619 string className = "u-w340px u-pull--right u-margin-left";26202621 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet")2622 {2623 className = "u-full-width";2624 }26252626 <div class="typeahead u-color-inherit u-margin-bottom dw-mod @className">2627 <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 + '*')">2628 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button>2629 </div>2630 }2631 @using System.Reflection2632 @using Dynamicweb.Rapido.Blocks.Components2633 @using Dynamicweb.Rapido.Blocks.Components.Articles2634 @using Dynamicweb.Rapido.Blocks26352636 @* Component for the articles *@26372638 @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings)2639 {2640 <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div>2641 }2642 @using System.Reflection2643 @using Dynamicweb.Rapido.Blocks.Components2644 @using Dynamicweb.Rapido.Blocks.Components.General2645 @using Dynamicweb.Rapido.Blocks.Components.Articles2646 @using Dynamicweb.Rapido.Blocks2647 @using System.Text.RegularExpressions26482649 @* Component for the articles *@26502651 @helper RenderArticleListItem(ArticleListItem settings)2652 {2653 switch (settings.Type) {2654 case ArticleListItemType.Card:2655 @RenderArticleListItemCard(settings);2656 break;2657 case ArticleListItemType.List:2658 @RenderArticleListItemList(settings);2659 break;2660 case ArticleListItemType.Simple:2661 @RenderArticleListItemSimple(settings);2662 break;2663 default:2664 @RenderArticleListItemCard(settings);2665 break;2666 }2667 }26682669 @helper RenderArticleListItemCard(ArticleListItem settings) {2670 <a href="@settings.Link" class="u-full-height u-color-light--bg">2671 <div class="u-color-light--bg u-no-padding dw-mod">2672 @if (settings.Logo != null)2673 {2674 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;" : "";2675 settings.Logo.ImageDefault.Crop = 5;2676 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width;2677 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height;2678 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage">2679 @if (settings.Stickers != null)2680 {2681 if (settings.Stickers.Position != StickersListPosition.Custom)2682 {2683 @Render(settings.Stickers);2684 }2685 }2686 @RenderImage(settings.Logo)2687 </div>2688 } else if (settings.Image != null)2689 {2690 <div class="flex-img image-hover__wrapper u-position-relative dw-mod">2691 @if (settings.Stickers != null)2692 {2693 if (settings.Stickers.Position != StickersListPosition.Custom)2694 {2695 @Render(settings.Stickers);2696 }2697 }2698 @Render(settings.Image)2699 </div>2700 }2701 </div>27022703 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary))2704 {2705 <div class="card u-color-light--bg dw-mod">2706 @if (settings.Stickers != null)2707 {2708 if (settings.Stickers.Position == StickersListPosition.Custom)2709 {2710 @Render(settings.Stickers);2711 }2712 }2713 @if (!String.IsNullOrEmpty(settings.Title))2714 {2715 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3>2716 }2717 @if (!String.IsNullOrEmpty(settings.SubTitle))2718 {2719 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>2720 }2721 @if (!String.IsNullOrEmpty(settings.Summary))2722 {2723 <p class="article__short-summary dw-mod">@settings.Summary</p>2724 }2725 </div>2726 }2727 </a>2728 }27292730 @helper RenderArticleListItemList(ArticleListItem settings) {2731 <a href="@settings.Link">2732 <div class="grid u-color-light--bg u-no-padding dw-mod">2733 <div class="grid__col-md-3">2734 <div class="u-color-light--bg u-no-padding dw-mod">2735 @if (settings.Logo != null)2736 {2737 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;" : "";2738 settings.Logo.ImageDefault.Crop = 5;2739 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width;2740 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height;2741 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage">2742 @if (settings.Stickers != null)2743 {2744 if (settings.Stickers.Position != StickersListPosition.Custom)2745 {2746 @Render(settings.Stickers);2747 }2748 }2749 @RenderImage(settings.Logo)2750 </div>2751 } else if (settings.Image != null)2752 {2753 <div class="flex-img image-hover__wrapper dw-mod">2754 @if (settings.Stickers != null)2755 {2756 if (settings.Stickers.Position != StickersListPosition.Custom)2757 {2758 @Render(settings.Stickers);2759 }2760 }2761 @Render(settings.Image)2762 </div>2763 }2764 </div>2765 </div>27662767 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary))2768 {2769 <div class="grid__col-md-9">2770 @if (!String.IsNullOrEmpty(settings.Title))2771 {2772 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3>2773 }2774 @if (settings.Stickers != null)2775 {2776 if (settings.Stickers.Position == StickersListPosition.Custom)2777 {2778 @Render(settings.Stickers);2779 }2780 }2781 @if (!String.IsNullOrEmpty(settings.SubTitle))2782 {2783 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>2784 }2785 @if (!String.IsNullOrEmpty(settings.Summary))2786 {2787 <p class="article__short-summary dw-mod">@settings.Summary</p>2788 }2789 </div>2790 }2791 </div>2792 </a>2793 }27942795 @helper RenderArticleListItemSimple(ArticleListItem settings) {2796 <a href="@settings.Link" class="u-color-inherit">2797 <div class="grid u-color-light--bg u-no-padding dw-mod">2798 <div class="grid__col-md-12">2799 @if (!String.IsNullOrEmpty(settings.Title))2800 {2801 <div class="article-list-item__header u-truncate-text u-no-margin dw-mod">@settings.Title</div>2802 }2803 @if (!String.IsNullOrEmpty(settings.SubTitle))2804 {2805 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>2806 }2807 </div>2808 </div>2809 </a>2810 }2811 @using System.Reflection2812 @using Dynamicweb.Rapido.Blocks.Components.Articles281328142815 @* Component for the articles *@28162817 @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings)2818 {2819 <small class="article__subscription">2820 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date)))2821 {2822 <text>@Translate("Written")</text>2823 }2824 @if (!string.IsNullOrWhiteSpace(settings.Author))2825 {2826 <text>@Translate("by") @settings.Author</text>2827 }2828 @if (!string.IsNullOrWhiteSpace(settings.Date))2829 {2830 <text>@Translate("on") @settings.Date</text>2831 }2832 </small>2833 }2834 @using System.Reflection2835 @using Dynamicweb.Rapido.Blocks.Components.Articles2836 @using Dynamicweb.Rapido.Blocks.Components.General283728382839 @* Component for the articles *@28402841 @helper RenderArticleLink(ArticleLink settings)2842 {2843 if (!string.IsNullOrEmpty(settings.Title))2844 {2845 Button link = new Button {2846 ConfirmText = settings.ConfirmText,2847 ConfirmTitle = settings.ConfirmTitle,2848 ButtonType = settings.ButtonType,2849 Id = settings.Id,2850 Title = settings.Title,2851 AltText = settings.AltText,2852 OnClick = settings.OnClick,2853 CssClass = settings.CssClass,2854 Disabled = settings.Disabled,2855 Icon = settings.Icon,2856 Name = settings.Name,2857 Href = settings.Href,2858 ButtonLayout = settings.ButtonLayout,2859 ExtraAttributes = settings.ExtraAttributes2860 };2861 <div class="grid__cell">2862 @Render(link)2863 </div>2864 }2865 }2866 @using System.Reflection2867 @using Dynamicweb.Rapido.Blocks2868 @using Dynamicweb.Rapido.Blocks.Components.Articles2869 @using Dynamicweb.Rapido.Blocks.Components.General287028712872 @* Component for the articles *@28732874 @helper RenderArticleCarousel(ArticleCarousel settings)2875 {2876 <div class="grid">2877 <div class="grid__col-12">2878 <div class="carousel" id="carousel_@settings.Id">2879 <div class="carousel__container js-carousel-slides dw-mod">2880 @RenderBlockList(settings.SubBlocks)2881 </div>2882 </div>2883 </div>2884 </div>28852886 <script>2887 document.addEventListener("DOMContentLoaded", function () {2888 new CarouselModule("#carousel_@settings.Id", {2889 slideTime: 0,2890 dots: true2891 });2892 });2893 </script>2894 }28952896 @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings)2897 {2898 string imageEngine = "/Admin/Public/GetImage.ashx?";28992900 string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image;2901 if (settings.ImageSettings != null)2902 {2903 defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : "";2904 defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : "";2905 defaultImage += "Crop=" + settings.ImageSettings.Crop + "&";2906 defaultImage += "Compression=" + settings.ImageSettings.Compression + "&";2907 defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&";2908 defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&";2909 }2910 defaultImage += "&Image=" + settings.Image;29112912 <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')">2913 <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title">2914 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2>2915 <div class="article-list__item-info">2916 @if (settings.Stickers != null)2917 {2918 settings.Stickers.Position = StickersListPosition.Custom;2919 @Render(settings.Stickers);2920 }29212922 <small class="u-margin-top--lg u-color-light">2923 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date)))2924 {2925 <text>@Translate("Written")</text>2926 }2927 @if (!string.IsNullOrWhiteSpace(settings.Author))2928 {2929 <text>@Translate("by") @settings.Author</text>2930 }2931 @if (!string.IsNullOrWhiteSpace(settings.Date))2932 {2933 <text>@Translate("on") @settings.Date</text>2934 }2935 </small>2936 </div>29372938 <h3 class="article__short-summary u-color-light">@settings.Summary</h3>2939 </a>2940 @if (settings.UseFilters == true)2941 {2942 <div class="background-image image-filter image-filter--darken dw-mod"></div>2943 }2944 </div>2945 }2946 @using System.Text.RegularExpressions2947 @using Dynamicweb.Rapido.Blocks.Components2948 @using Dynamicweb.Rapido.Blocks.Components.General2949 @using Dynamicweb.Rapido.Blocks.Components.Articles2950 @using Dynamicweb.Rapido.Blocks29512952 @* Component for the articles *@29532954 @helper RenderArticleVideo(ArticleVideo settings)2955 {2956 if (settings.Url != null)2957 {2958 //getting video ID from youtube URL2959 string videoCode = settings.Url;2960 Regex regex = new Regex(@".be\/(.[^?]*)");2961 Match match = regex.Match(videoCode);2962 string videoId = "";2963 if (match.Success)2964 {2965 videoId = match.Groups[1].Value;2966 }2967 else2968 {2969 regex = new Regex(@"v=([^&]+)");2970 match = regex.Match(videoCode);2971 if (match.Success)2972 {2973 videoId = match.Groups[1].Value;2974 }2975 }29762977 int autoPlay = settings.AutoPlay == "true" ? 1 : 0;29782979 <div class="video-wrapper">2980 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div>2981 </div>2982 }2983 }2984298529862987 @* Simple helpers *@29882989 @*Requires the Gallery ItemType that comes with Rapido*@2990 @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) {2991 if (gallery != null && gallery.Count > 0)2992 {2993 int count = 1;29942995 foreach (var item in gallery)2996 {2997 if (item.GetFile("ImagePath") != null)2998 {2999 string image = item.GetFile("ImagePath").PathUrlEncoded;3000 string imagePrefix = "/Admin/Public/GetImage.ashx?width=1200&amp;height=820&amp;crop=5&amp;Compression=75&amp;DoNotUpscale=1&amp;image=";3001 int imagesCount = gallery.Count;30023003 if (count == 1)3004 {3005 <label class="gallery" for="ParagraphGalleryModalTrigger" onclick="Gallery.openImage(this.querySelector('.js-gallery'))">3006 <span class="gallery__main-image">3007 <img src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=992&amp;height=760&amp;crop=0&amp;Compression=75&amp;DoNotUpscale=1&amp;image=@image" class="b-lazy flex-img js-gallery" alt="" data-for="ParagraphGallery" data-image="@imagePrefix@image" />3008 </span>3009 <span class="gallery__image-counter">3010 <i class="fas fa-camera fa-2x"></i> <span class="gallery__image-counter__number">@imagesCount</span>3011 <span class="gallery__image-counter__text">@Translate("See all") <i class="fas fa-angle-right"></i></span>3012 </span>3013 </label>3014 }3015 else3016 {3017 <div class="u-hidden js-gallery" data-for="ParagraphGallery" data-image="@imagePrefix@image"></div>3018 }30193020 count++;3021 }3022 }30233024 @Render(new ArticleGalleryModal())3025 }3026 }30273028 @helper RenderMobileFilters(List<Block> subBlocks)3029 {3030 if (subBlocks.Count > 0)3031 {3032 <div class="grid__col-12">3033 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" />3034 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters">3035 @RenderBlockList(subBlocks)3036 </div>3037 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label>3038 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label>3039 </div>3040 }3041 }304230433044 @* Include the Blocks for the page *@3045 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>30463047 @using System3048 @using System.Web3049 @using System.Collections.Generic3050 @using Dynamicweb.Rapido.Blocks.Extensibility3051 @using Dynamicweb.Rapido.Blocks30523053 @{3054 BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master");30553056 Block tagManager = new Block()3057 {3058 Id = "TagManager",3059 SortId = 1,3060 Template = RenderGoogleTagManager()3061 };30623063 Block facebookPixel = new Block()3064 {3065 Id = "FacebookPixel",3066 SortId = 2,3067 Template = RenderFacebookPixel()3068 };30693070 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManager);3071 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel);3072 }30733074 @helper RenderGoogleTagManager() {3075 string GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID");30763077 if (!string.IsNullOrWhiteSpace(GoogleTagManagerID))3078 {3079 <script>3080 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':3081 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],3082 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=3083 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);3084 })(window,document,'script','dataLayer','@GoogleTagManagerID');3085 </script>3086 <!-- Google Tag Manager (noscript) -->3087 <noscript>3088 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID"3089 height="0" width="0" style="display:none;visibility:hidden"></iframe>3090 </noscript>3091 <!-- End Google Tag Manager (noscript) -->3092 }3093 }30943095 @helper RenderFacebookPixel() {3096 string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID");30973098 if (!string.IsNullOrWhiteSpace(FacebookPixelID))3099 {3100 <!-- Facebook Pixel Code -->3101 <script>3102 !function(f,b,e,v,n,t,s)3103 {if(f.fbq)return;n=f.fbq=function(){n.callMethod?3104 n.callMethod.apply(n,arguments):n.queue.push(arguments)};3105 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';3106 n.queue=[];t=b.createElement(e);t.async=!0;3107 t.src=v;s=b.getElementsByTagName(e)[0];3108 s.parentNode.insertBefore(t,s)}(window, document,'script',3109 'https://connect.facebook.net/en_US/fbevents.js');3110 fbq('init', '@FacebookPixelID');3111 fbq('track', 'PageView');3112 </script>3113 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript>3114 }3115 }3116 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>31173118 @using System3119 @using System.Web3120 @using System.Collections.Generic3121 @using Dynamicweb.Rapido.Blocks3122 @using Dynamicweb.Rapido.Blocks.Extensibility3123 @using Dynamicweb.Security.UserManagement3124 @using Dynamicweb.Security.UserManagement.ExternalAuthentication3125 @using Dynamicweb.Rapido.Blocks.Components.General31263127 @{3128 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master");3129 Block loginModal = new Block()3130 {3131 Id = "LoginModal",3132 SortId = 10,3133 Component = new Modal3134 {3135 Id = "SignIn",3136 Heading = new Heading3137 {3138 Level = 2,3139 Title = Translate("Sign in")3140 },3141 Width = ModalWidth.Xs,3142 BodyTemplate = RenderLoginForm()3143 }3144 };31453146 if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn())3147 {3148 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal);3149 }31503151 }31523153 @helper RenderLoginForm()3154 {3155 int pageId = Model.TopPage.ID;3156 string userSignedInErrorText = "";3157 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");3158 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery";3159 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");3160 bool showModalOnStart = pageId != GetPageIdByNavigationTag("CustomerCenter") && Model.LogOnFailed;3161 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");3162 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink");31633164 ProviderCollection providers = Provider.GetActiveProviders();31653166 if (Model.LogOnFailed)3167 {3168 switch (Model.LogOnFailedReason)3169 {3170 case LogOnFailedReason.PasswordLengthInvalid:3171 userSignedInErrorText = Translate("Password length is invalid");3172 break;3173 case LogOnFailedReason.IncorrectLogin:3174 userSignedInErrorText = Translate("Invalid email or password");3175 break;3176 case LogOnFailedReason.ExceededFailedLogOnLimit:3177 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked");3178 break;3179 case LogOnFailedReason.LoginLocked:3180 userSignedInErrorText = Translate("The user account is temporarily locked");3181 break;3182 case LogOnFailedReason.PasswordExpired:3183 userSignedInErrorText = Translate("The password has expired and needs to be renewed");3184 break;3185 default:3186 userSignedInErrorText = Translate("An unknown error occured");3187 break;3188 }3189 }31903191 Form form = new Form { Method = FormMethod.Post, Name = "LoginModalForm" };31923193 form.Add(new HiddenField { Name = "ID", Value = Converter.ToString(pageId) });3194 form.Add(new HiddenField { Name = "DWExtranetUsernameRemember", Value = "True" });3195 form.Add(new HiddenField { Name = "DWExtranetPasswordRemember", Value = "True" });3196 form.Add(new HiddenField { Name = "LoginAction", Value = "Login" });3197 form.Add(new TextField { Id = "LoginUsername", Name = "username", Label = Translate("Email"), CssClass = "u-full-width" });3198 form.Add(new TextField { Id = "LoginPassword", Name = "password", Type = TextFieldType.Password, Label = Translate("Password"), CssClass = "u-full-width" });3199 form.Add(new NotificationMessage { Message = userSignedInErrorText, MessageType = NotificationMessageType.Error });3200 form.Add(new CheckboxField { Id = "LoginRememberMe", Value = "True", Name = "Autologin", Label = Translate("Remember me") });3201 form.Add(new Button { ButtonType = ButtonType.Submit, Title = Translate("Sign in"), CssClass = "btn--full", OnClick = "Buttons.LockButton(event)" });32023203 foreach (Provider LoginProvider in providers)3204 {3205 var ProviderName = LoginProvider.Name.ToLower();3206 form.Add(new Link {3207 Href = "/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=" + LoginProvider.ID,3208 Icon = new Icon { Prefix = "fab", Name = "fa-" + ProviderName, CssClass = "fa-1_5x" },3209 ButtonLayout = ButtonLayout.LinkClean,3210 CssClass = "btn--condensed u-margin-bottom u-margin-right u-inline-block u-color-" + ProviderName,3211 AltText = ProviderName3212 });3213 }32143215 if (!hideCreateAccountLink) {3216 form.Add(new Link { Href = "/default.aspx?ID=" + createAccountPageId, Title = Translate("Create account?"), ButtonLayout = ButtonLayout.None, CssClass = "u-block u-padding-bottom" });3217 }32183219 if (!hideForgotPasswordLink) {3220 form.Add(new Link { Href = forgotPasswordPageLink, Title = Translate("Forgot your password?"), ButtonLayout = ButtonLayout.None, CssClass = "u-block u-padding-bottom" });3221 }32223223 @Render(form)3224 if (showModalOnStart)3225 {3226 <script>3227 document.getElementById("SignInModalTrigger").checked = true;3228 </script>3229 }3230 }32313232 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet")3233 {3234 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>32353236 @using System3237 @using System.Web3238 @using System.Collections.Generic3239 @using Dynamicweb.Rapido.Blocks.Extensibility3240 @using Dynamicweb.Rapido.Blocks324132423243 @functions {3244 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master");3245 }32463247 @{3248 bool mobileOnlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("mobileOnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0;3249 mobileOnlyPreview = Dynamicweb.Rapido.Services.User.IsUserAnonymous() ? true : mobileOnlyPreview;3250 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";3251 bool mobileHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");3252 bool mobileHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart") || mobileOnlyPreview;32533254 Block mobileHeader = new Block()3255 {3256 Id = "MobileTop",3257 SortId = 10,3258 Template = RenderMobileTop(),3259 SkipRenderBlocksList = true3260 };3261 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader);32623263 Block mobileHeaderNavigation = new Block()3264 {3265 Id = "MobileHeaderNavigation",3266 SortId = 10,3267 Template = RenderMobileHeaderNavigation(),3268 SkipRenderBlocksList = true,3269 BlocksList = new List<Block> {3270 new Block {3271 Id = "MobileHeaderNavigationTrigger",3272 SortId = 10,3273 Template = RenderMobileHeaderNavigationTrigger()3274 }3275 }3276 };3277 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation);32783279 Block mobileHeaderLogo = new Block()3280 {3281 Id = "MobileHeaderLogo",3282 SortId = 20,3283 Template = RenderMobileHeaderLogo(),3284 SkipRenderBlocksList = true3285 };3286 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo);32873288 Block mobileHeaderActions = new Block()3289 {3290 Id = "MobileHeaderActions",3291 SortId = 30,3292 Template = RenderMobileTopActions(),3293 SkipRenderBlocksList = true3294 };3295 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions);32963297 if (!mobileHideSearch)3298 {3299 Block mobileHeaderSearch = new Block3300 {3301 Id = "MobileHeaderSearch",3302 SortId = 10,3303 Template = RenderMobileTopSearch()3304 };3305 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch);3306 }33073308 Block mobileHeaderMiniCart;33093310 if (!mobileHideCart)3311 {3312 mobileHeaderMiniCart = new Block3313 {3314 Id = "MobileHeaderMiniCart",3315 SortId = 20,3316 Template = RenderMobileTopMiniCart()3317 };33183319 Block miniCartCounterScriptTemplate = new Block3320 {3321 Id = "MiniCartCounterScriptTemplate",3322 Template = RenderMobileMiniCartCounterContent()3323 };3324 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate);3325 }3326 else3327 {3328 mobileHeaderMiniCart = new Block3329 {3330 Id = "MobileHeaderMiniCart",3331 SortId = 203332 };3333 }33343335 if (!mobileHideSearch)3336 {3337 Block mobileHeaderSearchBar = new Block()3338 {3339 Id = "MobileHeaderSearchBar",3340 SortId = 30,3341 Template = RenderMobileTopSearchBar()3342 };3343 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar);3344 }33453346 switch (mobileTopLayout)3347 {3348 case "nav-left":3349 mobileHeaderNavigation.SortId = 10;3350 mobileHeaderLogo.SortId = 20;3351 mobileHeaderActions.SortId = 30;3352 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart);3353 break;3354 case "nav-right":3355 mobileHeaderLogo.SortId = 10;3356 mobileHeaderActions.SortId = 20;3357 mobileHeaderNavigation.SortId = 30;3358 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart);3359 break;3360 case "nav-search-left":3361 mobileHeaderNavigation.SortId = 10;3362 mobileHeaderLogo.SortId = 20;3363 mobileHeaderActions.SortId = 30;3364 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart);3365 break;3366 case "search-left":3367 mobileHeaderActions.SortId = 10;3368 mobileHeaderLogo.SortId = 20;3369 mobileHeaderNavigation.SortId = 30;3370 mobileHeaderMiniCart.SortId = 0;3371 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart);3372 break;3373 }3374 if (!mobileOnlyPreview)3375 {3376 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block {3377 Id = "CartInitialization",3378 Template = RenderMobileCartInitialization()3379 });3380 }3381 }33823383 @helper RenderMobileCartInitialization()3384 {3385 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");3386 <script>3387 window.cartId = "@miniCartFeedPageId";3388 </script>3389 }33903391 @helper RenderMobileTop() {3392 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList();33933394 <nav class="main-navigation-mobile dw-mod">3395 <div class="center-container top-container__center-container dw-mod">3396 <div class="grid grid--align-center">3397 @RenderBlockList(subBlocks)3398 </div>3399 </div>3400 </nav>3401 }34023403 @helper RenderMobileHeaderNavigation() {3404 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList();34053406 <div class="grid__col-auto-width">3407 <ul class="menu dw-mod">3408 @RenderBlockList(subBlocks)3409 </ul>3410 </div>3411 }34123413 @helper RenderMobileHeaderNavigationTrigger() {3414 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">3415 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label>3416 </li>3417 }34183419 @helper RenderMobileHeaderLogo() {3420 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList();34213422 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";3423 string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : "";3424 string firstPageId = Model.Area.FirstActivePage.ID.ToString();3425 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName");34263427 string mobileLogo = "/Files/Images/logo-dynamicweb.png";3428 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null)3429 {3430 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded;3431 }34323433 if (Path.GetExtension(mobileLogo).ToLower() != ".svg")3434 {3435 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&amp;crop=5&amp;Compression=75&amp;image=" + mobileLogo;3436 }3437 else3438 {3439 mobileLogo = HttpUtility.UrlDecode(mobileLogo);3440 }34413442 <div class="grid__col-auto grid__col--bleed">3443 <div class="grid__cell @centeredLogo">3444 <a href="/Default.aspx?ID=@firstPageId" class="logo logo--mobile u-inline-block dw-mod">3445 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" />3446 </a>3447 </div>34483449 @RenderBlockList(subBlocks)3450 </div>3451 }34523453 @helper RenderMobileTopActions() {3454 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList();34553456 <div class="grid__col-auto-width">3457 <ul class="menu dw-mod">3458 @RenderBlockList(subBlocks)3459 </ul>3460 </div>3461 }34623463 @helper RenderMobileTopSearch() {3464 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">3465 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod">3466 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i>3467 </label>3468 </li>3469 }34703471 @helper RenderMobileTopMiniCart() {3472 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");3473 int cartPageId = GetPageIdByNavigationTag("CartPage");3474 double cartProductsCount = Model.Cart.TotalProductsCount;34753476 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper">3477 <div class="mini-cart dw-mod">3478 <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">3479 <div class="u-inline u-position-relative">3480 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i>3481 <div class="mini-cart__counter dw-mod">3482 <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">3483 <div class="js-mini-cart-counter-content" data-count="@cartProductsCount">3484 @cartProductsCount3485 </div>3486 </div>3487 </div>3488 </div>3489 </a>3490 </div>3491 </li>3492 }34933494 @helper RenderMobileTopSearchBar()3495 {3496 string searchFeedId = "";3497 string searchSecondFeedId = "";3498 int groupsFeedId;3499 int productsPageId = GetPageIdByNavigationTag("ProductsPage");3500 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;3501 string resultPageLink;3502 string searchPlaceholder;3503 string searchType = "product-search";3504 string searchTemplate;3505 string searchContentTemplate = "";3506 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? "";3507 bool showGroups = true;35083509 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch")3510 {3511 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true";3512 resultPageLink = contentSearchPageLink;3513 searchPlaceholder = Translate("Search page");3514 groupsFeedId = 0;3515 searchType = "content-search";3516 searchTemplate = "SearchPagesTemplate";3517 showGroups = false;3518 }3519 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch")3520 {3521 searchFeedId = productsPageId + "&feed=true";3522 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true";3523 resultPageLink = Converter.ToString(productsPageId);3524 searchPlaceholder = Translate("Search products or pages");3525 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed");3526 searchType = "combined-search";3527 searchTemplate = "SearchProductsTemplateWrap";3528 searchContentTemplate = "SearchPagesTemplateWrap";3529 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector");3530 }3531 else3532 {3533 resultPageLink = Converter.ToString(productsPageId);3534 searchFeedId = productsPageId + "&feed=true";3535 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed");3536 searchPlaceholder = Translate("Search products");3537 searchTemplate = "SearchProductsTemplate";3538 searchType = "product-search";3539 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector");3540 }35413542 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" />35433544 <div class="main-navigation-mobile typeahead-mobile dw-mod">3545 <div class="center-container top-container__center-container dw-mod">3546 <div class="grid">3547 <div class="grid__col-auto">3548 <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">3549 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue">3550 @if (string.IsNullOrEmpty(searchSecondFeedId))3551 {3552 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="MobileProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></ul>3553 }3554 else3555 {3556 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid">3557 <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>3558 <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>3559 </div>3560 }3561 <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>3562 </div>3563 </div>3564 <div class="grid__col-auto-width">3565 <ul class="menu dw-mod">3566 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">3567 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod">3568 <i class="fas fa-times fa-1_5x"></i>3569 </label>3570 </li>3571 </ul>3572 </div>3573 </div>3574 </div>3575 </div>3576 }35773578 @helper RenderMobileMiniCartCounterContent()3579 {3580 <script id="MiniCartCounterContent" type="text/x-template">3581 {{#.}}3582 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}">3583 {{numberofproducts}}3584 </div>3585 {{/.}}3586 </script>3587 }3588 </text>3589 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>35903591 @using System3592 @using System.Web3593 @using System.Collections.Generic3594 @using Dynamicweb.Rapido.Blocks.Extensibility3595 @using Dynamicweb.Rapido.Blocks35963597 @functions {3598 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master");3599 }36003601 @{3602 bool mobileNavigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn");3603 bool mobileHideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");3604 bool mobileHideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile");3605 bool mobileHideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders");3606 bool mobileHideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards");3607 bool mobileHideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites");36083609 Block mobileNavigation = new Block()3610 {3611 Id = "MobileNavigation",3612 SortId = 10,3613 Template = MobileNavigation(),3614 SkipRenderBlocksList = true3615 };3616 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation);36173618 if (Model.CurrentUser.ID > 0 && !mobileHideMyProfileLink)3619 {3620 Block mobileNavigationSignIn = new Block3621 {3622 Id = "MobileNavigationSignIn",3623 SortId = 10,3624 Template = RenderMobileNavigationSignIn()3625 };3626 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn);3627 }36283629 Block mobileNavigationMenu = new Block3630 {3631 Id = "MobileNavigationMenu",3632 SortId = 20,3633 Template = RenderMobileNavigationMenu()3634 };3635 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu);36363637 Block mobileNavigationActions = new Block3638 {3639 Id = "MobileNavigationActions",3640 SortId = 30,3641 Template = RenderMobileNavigationActions(),3642 SkipRenderBlocksList = true3643 };3644 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions);36453646 if (!mobileNavigationItemsHideSignIn)3647 {3648 if (Model.CurrentUser.ID <= 0)3649 {3650 Block mobileNavigationSignInAction = new Block3651 {3652 Id = "MobileNavigationSignInAction",3653 SortId = 10,3654 Template = RenderMobileNavigationSignInAction()3655 };3656 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction);36573658 if (!mobileHideCreateAccountLink)3659 {3660 Block mobileNavigationCreateAccountAction = new Block3661 {3662 Id = "MobileNavigationCreateAccountAction",3663 SortId = 20,3664 Template = RenderMobileNavigationCreateAccountAction()3665 };3666 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction);3667 }3668 }3669 else3670 {3671 if (!mobileHideMyOrdersLink)3672 {3673 Block mobileNavigationOrdersAction = new Block3674 {3675 Id = "MobileNavigationOrdersAction",3676 SortId = 20,3677 Template = RenderMobileNavigationOrdersAction()3678 };3679 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction);3680 }3681 if (!mobileHideMyFavoritesLink)3682 {3683 Block mobileNavigationFavoritesAction = new Block3684 {3685 Id = "MobileNavigationFavoritesAction",3686 SortId = 30,3687 Template = RenderMobileNavigationFavoritesAction()3688 };3689 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction);3690 }3691 if (!mobileHideMySavedCardsLink)3692 {3693 Block mobileNavigationSavedCardsAction = new Block3694 {3695 Id = "MobileNavigationFavoritesAction",3696 SortId = 30,3697 Template = RenderMobileNavigationSavedCardsAction()3698 };3699 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction);3700 }37013702 Block mobileNavigationSignOutAction = new Block3703 {3704 Id = "MobileNavigationSignOutAction",3705 SortId = 40,3706 Template = RenderMobileNavigationSignOutAction()3707 };3708 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction);3709 }3710 }37113712 if (Model.Languages.Count > 1)3713 {3714 Block mobileNavigationLanguagesAction = new Block3715 {3716 Id = "MobileNavigationLanguagesAction",3717 SortId = 50,3718 Template = RenderMobileNavigationLanguagesAction()3719 };3720 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction);3721 }3722 }372337243725 @helper MobileNavigation()3726 {3727 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList();3728 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left";3729 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right";37303731 <!-- Trigger for mobile navigation -->3732 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" />37333734 <!-- Mobile navigation -->3735 <nav class="mobile-navigation mobile-navigation--@position dw-mod">3736 <div class="mobile-navigation__wrapper" id="mobileNavigationWrapper">3737 @RenderBlockList(subBlocks)3738 </div>3739 </nav>37403741 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label>3742 }37433744 @helper RenderMobileNavigationSignIn()3745 {3746 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");3747 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");3748 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";3749 string myProfilePageLink = linkStart + myProfilePageId;3750 string userName = Model.CurrentUser.FirstName ?? "";3751 userName += " " + (Model.CurrentUser.LastName ?? "");3752 userName += userName == "" && Model.CurrentUser.UserName != null ? Model.CurrentUser.UserName : "";37533754 <ul class="menu menu-mobile">3755 <li class="menu-mobile__item">3756 <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>3757 </li>3758 </ul>3759 }37603761 @helper RenderMobileNavigationMenu()3762 {3763 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides";3764 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt";3765 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3";3766 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");3767 int startLevel = renderPagesInToolBar ? 1 : 0;37683769 @RenderNavigation(new3770 {3771 id = "mobilenavigation",3772 cssclass = "menu menu-mobile dwnavigation",3773 startLevel = @startLevel,3774 ecomStartLevel = @startLevel + 1,3775 endlevel = @levels,3776 expandmode = "all",3777 template = @menuTemplate3778 })37793780 if (isSlidesDesign)3781 {3782 <script>3783 function goToLevel(level) {3784 document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%";3785 }37863787 document.addEventListener('DOMContentLoaded', function () {3788 goToLevel(document.getElementById('mobileNavigationWrapper').querySelectorAll('input[type=radio]:checked').length);3789 });3790 </script>3791 }37923793 if (renderPagesInToolBar)3794 {3795 @RenderNavigation(new3796 {3797 id = "topToolsMobileNavigation",3798 cssclass = "menu menu-mobile dwnavigation",3799 template = "ToolsMenuForMobile.xslt"3800 })3801 }3802 }38033804 @helper RenderMobileNavigationActions()3805 {3806 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ;38073808 <ul class="menu menu-mobile">3809 @RenderBlockList(subBlocks)3810 </ul>3811 }38123813 @helper RenderMobileNavigationSignInAction()3814 {3815 <li class="menu-mobile__item">3816 <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>3817 </li>3818 }38193820 @helper RenderMobileNavigationCreateAccountAction()3821 {3822 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");38233824 <li class="menu-mobile__item">3825 <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>3826 </li>3827 }38283829 @helper RenderMobileNavigationProfileAction()3830 {3831 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");3832 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";3833 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");3834 string myProfilePageLink = linkStart + myProfilePageId;38353836 <li class="menu-mobile__item">3837 <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>3838 </li>3839 }38403841 @helper RenderMobileNavigationOrdersAction()3842 {3843 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");3844 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";3845 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders");3846 string myOrdersPageLink = linkStart + myOrdersPageId;3847 string ordersIcon = "fas fa-list";38483849 <li class="menu-mobile__item">3850 <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>3851 </li>3852 }38533854 @helper RenderMobileNavigationFavoritesAction()3855 {3856 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");3857 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";3858 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");3859 string myFavoritesPageLink = linkStart + myFavoritesPageId;3860 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";386138623863 <li class="menu-mobile__item">3864 <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>3865 </li>3866 }38673868 @helper RenderMobileNavigationSavedCardsAction()3869 {3870 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");3871 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";3872 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards");3873 string mySavedCardsPageLink = linkStart + mySavedCardsPageId;3874 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";38753876 <li class="menu-mobile__item">3877 <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>3878 </li>3879 }38803881 @helper RenderMobileNavigationSignOutAction()3882 {3883 int pageId = Model.TopPage.ID;3884 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";38853886 <li class="menu-mobile__item">3887 <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>3888 </li>3889 }38903891 @helper RenderMobileNavigationLanguagesAction()3892 {3893 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides";38943895 string selectedLanguage = "";3896 foreach (var lang in Model.Languages)3897 {3898 if (lang.IsCurrent)3899 {3900 selectedLanguage = lang.Name;3901 }3902 }39033904 <li class="menu-mobile__item dw-mod">3905 @if (isSlidesDesign)3906 {3907 <input id="MobileMenuCheck_Language" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(1);">3908 }3909 else3910 {3911 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger">3912 }3913 <div class="menu-mobile__link__wrap">3914 <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>3915 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label>3916 </div>3917 <ul class="menu-mobile menu-mobile__submenu expand-menu">3918 @if (isSlidesDesign)3919 {3920 <li class="menu-mobile__item dw-mod">3921 <div class="menu-mobile__link__wrap">3922 <input id="MobileMenuCheck_Language_back" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(0);" />3923 <label for="MobileMenuCheck_Language_back" class="menu-mobile__trigger menu-mobile__trigger--back"></label>3924 <label for="MobileMenuCheck_Language_back" class="menu-mobile__link dw-mod ">@Translate("Back")</label>3925 </div>3926 </li>3927 }3928 @foreach (var lang in Model.Languages)3929 {3930 <li class="menu-mobile__item dw-mod">3931 <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>3932 </li>3933 }3934 </ul>3935 </li>3936 }</text>3937 }3938 else3939 {3940 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>39413942 @using System3943 @using System.Web3944 @using System.Collections.Generic3945 @using Dynamicweb.Rapido.Blocks.Extensibility3946 @using Dynamicweb.Rapido.Blocks39473948 @functions {3949 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master");3950 }39513952 @{3953 Block masterTools = new Block()3954 {3955 Id = "MasterDesktopTools",3956 SortId = 10,3957 Template = RenderDesktopTools(),3958 SkipRenderBlocksList = true,3959 BlocksList = new List<Block>3960 {3961 new Block {3962 Id = "MasterDesktopToolsText",3963 SortId = 10,3964 Template = RenderDesktopToolsText(),3965 Design = new Design3966 {3967 Size = "auto",3968 HidePadding = true,3969 RenderType = RenderType.Column3970 }3971 },3972 new Block {3973 Id = "MasterDesktopToolsNavigation",3974 SortId = 20,3975 Template = RenderDesktopToolsNavigation(),3976 Design = new Design3977 {3978 Size = "auto-width",3979 HidePadding = true,3980 RenderType = RenderType.Column3981 }3982 }3983 }3984 };3985 headerBlocksPage.Add("MasterHeader", masterTools);39863987 Block masterDesktopExtra = new Block()3988 {3989 Id = "MasterDesktopExtra",3990 SortId = 10,3991 Template = RenderDesktopExtra(),3992 SkipRenderBlocksList = true3993 };3994 headerBlocksPage.Add("MasterHeader", masterDesktopExtra);39953996 Block masterDesktopNavigation = new Block()3997 {3998 Id = "MasterDesktopNavigation",3999 SortId = 20,4000 Template = RenderDesktopNavigation(),4001 SkipRenderBlocksList = true4002 };4003 headerBlocksPage.Add("MasterHeader", masterDesktopNavigation);4004 }40054006 @* Include the Blocks for the page *@4007 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>40084009 @using System4010 @using System.Web4011 @using Dynamicweb.Rapido.Blocks.Extensibility4012 @using Dynamicweb.Rapido.Blocks40134014 @{4015 Block masterDesktopLogo = new Block4016 {4017 Id = "MasterDesktopLogo",4018 SortId = 10,4019 Template = RenderDesktopLogo(),4020 Design = new Design4021 {4022 Size = "auto-width",4023 HidePadding = true,4024 RenderType = RenderType.Column,4025 CssClass = "grid--align-self-center"4026 }4027 };40284029 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo);4030 }403140324033 @helper RenderDesktopLogo()4034 {4035 string firstPageId = Model.Area.FirstActivePage.ID.ToString();4036 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";4037 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : "";4038 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png";4039 if (Path.GetExtension(logo).ToLower() != ".svg")4040 {4041 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight");4042 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40;4043 logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&amp;crop=5&amp;Compression=75&amp;image=" + logo;4044 }4045 else4046 {4047 logo = HttpUtility.UrlDecode(logo);4048 }40494050 <div class="logo @alignClass dw-mod">4051 <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block">4052 <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" />4053 </a>4054 </div>4055 }4056 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>40574058 @using System4059 @using System.Web4060 @using Dynamicweb.Rapido.Blocks.Extensibility4061 @using Dynamicweb.Rapido.Blocks40624063 @functions {4064 bool isMegaMenu;4065 }40664067 @{4068 isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false;4069 Block masterDesktopMenu = new Block4070 {4071 Id = "MasterDesktopMenu",4072 SortId = 10,4073 Template = RenderDesktopMenu(),4074 Design = new Design4075 {4076 Size = "auto",4077 HidePadding = true,4078 RenderType = RenderType.Column4079 }4080 };40814082 if (isMegaMenu)4083 {4084 masterDesktopMenu.Design.CssClass = "u-reset-position";4085 }40864087 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu);4088 }40894090 @helper RenderDesktopMenu()4091 {4092 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";4093 string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : "";4094 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : "";4095 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");4096 bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders");4097 int startLevel = renderPagesInToolBar ? 1 : 0;40984099 string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink");41004101 <div class="grid__cell u-flex @(isMegaMenu ? "u-reset-position" : "") @menuAlignment">4102 @if (!isMegaMenu)4103 {4104 @RenderNavigation(new4105 {4106 id = "topnavigation",4107 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap",4108 startLevel = startLevel,4109 ecomStartLevel = startLevel + 1,4110 endlevel = 5,4111 expandmode = "all",4112 template = "BaseMenuWithDropdown.xslt"4113 });4114 }4115 else4116 {4117 @RenderNavigation(new4118 {4119 id = "topnavigation",4120 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap",4121 startLevel = startLevel,4122 ecomStartLevel = startLevel + 1,4123 endlevel = 5,4124 promotionImage = megamenuPromotionImage,4125 promotionLink = promotionLink,4126 expandmode = "all",4127 showOnlyHeaders = showOnlyHeaders.ToString().ToLower(),4128 template = "BaseMegaMenu.xslt"4129 });4130 }4131 </div>4132 }4133 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>41344135 @using System4136 @using System.Web4137 @using Dynamicweb.Rapido.Blocks.Extensibility4138 @using Dynamicweb.Rapido.Blocks41394140 @{4141 Block masterDesktopActionsMenu = new Block4142 {4143 Id = "MasterDesktopActionsMenu",4144 SortId = 10,4145 Template = RenderDesktopActionsMenu(),4146 Design = new Design4147 {4148 CssClass = "u-flex"4149 },4150 SkipRenderBlocksList = true41514152 };4153 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu);41544155 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink")))4156 {4157 Block masterDesktopActionsHeaderButton = new Block4158 {4159 Id = "MasterDesktopActionsHeaderButton",4160 SortId = 60,4161 Template = RenderHeaderButton()4162 };4163 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton);4164 }4165 }41664167 @helper RenderDesktopActionsMenu()4168 {4169 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList();41704171 <ul class="menu u-flex dw-mod">4172 @RenderBlockList(subBlocks)4173 </ul>4174 }41754176 @helper RenderHeaderButton()4177 {4178 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText");4179 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink");4180 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : "";41814182 <li class="menu__item menu__item--horizontal menu--clean dw-mod">4183 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-top u-margin-left" href="@headerButtonLink">@headerButtonText</a>4184 </li>4185 }4186 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>41874188 @using System4189 @using System.Web4190 @using Dynamicweb.Core;4191 @using System.Text.RegularExpressions4192 @using Dynamicweb.Rapido.Blocks.Extensibility4193 @using Dynamicweb.Rapido.Blocks41944195 @{4196 Block masterDesktopActionsMenuLanguageSelector = new Block4197 {4198 Id = "MasterDesktopActionsMenuLanguageSelector",4199 SortId = 40,4200 Template = RenderLanguageSelector()4201 };42024203 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector);4204 }42054206 @helper RenderLanguageSelector()4207 {4208 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";4209 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";4210 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";4211 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() : "";42124213 if (Model.Languages.Count > 1)4214 {4215 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod">4216 <div class="@menuLinkClass dw-mod" title="@Translate("Language")">4217 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i>4218 </div>4219 <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell">4220 @foreach (var lang in Model.Languages)4221 {4222 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name;4223 string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty);4224 cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1);42254226 if (languageViewType == "flag-culture")4227 {4228 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span> " + cultureName;4229 }42304231 if (languageViewType == "flag")4232 {4233 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span>";4234 }42354236 if (languageViewType == "name")4237 {4238 langInfo = lang.Name;4239 }42404241 if (languageViewType == "culture")4242 {4243 langInfo = cultureName;4244 }42454246 <div class="menu__item dw-mod menu__item--fixed-width">4247 <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__link dw-mod">@langInfo</a>4248 </div>4249 }4250 </div>4251 </li>4252 }4253 }4254 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>42554256 @using System4257 @using System.Web4258 @using Dynamicweb.Rapido.Blocks.Extensibility4259 @using Dynamicweb.Rapido.Blocks42604261 @functions {4262 string GetInitials(string name, string firstName, string lastName, string email, string userName)4263 {4264 string userInitials = "";42654266 if (!string.IsNullOrEmpty(name))4267 {4268 string[] names = name.Trim().Split(' ');4269 userInitials += name.Substring(0, 1);42704271 if (names.Length > 1)4272 {4273 userInitials += names[names.Length - 1].Substring(0, 1);4274 }4275 }4276 else4277 {4278 userInitials += !string.IsNullOrEmpty(firstName) ? firstName.Substring(0, 1) : "";4279 userInitials += !string.IsNullOrEmpty(lastName) ? lastName.Substring(0, 1) : "";4280 userInitials += userInitials.Length == 1 && firstName != null && firstName.Length > 1 ? firstName.Substring(1, 2) : "";4281 userInitials += userInitials == "" && email != null && email.Length > 1 ? email.Substring(0, 2) : "";4282 userInitials += userInitials == "" ? userName.Substring(0, 2) : "";4283 }4284 return userInitials;4285 }4286 }42874288 @{4289 Block masterDesktopActionsMenuSignIn = new Block4290 {4291 Id = "MasterDesktopActionsMenuSignIn",4292 SortId = 20,4293 Template = RenderSignIn()4294 };42954296 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuSignIn);4297 }42984299 @helper RenderSignIn()4300 {4301 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn");4302 string userInitials = "";4303 int pageId = Model.TopPage.ID;4304 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");4305 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard");4306 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");4307 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders");4308 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");4309 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards");4310 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");4311 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");4312 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile");4313 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders");4314 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards");4315 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites");4316 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink");43174318 string linkStart = "/Default.aspx?ID=";4319 if (Model.CurrentUser.ID <= 0)4320 {4321 linkStart += signInProfilePageId + "&RedirectPageId=";4322 }43234324 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery";4325 string myProfilePageLink = linkStart + myProfilePageId;4326 string myOrdersPageLink = linkStart + myOrdersPageId;4327 string myFavoritesPageLink = linkStart + myFavoritesPageId;4328 string mySavedCardsPageLink = linkStart + mySavedCardsPageId;43294330 string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user";4331 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";43324333 if (Model.CurrentUser.ID != 0)4334 {4335 userInitials = GetInitials(Model.CurrentUser.Name, Model.CurrentUser.FirstName, Model.CurrentUser.LastName, Model.CurrentUser.Email, Model.CurrentUser.UserName);4336 }43374338 if (!navigationItemsHideSignIn)4339 {4340 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";4341 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean";4342 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";43434344 <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod">4345 <div class="@menuLinkClass dw-mod">4346 @if (Model.CurrentUser.ID <= 0)4347 {4348 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x" title="@Translate("Sign in")"></i>4349 }4350 else4351 {4352 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit" title="@Translate("Customer center")"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a>4353 }4354 </div>4355 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod">4356 <ul class="list list--clean dw-mod">4357 @if (Model.CurrentUser.ID <= 0)4358 {4359 <li>4360 <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>4361 </li>43624363 if (!hideCreateAccountLink)4364 {4365 @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account"));4366 }4367 if (!hideForgotPasswordLink)4368 {4369 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?"))4370 }4371 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink)4372 {4373 @RenderSeparator()4374 }4375 }4376 @if (!hideMyProfileLink)4377 {4378 @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon)4379 }4380 @if (!hideMyOrdersLink)4381 {4382 @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list")4383 }4384 @if (!hideMyFavoritesLink)4385 {4386 @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon)4387 }4388 @if (!hideMySavedCardsLink)4389 {4390 @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card")4391 }4392 @if (Model.CurrentUser.ID > 0)4393 {4394 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink)4395 {4396 @RenderSeparator()4397 }43984399 @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out"))4400 }4401 </ul>4402 </div>4403 </li>4404 }4405 }44064407 @helper RenderListItem(string link, string text, string icon = null) {4408 <li>4409 <a href="@link" class="list__link dw-mod">4410 @if (!string.IsNullOrEmpty(icon)){<i class="@icon u-margin-right"></i>}@text4411 </a>4412 </li>4413 }44144415 @helper RenderSeparator()4416 {4417 <li class="list__seperator dw-mod"></li>4418 }4419 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>44204421 @using System4422 @using System.Web4423 @using Dynamicweb.Rapido.Blocks.Extensibility4424 @using Dynamicweb.Rapido.Blocks44254426 @{4427 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites");44284429 Block masterDesktopActionsMenuFavorites = new Block4430 {4431 Id = "MasterDesktopActionsMenuFavorites",4432 SortId = 30,4433 Template = RenderFavorites()4434 };44354436 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0)4437 {4438 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites);4439 }4440 }44414442 @helper RenderFavorites()4443 {4444 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");4445 string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId;44464447 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";4448 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";4449 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";44504451 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod">4452 <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod" title="@Translate("Favorites")">4453 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i>4454 </a>4455 </li>4456 }4457 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>44584459 @using System4460 @using System.Web4461 @using Dynamicweb.Rapido.Blocks.Extensibility4462 @using Dynamicweb.Rapido.Blocks44634464 @{4465 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0;4466 onlyPreview = Dynamicweb.Rapido.Services.User.IsUserAnonymous() ? true : onlyPreview;4467 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart");4468 string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown";44694470 if (!onlyPreview && !hideCart)4471 {4472 Block masterDesktopActionsMenuMiniCart = new Block4473 {4474 Id = "MasterDesktopActionsMenuMiniCart",4475 SortId = 50,4476 Template = RenderMiniCart(miniCartLayout == "dropdown"),4477 SkipRenderBlocksList = true,4478 BlocksList = new List<Block>()4479 };44804481 Block miniCartCounterScriptTemplate = new Block4482 {4483 Id = "MiniCartCounterScriptTemplate",4484 Template = RenderMiniCartCounterContent()4485 };44864487 //dropdown layout is default4488 RazorEngine.Templating.TemplateWriter layoutTemplate;4489 RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate;44904491 switch (miniCartLayout)4492 {4493 case "dropdown":4494 layoutTemplate = RenderMiniCartDropdownLayout();4495 miniCartTriggerTemplate = RenderMiniCartTriggerLink();4496 break;4497 case "panel":4498 layoutTemplate = RenderMiniCartPanelLayout();4499 miniCartTriggerTemplate = RenderMiniCartTriggerLabel();4500 break;4501 case "modal":4502 layoutTemplate = RenderMiniCartModalLayout();4503 miniCartTriggerTemplate = RenderMiniCartTriggerLabel();4504 break;4505 case "none":4506 default:4507 layoutTemplate = RenderNoLayoutMiniCart();4508 miniCartTriggerTemplate = RenderMiniCartTriggerLink();4509 break;4510 }45114512 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block4513 {4514 Id = "MiniCartTrigger",4515 Template = miniCartTriggerTemplate4516 });45174518 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")4519 {4520 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block4521 {4522 Id = "MiniCartLayout",4523 Template = layoutTemplate4524 });4525 }45264527 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuMiniCart);4528 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate);4529 }45304531 if (hideCart && !onlyPreview)4532 {4533 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block {4534 Id = "CartInitialization",4535 Template = RenderNoLayoutMiniCart()4536 });4537 }4538 }45394540 @helper RenderMiniCart(bool hasMouseEnterEvent)4541 {4542 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterDesktopActionsMenuMiniCart").OrderBy(item => item.SortId).ToList();4543 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";4544 string liClasses = topLayout != "normal" ? "menu__item--top-level" : "menu--clean";4545 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");4546 string mouseEvent = "";4547 string id = "MiniCart";4548 if (hasMouseEnterEvent)4549 {4550 mouseEvent = "onmouseenter=\"Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=" + miniCartFeedPageId + "&feedType=MiniCart')\"";4551 id = "miniCartTrigger";4552 }4553 <li class="menu__item menu__item--horizontal menu__item--icon @liClasses dw-mod" id="@id" @mouseEvent>4554 @RenderBlockList(subBlocks)4555 </li>4556 }45574558 @helper RenderNoLayoutMiniCart()4559 {4560 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");4561 <script>4562 window.cartId = "@miniCartFeedPageId";4563 </script>4564 }45654566 @helper RenderMiniCartTriggerLabel()4567 {4568 int cartPageId = GetPageIdByNavigationTag("CartPage");4569 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart";4570 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";4571 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";4572 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");45734574 <div class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')">4575 <div class="u-inline u-position-relative" title="@Translate("Cart")">4576 <i class="@cartIcon fa-1_5x"></i>4577 @RenderMiniCartCounter()4578 </div>4579 </div>4580 }45814582 @helper RenderMiniCartTriggerLink()4583 {4584 int cartPageId = GetPageIdByNavigationTag("CartPage");4585 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart";4586 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";4587 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";45884589 <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button">4590 <div class="u-inline u-position-relative" title="@Translate("Cart")">4591 <i class="@cartIcon fa-1_5x"></i>4592 @RenderMiniCartCounter()4593 </div>4594 </a>4595 }45964597 @helper RenderMiniCartCounter()4598 {4599 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");4600 string cartProductsCount = Model.Cart.TotalProductsCount.ToString();4601 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";4602 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice");4603 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : "";4604 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : "";46054606 if (showPrice && counterPosition == "right")4607 {4608 cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")";4609 }46104611 <div class="mini-cart__counter dw-mod">4612 <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">4613 <div class="js-mini-cart-counter-content" data-count="@Model.Cart.TotalProductsCount.ToString()">4614 @cartProductsCount4615 @cartProductsTotalPrice4616 </div>4617 </div>4618 </div>4619 }46204621 @helper RenderMiniCartCounterContent()4622 {4623 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice");4624 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";4625 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice;46264627 <script id="MiniCartCounterContent" type="text/x-template">4628 {{#.}}4629 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}">4630 @if (showPriceInMiniCartCounter)4631 {4632 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text>4633 }4634 else4635 {4636 <text>{{numberofproducts}}</text>4637 }4638 </div>4639 {{/.}}4640 </script>4641 }46424643 @helper RenderMiniCartDropdownLayout()4644 {4645 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");4646 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");46474648 <div class="mini-cart mini-cart-dropdown js-mini-cart grid__cell dw-mod" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="dropdown" data-cart-page-link="@cartPageLink">4649 <div class="mini-cart-dropdown__inner dw-mod">4650 <h3 class="u-ta-center dw-mod">@Translate("Shopping cart")</h3>4651 <div class="mini-cart-dropdown__body u-flex dw-mod">4652 <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>4653 </div>4654 </div>4655 </div>4656 }46574658 @helper RenderMiniCartPanelLayout()4659 {4660 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");4661 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");46624663 <div class="mini-cart grid__cell dw-mod">4664 <input type="checkbox" id="miniCartTrigger" class="panel-trigger" />4665 <div class="panel panel--right panel--with-close-btn dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink">4666 <label for="miniCartTrigger" class="panel__close-btn" title="@Translate("Close panel")"><i class="fas fa-times"></i></label>4667 <div class="panel__content u-full-width dw-mod">4668 <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3>4669 <div class="panel__content-body panel__content-body--cart dw-mod">4670 <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>4671 </div>4672 </div>4673 </div>4674 </div>4675 }46764677 @helper RenderMiniCartModalLayout()4678 {4679 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");4680 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");46814682 <div class="mini-cart grid__cell dw-mod">4683 <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" />4684 <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink">4685 <label for="miniCartTrigger" class="modal-overlay"></label>4686 <div class="modal modal--top-right dw-mod">4687 <div class="modal__body u-flex grid--direction-column dw-mod">4688 <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3>4689 <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>4690 </div>4691 <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label>4692 </div>4693 </div>4694 </div>4695 }4696 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>46974698 @using System4699 @using System.Web4700 @using Dynamicweb.Rapido.Blocks.Extensibility4701 @using Dynamicweb.Rapido.Blocks47024703 @{4704 bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart");47054706 Block masterDesktopActionsMenuDownloadCart = new Block4707 {4708 Id = "MasterDesktopActionsMenuDownloadCart",4709 SortId = 35,4710 Template = RenderDownloadCart()4711 };47124713 if (showDownloadCartLink && Model.CurrentUser.ID > 0)4714 {4715 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuDownloadCart);4716 }4717 }47184719 @helper RenderDownloadCart()4720 {4721 int downloadCartPageId = GetPageIdByNavigationTag("DownloadCart");4722 string downloadCartPageLink = "/Default.aspx?ID=" + downloadCartPageId;47234724 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";4725 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";4726 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";47274728 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod">4729 <a href="@downloadCartPageLink" class="@menuLinkClass dw-mod" title="@Translate("Download cart")">4730 <i class="fas fa-cart-arrow-down fa-1_5x"></i>4731 </a>4732 </li>4733 }4734 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>47354736 @using System4737 @using System.Web4738 @using Dynamicweb.Rapido.Blocks.Extensibility4739 @using Dynamicweb.Rapido.Blocks47404741 @functions {4742 public class SearchConfiguration4743 {4744 public string searchFeedId { get; set; }4745 public string searchSecondFeedId { get; set; }4746 public int groupsFeedId { get; set; }4747 public string resultPageLink { get; set; }4748 public string searchPlaceholder { get; set; }4749 public string searchType { get; set; }4750 public string searchTemplate { get; set; }4751 public string searchContentTemplate { get; set; }4752 public string searchValue { get; set; }4753 public bool showGroups { get; set; }47544755 public SearchConfiguration()4756 {4757 searchFeedId = "";4758 searchSecondFeedId = "";4759 searchType = "product-search";4760 searchContentTemplate = "";4761 showGroups = true;4762 }4763 }4764 }4765 @{4766 Block masterSearchBar = new Block4767 {4768 Id = "MasterSearchBar",4769 SortId = 40,4770 Template = RenderSearch("bar"),4771 Design = new Design4772 {4773 Size = "auto",4774 HidePadding = true,4775 RenderType = RenderType.Column4776 }4777 };47784779 Block masterSearchAction = new Block4780 {4781 Id = "MasterDesktopActionsMenuSearch",4782 SortId = 10,4783 Template = RenderSearch()4784 };47854786 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar);4787 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction);4788 }47894790 @helper RenderSearch(string type = "mini-search")4791 {4792 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage"));4793 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;4794 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch";47954796 SearchConfiguration searchConfiguration = null;47974798 switch (searchType) {4799 case "contentSearch":4800 searchConfiguration = new SearchConfiguration() {4801 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true",4802 resultPageLink = contentSearchPageLink,4803 searchPlaceholder = Translate("Search page"),4804 groupsFeedId = 0,4805 searchType = "content-search",4806 searchTemplate = "SearchPagesTemplate",4807 showGroups = false4808 };4809 break;4810 case "combinedSearch":4811 searchConfiguration = new SearchConfiguration() {4812 searchFeedId = productsPageId + "&feed=true",4813 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true",4814 resultPageLink = Converter.ToString(productsPageId),4815 searchPlaceholder = Translate("Search products or pages"),4816 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"),4817 searchType = "combined-search",4818 searchTemplate = "SearchProductsTemplateWrap",4819 searchContentTemplate = "SearchPagesTemplateWrap",4820 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector")4821 };4822 break;4823 default: //productSearch4824 searchConfiguration = new SearchConfiguration() {4825 resultPageLink = Converter.ToString(productsPageId),4826 searchFeedId = productsPageId + "&feed=true",4827 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"),4828 searchPlaceholder = Translate("Search products"),4829 searchTemplate = "SearchProductsTemplate",4830 searchType = "product-search",4831 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector")4832 };4833 break;4834 }4835 searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? "";48364837 if (type == "mini-search") {4838 @RenderMiniSearch(searchConfiguration)4839 } else {4840 @RenderSearchBar(searchConfiguration)4841 }4842 }48434844 @helper RenderSearchBar(SearchConfiguration options)4845 {4846 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");4847 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults");4848 bool isLiveProductInfoActive = false; // to be replaced with Dynamicweb LiveIntegration assembly property48494850 <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar"4851 data-page-size="7"4852 data-search-feed-id="@options.searchFeedId"4853 data-search-second-feed-id="@options.searchSecondFeedId"4854 data-result-page-id="@options.resultPageLink"4855 data-groups-page-id="@options.groupsFeedId"4856 data-search-type="@options.searchType"4857 data-live-price="@((isLiveProductInfoActive && showPrice && !pointShopOnly).ToString().ToLowerInvariant())">4858 @if (options.showGroups)4859 {4860 <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>4861 <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>4862 }4863 <div class="typeahead-search-field">4864 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue">4865 @if (string.IsNullOrEmpty(options.searchSecondFeedId))4866 {4867 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></ul>4868 }4869 else4870 {4871 <div class="dropdown dropdown--absolute-position dropdown--combined grid">4872 <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>4873 <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>4874 </div>4875 }4876 </div>4877 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn" title="@Translate("Search")"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button>4878 </div>4879 }48804881 @helper RenderMiniSearch(SearchConfiguration options)4882 {4883 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");4884 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults");4885 bool isLiveProductInfoActive = false; // to be replaced with Dynamicweb LiveIntegration assembly property48864887 <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="if (typeof Search != 'undefined') { Search.ShowMiniSearch(this) }">4888 <div class="menu__link menu__link--icon dw-mod" title="@Translate("Search")">4889 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i>4890 </div>4891 <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod">4892 <div class="typeahead js-typeahead" id="ProductSearchBar"4893 data-page-size="7"4894 data-search-feed-id="@options.searchFeedId"4895 data-search-second-feed-id="@options.searchSecondFeedId"4896 data-result-page-id="@options.resultPageLink"4897 data-search-type="@options.searchType"4898 data-live-price="@((isLiveProductInfoActive && showPrice && !pointShopOnly).ToString().ToLowerInvariant())">4899 <div class="typeahead-search-field">4900 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue">4901 @if (string.IsNullOrEmpty(options.searchSecondFeedId))4902 {4903 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></ul>4904 }4905 else4906 {4907 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned">4908 <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>4909 <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>4910 </div>4911 }4912 </div>4913 </div>4914 </div>4915 </li>4916 }4917 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>49184919 @using System4920 @using System.Web4921 @using Dynamicweb.Rapido.Blocks.Extensibility4922 @using Dynamicweb.Rapido.Blocks49234924 @{4925 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";4926 bool hideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");49274928 BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master");49294930 Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo");4931 headerConfigurationPage.RemoveBlock(configDesktopLogo);49324933 Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu");4934 headerConfigurationPage.RemoveBlock(configDesktopMenu);49354936 Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar");4937 headerConfigurationPage.RemoveBlock(configSearchBar);49384939 Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch");4940 headerConfigurationPage.RemoveBlock(configSearchAction);49414942 Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu");4943 headerConfigurationPage.RemoveBlock(configDesktopActionsMenu);49444945 Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra");49464947 switch (topLayout)4948 {4949 case "condensed": //24950 configDesktopLogo.Design.Size = "auto-width";4951 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);49524953 configDesktopMenu.SortId = 20;4954 configDesktopMenu.Design.Size = "auto";4955 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);49564957 configDesktopActionsMenu.SortId = 30;4958 configDesktopActionsMenu.Design.Size = "auto-width";4959 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);49604961 if (!hideSearch)4962 {4963 configSearchBar.SortId = 40;4964 configSearchBar.Design.Size = "12";4965 configDesktopExtra.SortId = 50;4966 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);4967 }4968 break;4969 case "splitted": //34970 configDesktopLogo.Design.Size = "auto";4971 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);49724973 if (!hideSearch)4974 {4975 configSearchBar.SortId = 20;4976 configSearchBar.Design.Size = "auto";4977 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);4978 }49794980 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);49814982 configDesktopActionsMenu.SortId = 20;4983 configDesktopActionsMenu.Design.Size = "auto-width";4984 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);4985 break;4986 case "minimal": //44987 configDesktopLogo.Design.Size = "auto-width";4988 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);49894990 configDesktopMenu.Design.Size = "auto";4991 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);49924993 configDesktopActionsMenu.SortId = 20;4994 configDesktopActionsMenu.Design.Size = "auto-width";4995 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);49964997 if (!hideSearch)4998 {4999 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);5000 }5001 break;5002 case "minimal-right": //55003 configDesktopLogo.Design.Size = "auto-width";5004 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);50055006 configDesktopMenu.Design.Size = "auto";5007 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);50085009 configDesktopActionsMenu.SortId = 20;5010 configDesktopActionsMenu.Design.Size = "auto-width";5011 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);50125013 if (!hideSearch)5014 {5015 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);5016 }5017 break;5018 case "two-lines": //65019 configDesktopLogo.Design.Size = "auto";5020 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);50215022 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);50235024 configDesktopActionsMenu.SortId = 20;5025 configDesktopActionsMenu.Design.Size = "auto-width";5026 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);50275028 if (!hideSearch)5029 {5030 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);5031 }5032 break;5033 case "two-lines-centered": //75034 configDesktopLogo.Design.Size = "auto";5035 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);50365037 configDesktopMenu.Design.Size = "auto-width";5038 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);50395040 configDesktopActionsMenu.SortId = 20;5041 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);50425043 if (!hideSearch)5044 {5045 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);5046 }5047 break;5048 case "normal": //15049 default:5050 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);50515052 if (!hideSearch)5053 {5054 configSearchBar.SortId = 20;5055 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);5056 }50575058 configDesktopActionsMenu.SortId = 30;5059 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu);50605061 configDesktopActionsMenu.Design.Size = "auto-width";5062 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);5063 break;5064 }5065 }5066 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>5067 @using System5068 @using System.Web5069 @using Dynamicweb.Rapido.Blocks.Extensibility5070 @using Dynamicweb.Rapido.Blocks5071 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>5072 @using System5073 @using System.Collections.Generic5074 @using Dynamicweb.Rapido.Blocks5075 @using System.Linq5076 @using System.Web5077 @using Dynamicweb.Core5078 @using RazorEngine.Compilation.ImpromptuInterface.Dynamic507950805081 @functions {5082 BlocksPage masterPageCustom = BlocksPage.GetBlockPage("Master");5083 }5084 @{5085 masterPageCustom.GetBlockById("Body").Template = RizzoRenderMasterBody();5086 }5087 @* new *@5088 @helper RizzoRenderMasterBody() {5089 var pdfClass = !string.IsNullOrEmpty(HttpContext.Current.Request["pdf"]) ? "u-pdf" : String.Empty;5090 List<Block> subBlocks = this.masterPageCustom.GetBlockListById("Body").OrderBy(item => item.SortId).ToList();5091 var designLayout = Model.PropertyItem.GetItem("CustomSettings") != null ? Model.PropertyItem.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.PropertyItem.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : "";5092 var designLayoutAttribute = "";5093 if (designLayout.IsNotNullOrEmpty()) {5094 designLayoutAttribute = "class=\"" + designLayout +" "+pdfClass+ "\"";5095 }5096 else if(pdfClass.IsNotNullOrEmpty())5097 {5098 designLayoutAttribute = "class=\"" + pdfClass+ "\"";5099 }5100 <body @designLayoutAttribute>5101 @RenderBlockList(subBlocks)5102 </body>5103 }51045105 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>5106 @using Dynamicweb.Rapido.Blocks5107 @{51085109 }511051115112 @helper RenderDesktopTools()5113 {5114 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList();51155116 <div class="tools-navigation dw-mod">5117 <div class="center-container grid top-container__center-container dw-mod">5118 @RenderBlockList(subBlocks)5119 </div>5120 </div>5121 }51225123 @helper RenderDesktopToolsText()5124 {5125 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText");5126 if (!string.IsNullOrEmpty(toolsText))5127 {5128 <div class="u-margin-top u-margin-bottom">@toolsText</div>5129 }5130 }51315132 @helper RenderDesktopToolsNavigation()5133 {5134 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");51355136 if (renderPagesInToolBar)5137 {5138 @RenderNavigation(new5139 {5140 id = "topToolsNavigation",5141 cssclass = "menu menu-tools dw-mod dwnavigation",5142 template = "TopMenu.xslt"5143 })5144 }5145 }51465147 @helper RenderDesktopNavigation()5148 {5149 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList();5150 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";5151 string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : "";5152 <nav class="main-navigation dw-mod">5153 <div class="center-container top-container__center-container grid @alignClass dw-mod">5154 @RenderBlockList(subBlocks)5155 </div>5156 </nav>5157 }51585159 @helper RenderDesktopExtra()5160 {5161 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList();51625163 if (subBlocks.Count > 0)5164 {5165 <div class="header header-top dw-mod">5166 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod">5167 @RenderBlockList(subBlocks)5168 </div>5169 </div>5170 }5171 }</text>5172 }51735174 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>51755176 @using System5177 @using System.Web5178 @using Dynamicweb.Rapido.Blocks.Extensibility5179 @using Dynamicweb.Rapido.Blocks5180 @using Dynamicweb.Rapido.Blocks.Components.General5181 @using Dynamicweb.Frontend51825183 @functions {5184 int impersonationPageId;5185 string impersonationLayout;5186 int impersonationFeed;5187 Block impersonationBar;51885189 string getUserName(UserViewModel user)5190 {5191 string username = "";5192 if (!string.IsNullOrEmpty(user.FirstName) && !string.IsNullOrEmpty(user.LastName))5193 {5194 username = user.FirstName + " " + user.LastName;5195 }5196 else if (!string.IsNullOrEmpty(user.Name))5197 {5198 username = user.Name;5199 }5200 else if (!string.IsNullOrEmpty(user.Email))5201 {5202 username = user.Email;5203 }5204 else5205 {5206 username = user.UserName;5207 }5208 return username;5209 }5210 }52115212 @{5213 impersonationPageId = GetPageIdByNavigationTag("Impersonation");5214 impersonationLayout = Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout") != null ? Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout").SelectedValue : "bar";5215 impersonationFeed = GetPageIdByNavigationTag("UsersFeed");52165217 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0)5218 {5219 impersonationBar = new Block5220 {5221 Id = "ImpersonationBar",5222 SortId = 50,5223 Template = RenderImpersonation(),5224 SkipRenderBlocksList = true,5225 Design = new Design5226 {5227 Size = "auto-width",5228 HidePadding = true,5229 RenderType = RenderType.Column5230 }5231 };52325233 Block impersonationContent = new Block5234 {5235 Id = "ImpersonationContent",5236 SortId = 105237 };52385239 if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0)5240 {5241 //Render stop impersonation view5242 impersonationContent.Template = RenderStopImpersonationView();5243 }5244 else5245 {5246 //Render main view5247 switch (impersonationLayout)5248 {5249 case "right-lower-box":5250 impersonationContent.BlocksList.Add(5251 new Block {5252 Id = "RightLowerBoxHeader",5253 SortId = 10,5254 Component = new Heading {5255 Level = 5,5256 Title = Translate("View the list of users you can impersonate"),5257 CssClass = "impersonation-text"5258 }5259 }5260 );5261 impersonationContent.BlocksList.Add(5262 new Block {5263 Id = "RightLowerBoxContent",5264 SortId = 20,5265 Template = RenderImpersonationControls()5266 }5267 );5268 break;5269 case "right-lower-bar":5270 impersonationContent.BlocksList.Add(5271 new Block {5272 Id = "RightLowerBarContent",5273 SortId = 10,5274 Template = RenderImpersonationControls()5275 }5276 );5277 break;5278 case "bar":5279 default:5280 impersonationContent.BlocksList.Add(5281 new Block {5282 Id = "ViewListLink",5283 SortId = 20,5284 Template = RenderViewListLink()5285 }5286 );5287 impersonationContent.BlocksList.Add(5288 new Block {5289 Id = "BarTypeaheadSearch",5290 SortId = 30,5291 Template = RenderTypeaheadSearch()5292 }5293 );5294 break;5295 }5296 }5297 impersonationBar.BlocksList.Add(impersonationContent);52985299 impersonationBar.BlocksList.Add(5300 new Block5301 {5302 Id = "ImpersonationSearchTemplates",5303 SortId = 20,5304 Template = RenderSearchResultTemplate()5305 }5306 );5307 if (impersonationLayout != "bar")5308 {5309 impersonationBar.BlocksList.Add(5310 new Block5311 {5312 Id = "ImpersonationSearchScripts",5313 SortId = 30,5314 Template = RenderSearchScripts()5315 }5316 );5317 }5318 BlocksPage.GetBlockPage("Master").Add("MasterHeader", impersonationBar);5319 }5320 }53215322 @helper RenderImpersonation()5323 {5324 List<Block> subBlocks = impersonationBar.BlocksList.OrderBy(item => item.SortId).ToList();5325 <input type="checkbox" class="impersonation-trigger js-remember-state" id="ImpersonationMinimizeTrigger" />5326 <div class="impersonation impersonation--@(impersonationLayout)-layout dw-mod" id="Impersonation">5327 @if (impersonationLayout == "right-lower-box")5328 {5329 @RenderRightLowerBoxHeader()5330 }5331 <div class="center-container top-container__center-container u-padding--lg impersonation__container @(impersonationLayout != "bar" ? "impersonation__container--box" : "") dw-mod">5332 @*Impersonation*@5333 @RenderBlockList(subBlocks)5334 </div>5335 </div>5336 }53375338 @helper RenderRightLowerBoxHeader()5339 {5340 <div class="impersonation__header dw-mod">5341 <div class="impersonation__title">@Translate("Impersonation")</div>5342 <label for="ImpersonationMinimizeTrigger" class="btn btn--impersonation impersonation__minimize-btn dw-mod" onclick="this.blur();">5343 @Render(new Icon5344 {5345 Prefix = "fas",5346 Name = "fa-window-minimize"5347 })5348 </label>5349 </div>5350 }53515352 @helper RenderStopImpersonationView()5353 {5354 string username = getUserName(Model.CurrentSecondaryUser);5355 string impersonationText = "<b>" + Pageview.User.UserName + "</b> " + Translate(" is impersonating") + " <b>" + username + "</b>";5356 impersonationText = Dynamicweb.Security.UserManagement.User.ImpersonationMode == Dynamicweb.Security.UserManagement.UserImpersonation.Full ? "<b>" + username + "</b> " + Translate(" is impersonating") + " <b>" + Pageview.User.Name + "</b>" : impersonationText;53575358 if (impersonationLayout == "right-lower-box")5359 {5360 <div class="u-margin-bottom--lg u-ta-center">5361 @impersonationText5362 </div>5363 @RenderStopImpersonationForm()5364 }5365 else5366 {5367 <div class="grid grid--align-center grid--justify-space-between impersonation__stop-wrap">5368 <div class="u-margin-right--lg impersonation__stop-text">5369 <i class="fas fa-user-secret"></i>5370 @impersonationText5371 </div>5372 @RenderStopImpersonationForm()5373 </div>5374 }5375 }53765377 @helper RenderStopImpersonationForm()5378 {5379 <form method="post" class="u-no-margin">5380 @Render(new Button5381 {5382 ButtonType = ButtonType.Submit,5383 ButtonLayout = ButtonLayout.None,5384 Title = Translate("Stop impersonation"),5385 Href = "/Default.aspx?ID=" + impersonationPageId,5386 CssClass = "impersonation__button btn btn--impersonation",5387 Name = "DwExtranetRemoveSecondaryUser"5388 })5389 </form>5390 }53915392 @helper RenderImpersonationControls()5393 {5394 <div class="impersonation__controls">5395 @RenderViewListLink()5396 @RenderSearchBox()5397 </div>5398 @RenderResultsList()5399 }54005401 @helper RenderViewListLink()5402 {5403 string title = impersonationLayout == "right-lower-box" ? Translate("View the list") : Translate("View the list of users you can impersonate");5404 string buttonClasses = impersonationLayout == "right-lower-box" ? "impersonation__button btn btn--impersonation" : "impersonation__link impersonation__link";54055406 @Render(new Link {5407 ButtonLayout = ButtonLayout.None,5408 Title = title,5409 Href = "/Default.aspx?ID=" + impersonationPageId,5410 CssClass = buttonClasses5411 })5412 }54135414 @helper RenderSearchBox()5415 {5416 <div class="impersonation__search-wrap">5417 <input placeholder="@Translate("Search users")" type="text" class="impersonation__search-field dw-mod" onkeyup="searchKeyUpHandler(event)" id="ImpersonationBoxSearchField">5418 <div id="ImpersonationBoxSearchFind" class="impersonation__search-icon dw-mod" onclick="updateResults(document.getElementById('ImpersonationBoxSearchField').value)">5419 <i class="fal fa-search"></i>5420 </div>5421 <div id="ImpersonationBoxSearchClear" class="impersonation__search-icon u-hidden dw-mod" onclick="clearResults();">5422 <i class="fal fa-times"></i>5423 </div>5424 </div>5425 }54265427 @helper RenderTypeaheadSearch()5428 {5429 <div class="typeahead u-ta-right impersonation__typeahead js-typeahead dw-mod" id="ImpersonationSearchBar"5430 data-page-size="5"5431 data-search-feed-id="@impersonationFeed"5432 data-result-page-id="@impersonationPageId"5433 data-search-type="user-search"5434 data-search-parameter-name="q">54355436 <div class="typeahead-search-field">5437 <input type="text" class="u-no-margin js-typeahead-search-field" placeholder="@Translate("Search users")">5438 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ImpersonationSearchBarContent" data-template="ImpersonationSearchResult" data-json-feed="/Default.aspx?ID=@impersonationFeed" data-init-onload="false"></ul>5439 </div>5440 </div>5441 }54425443 @helper RenderResultsList()5444 {5445 <ul id="ImpersonationBoxSearchResults" class="impersonation__search-results js-handlebars-root dw-mod" data-template="ImpersonationSearchResult" data-json-feed="/Default.aspx?ID=@impersonationFeed" data-init-onload="false" data-preloader="minimal"></ul>5446 }54475448 @helper RenderSearchResultTemplate()5449 {5450 <script id="ImpersonationSearchResult" type="text/x-template">5451 {{#.}}5452 {{#Users}}5453 <li class="impersonation__search-results-item impersonation-user">5454 <form method="post" class="impersonation-user__form" name="account{{id}}">5455 <input type="hidden" id="DWExtranetSecondaryUserSelector" name="DWExtranetSecondaryUserSelector" value="{{id}}">5456 <div class="impersonation-user__info">5457 <div class="impersonation-user__name">{{userName}}</div>5458 <div class="impersonation-user__number">{{customerNumber}}</div>5459 </div>5460 @Render(new Button5461 {5462 ButtonType = ButtonType.Submit,5463 ButtonLayout = ButtonLayout.Secondary,5464 Title = Translate("Sign in as"),5465 CssClass = "impersonation-user__sign-in-btn" + (impersonationLayout != "bar" ? " btn--impersonation" : "")5466 })5467 </form>5468 </li>5469 {{/Users}}5470 {{#unless Users}}5471 <li class="impersonation__search-results-item impersonation__search-results-item--not-found">5472 @Translate("Your search gave 0 results")5473 </li>5474 {{/unless}}5475 {{/.}}5476 </script>5477 }54785479 @helper RenderSearchScripts()5480 {5481 <script>5482 let inputDelayTimer;5483 function searchKeyUpHandler(e) {5484 clearTimeout(inputDelayTimer);5485 let value = e.target.value;5486 if (value != "") {5487 inputDelayTimer = setTimeout(function () {5488 updateResults(value);5489 }, 500);5490 } else {5491 clearResults();5492 }5493 };54945495 function updateResults(value) {5496 if (value == "") {5497 return null;5498 }5499 HandlebarsBolt.UpdateContent("ImpersonationBoxSearchResults", "/Default.aspx?ID=@impersonationFeed&q=" + value);5500 document.getElementById("ImpersonationBoxSearchFind").classList.add("u-hidden");5501 document.getElementById("ImpersonationBoxSearchClear").classList.remove("u-hidden");5502 }55035504 function clearResults() {5505 document.getElementById("ImpersonationBoxSearchField").value = "";5506 HandlebarsBolt.CleanContainer("ImpersonationBoxSearchResults");5507 document.getElementById("ImpersonationBoxSearchFind").classList.remove("u-hidden");5508 document.getElementById("ImpersonationBoxSearchClear").classList.add("u-hidden");5509 }5510 </script>5511 }5512 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>55135514 @using System5515 @using System.Web5516 @using System.Collections.Generic5517 @using Dynamicweb.Rapido.Blocks.Extensibility5518 @using Dynamicweb.Rapido.Blocks55195520 @{5521 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master");5522 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table";55235524 Block orderLines = new Block5525 {5526 Id = "MiniCartOrderLines",5527 SkipRenderBlocksList = true,5528 BlocksList = new List<Block>5529 {5530 new Block {5531 Id = "MiniCartOrderLinesList",5532 SortId = 20,5533 Template = RenderMiniCartOrderLinesList()5534 }5535 }5536 };55375538 Block orderlinesScriptTemplates = new Block5539 {5540 Id = "OrderlinesScriptTemplates"5541 };55425543 if (orderlinesView == "table")5544 {5545 orderLines.Template = RenderMiniCartOrderLinesTable();5546 orderLines.BlocksList.Add(5547 new Block {5548 Id = "MiniCartOrderlinesTableHeader",5549 SortId = 10,5550 Template = RenderMiniCartOrderLinesHeader()5551 }5552 );55535554 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates();5555 }5556 else5557 {5558 orderLines.Template = RenderMiniCartOrderLinesBlocks();5559 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates();5560 }55615562 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates);55635564 Block miniCartScriptTemplates = new Block()5565 {5566 Id = "MasterMiniCartTemplates",5567 SortId = 1,5568 Template = RenderMiniCartScriptTemplates(),5569 SkipRenderBlocksList = true,5570 BlocksList = new List<Block>5571 {5572 orderLines,5573 new Block {5574 Id = "MiniCartFooter",5575 Template = RenderMiniCartFooter(),5576 SortId = 50,5577 SkipRenderBlocksList = true,5578 BlocksList = new List<Block>5579 {5580 new Block {5581 Id = "MiniCartFees",5582 Template = RenderMiniCartFees(),5583 SortId = 305584 },5585 new Block {5586 Id = "MiniCartPoints",5587 Template = RenderMiniCartPoints(),5588 SortId = 405589 },5590 new Block {5591 Id = "MiniCartTotal",5592 Template = RenderMiniCartTotal(),5593 SortId = 505594 },5595 new Block {5596 Id = "MiniCartDisclaimer",5597 Template = RenderMiniCartDisclaimer(),5598 SortId = 605599 },5600 new Block {5601 Id = "MiniCartActions",5602 Template = RenderMiniCartActions(),5603 SortId = 705604 }5605 }5606 }5607 }5608 };56095610 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates);5611 }56125613 @helper RenderMiniCartScriptsTableTemplates()5614 {5615 <script id="MiniCartOrderline" type="text/x-template">5616 {{#unless isEmpty}}5617 <tr>5618 <td class="u-w60px"><a href="{{link}}" class="{{hideimage}}"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=50&height=50&crop=5&Compression=75&image={{image}}" alt="{{name}}" title="{{name}}"></a></td>5619 <td class="u-va-middle">5620 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a>5621 {{#if variantname}}5622 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a>5623 {{/if}}5624 {{#if unitname}}5625 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div>5626 {{/if}}5627 </td>5628 <td class="u-ta-right u-va-middle">{{quantity}}</td>5629 <td class="u-ta-right u-va-middle">5630 {{#if pointsTotal}}5631 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points")5632 {{else}}5633 {{totalprice}}5634 {{/if}}5635 </td>5636 </tr>5637 {{/unless}}5638 </script>56395640 <script id="MiniCartOrderlineDiscount" type="text/x-template">5641 {{#unless isEmpty}}5642 <tr class="table__row--no-border">5643 <td class="u-w60px">&nbsp;</td>5644 <td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td>5645 <td class="u-ta-right">&nbsp;</td>5646 <td class="u-ta-right">{{totalprice}}</td>5647 </tr>5648 {{/unless}}5649 </script>5650 }56515652 @helper RenderMiniCartScriptsListTemplates()5653 {5654 int cartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");56555656 <script id="MiniCartOrderline" type="text/x-template">5657 {{#unless isEmpty}}5658 <div class="mini-cart-orderline grid dw-mod">5659 <div class="grid__col-4">5660 <a href="{{link}}" class="{{hideimage}}">5661 <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}}">5662 </a>5663 </div>5664 <div class="grid__col-8">5665 <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>5666 {{#if variantname}}5667 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div>5668 {{/if}}5669 {{#if unitname}}5670 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div>5671 {{/if}}5672 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div>56735674 <div class="grid__cell-footer">5675 <div class="grid__cell">5676 <div class="u-pull--left mini-cart-orderline__price dw-mod">5677 {{#if pointsTotal}}5678 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points")5679 {{else}}5680 {{totalprice}}5681 {{/if}}5682 </div>5683 <button type="button" title="@Translate("Remove orderline")" class="btn btn--clean btn--condensed u-pull--right mini-cart-orderline__remove-btn dw-mod" onclick="{{removeFromCartGoogleImpression}}; Cart.UpdateCart('miniCartContent', '/Default.aspx?ID=@cartFeedPageId', 'CartCmd=DelOrderLine&key={{orderLineId}}&redirect=false', true);">@Translate("Remove")</button>5684 </div>5685 </div>5686 </div>5687 </div>5688 {{/unless}}5689 </script>56905691 <script id="MiniCartOrderlineDiscount" type="text/x-template">5692 {{#unless isEmpty}}5693 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod">5694 <div class="grid__col-4">5695 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div>5696 </div>5697 <div class="grid__col-8">{{totalprice}}</div>5698 </div>5699 {{/unless}}5700 </script>5701 }57025703 @helper RenderMiniCartScriptTemplates()5704 {5705 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList();5706 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));5707 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage"));57085709 <script id="MiniCartContent" type="text/x-template">5710 {{#.}}5711 {{#unless isEmpty}}5712 @RenderBlockList(subBlocks)5713 {{/unless}}5714 {{/.}}5715 </script>5716 }57175718 @helper RenderMiniCartOrderLinesTable()5719 {5720 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList();57215722 <div class="u-overflow-auto">5723 <table class="table mini-cart-table dw-mod">5724 @RenderBlockList(subBlocks)5725 </table>5726 </div>5727 }57285729 @helper RenderMiniCartOrderLinesBlocks()5730 {5731 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList();57325733 <div class="u-overflow-auto">5734 @RenderBlockList(subBlocks)5735 </div>5736 }57375738 @helper RenderMiniCartOrderLinesHeader()5739 {5740 <thead>5741 <tr>5742 <td>&nbsp;</td>5743 <td>@Translate("Product")</td>5744 <td class="u-ta-right">@Translate("Qty")</td>5745 <td class="u-ta-right" width="120">@Translate("Price")</td>5746 </tr>5747 </thead>5748 }57495750 @helper RenderMiniCartOrderLinesList()5751 {5752 <text>5753 {{#OrderLines}}5754 {{#ifCond template "===" "CartOrderline"}}5755 {{>MiniCartOrderline}}5756 {{/ifCond}}5757 {{#ifCond template "===" "CartOrderlineMobile"}}5758 {{>MiniCartOrderline}}5759 {{/ifCond}}5760 {{#ifCond template "===" "CartOrderlineDiscount"}}5761 {{>MiniCartOrderlineDiscount}}5762 {{/ifCond}}5763 {{/OrderLines}}5764 </text>5765 }57665767 @helper RenderMiniCartFees()5768 {5769 <div class="grid u-border-top grid--external-bleed-bottom">5770 <div class="grid__col-6">5771 {{paymentmethod}}5772 </div>5773 <div class="grid__col-6 grid--align-end">{{paymentfee}}</div>5774 </div>5775 <div class="grid grid--external-bleed-bottom">5776 <div class="grid__col-6">5777 {{shippingmethod}}5778 </div>5779 <div class="grid__col-6 grid--align-end">{{shippingfee}}</div>5780 </div>5781 }57825783 @helper RenderMiniCartFooter()5784 {5785 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList();57865787 <div class="mini-cart__footer dw-mod">5788 @RenderBlockList(subBlocks)5789 </div>5790 }57915792 @helper RenderMiniCartActions()5793 {5794 int cartPageId = GetPageIdByNavigationTag("CartPage");57955796 <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>5797 <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>5798 }57995800 @helper RenderMiniCartPoints()5801 {5802 <text>5803 {{#if earnings}}5804 <div class="grid grid--external-bleed-bottom">5805 <div class="grid__col-6">@Translate("Earnings")</div>5806 <div class="grid__col-6 grid--align-end">5807 <div>5808 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points")5809 </div>5810 </div>5811 </div>5812 {{/if}}5813 </text>5814 }58155816 @helper RenderMiniCartTotal()5817 {5818 <div class="mini-cart-totals grid u-margin-bottom dw-mod">5819 <div class="grid__col-6">@Translate("Total")</div>5820 <div class="grid__col-6 grid--align-end">{{totalprice}}</div>5821 </div>5822 }58235824 @helper RenderMiniCartDisclaimer()5825 {5826 <text>5827 {{#unless hideCheckoutDisclaimer}}5828 <div class="grid u-margin-bottom">5829 <small class="grid__col-12">{{checkoutDisclaimer}}</small>5830 </div>5831 {{/unless}}5832 </text>5833 }5834 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>58355836 @using Dynamicweb.Rapido.Blocks.Extensibility5837 @using Dynamicweb.Rapido.Blocks5838 @using Dynamicweb.Rapido.Blocks.Components.General5839 @using Dynamicweb.Rapido.Blocks.Components58405841 @{5842 bool addToCartNotificationOnlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0;5843 addToCartNotificationOnlyPreview = Dynamicweb.Rapido.Services.User.IsUserAnonymous() ? true : addToCartNotificationOnlyPreview;5844 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : "";5845 string addToCartNotificationMiniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown";5846 bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart");58475848 if (!addToCartNotificationOnlyPreview && !string.IsNullOrEmpty(addToCartNotificationType))5849 {5850 if (addToCartNotificationType == "modal")5851 {5852 Block addToCartNotificationModal = new Block5853 {5854 Id = "AddToCartNotificationModal",5855 Template = RenderAddToCartNotificationModal()5856 };58575858 Block addToCartNotificationScript = new Block5859 {5860 Id = "AddToCartNotificationScript",5861 Template = RenderAddToCartNotificationModalScript()5862 };5863 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal);5864 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript);5865 }5866 else if (addToCartNotificationType == "toggle" && addToCartNotificationMiniCartLayout != "none" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")5867 {5868 Block addToCartNotificationScript = new Block5869 {5870 Id = "AddToCartNotificationScript",5871 Template = RenderAddToCartNotificationToggleScript()5872 };5873 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript);5874 }5875 }5876 }58775878 @helper RenderAddToCartNotificationModal()5879 {5880 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div>5881 }58825883 @helper RenderAddToCartNotificationModalScript()5884 {5885 int cartPageId = GetPageIdByNavigationTag("CartPage");58865887 <script id="LastAddedProductTemplate" type="text/x-template">5888 @{58895890 Modal lastAddedProduct = new Modal5891 {5892 Id = "LastAddedProduct",5893 Heading = new Heading5894 {5895 Level = 2,5896 Title = Translate("Product is added to the cart")5897 },5898 Width = ModalWidth.Md,5899 BodyTemplate = RenderModalContent()5900 };59015902 lastAddedProduct.AddActions(5903 new Button5904 {5905 ButtonType = ButtonType.Button,5906 ButtonLayout = ButtonLayout.Secondary,5907 Title = Translate("Continue shopping"),5908 CssClass = "u-pull--left u-no-margin btn--sm",5909 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false"5910 },5911 new Link5912 {5913 Href = "/Default.aspx?ID=" + cartPageId,5914 ButtonLayout = ButtonLayout.Secondary,5915 CssClass = "u-pull--right u-no-margin btn--sm",5916 Title = Translate("Proceed to checkout")5917 }5918 );59195920 @Render(lastAddedProduct)5921 }5922 </script>5923 <script>5924 document.addEventListener('addToCart', function (event) {5925 Cart.ShowLastAddedProductModal(event.detail);5926 });5927 </script>5928 }59295930 @helper RenderModalContent()5931 {5932 <div class="grid">5933 <div class="grid__col-2">5934 @Render(new Image { Path = "{{ productInfo.image }}", Link = "{{ productInfo.link }}", Title = "{{ productInfo.name }}", DisableImageEngine = true })5935 </div>5936 <div class="u-padding grid--align-self-center">5937 <span>{{quantity}}</span> x5938 </div>5939 <div class="grid__col-auto grid--align-self-center">5940 <div>{{productInfo.name}}</div>5941 {{#if productInfo.variantName}}5942 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small>5943 {{/if}}5944 {{#if productInfo.unitName}}5945 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small>5946 {{/if}}5947 </div>5948 </div>5949 }59505951 @helper RenderAddToCartNotificationToggleScript()5952 {5953 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");59545955 <script>5956 document.addEventListener('addToCart', function () {5957 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId');5958 });5959 </script>5960 }5961 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>59625963 @using System5964 @using System.Web5965 @using System.Collections.Generic5966 @using Dynamicweb.Rapido.Blocks.Extensibility5967 @using Dynamicweb.Rapido.Blocks5968 @using Dynamicweb.Rapido.Blocks.Components.General59695970 @functions {5971 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master");5972 }59735974 @{5975 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content");5976 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content");5977 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content");5978 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header");5979 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header");5980 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header");59815982 Block masterFooterContent = new Block()5983 {5984 Id = "MasterFooterContent",5985 SortId = 10,5986 Template = RenderFooter(),5987 SkipRenderBlocksList = true5988 };5989 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent);59905991 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader))5992 {5993 Block masterFooterColumnOne = new Block5994 {5995 Id = "MasterFooterColumnOne",5996 SortId = 10,5997 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent),5998 Design = new Design5999 {6000 Size = "auto",6001 RenderType = RenderType.Column6002 }6003 };6004 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne);6005 }60066007 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader))6008 {6009 Block masterFooterColumnTwo = new Block6010 {6011 Id = "MasterFooterColumnTwo",6012 SortId = 20,6013 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent),6014 Design = new Design6015 {6016 Size = "auto",6017 RenderType = RenderType.Column6018 }6019 };6020 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo);6021 }60226023 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader))6024 {6025 Block masterFooterColumnThree = new Block6026 {6027 Id = "MasterFooterColumnThree",6028 SortId = 30,6029 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent),6030 Design = new Design6031 {6032 Size = "auto",6033 RenderType = RenderType.Column6034 }6035 };6036 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree);6037 }60386039 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp"))6040 {6041 Block masterFooterNewsletterSignUp = new Block6042 {6043 Id = "MasterFooterNewsletterSignUp",6044 SortId = 40,6045 Template = RenderFooterNewsletterSignUp(),6046 Design = new Design6047 {6048 Size = "auto",6049 RenderType = RenderType.Column6050 }6051 };6052 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp);6053 }60546055 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0)6056 {6057 Block masterFooterSocialLinks = new Block6058 {6059 Id = "MasterFooterSocialLinks",6060 SortId = 50,6061 Template = RenderFooterSocialLinks(),6062 Design = new Design6063 {6064 Size = "auto",6065 RenderType = RenderType.Column6066 }6067 };6068 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks);6069 }60706071 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0)6072 {6073 Block masterFooterPayments = new Block6074 {6075 Id = "MasterFooterPayments",6076 SortId = 60,6077 Template = RenderFooterPayments(),6078 Design = new Design6079 {6080 Size = "12",6081 RenderType = RenderType.Column6082 }6083 };6084 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments);6085 }60866087 Block masterFooterCopyright = new Block6088 {6089 Id = "MasterFooterCopyright",6090 SortId = 70,6091 Template = RenderFooterCopyright(),6092 Design = new Design6093 {6094 Size = "12",6095 RenderType = RenderType.Column6096 }6097 };6098 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright);6099 }61006101 @helper RenderFooter()6102 {6103 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList();61046105 <footer class="footer dw-mod">6106 <div class="center-container top-container__center-container dw-mod">6107 <div class="grid grid--external-bleed-x">6108 @RenderBlockList(subBlocks)6109 </div>6110 </div>6111 </footer>6112 }61136114 @helper RenderFooterColumn(string header, string content)6115 {6116 <h3 class="footer__heading dw-mod">@header</h3>6117 <div class="footer__content dw-mod">6118 @content6119 </div>6120 }61216122 @helper RenderFooterNewsletterSignUp()6123 {6124 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString();6125 Form form = new Form { Action = "/Default.aspx", Method = FormMethod.Get, Enctype = FormEnctype.multipart };61266127 form.Add(new HiddenField { Name = "ID", Value = newsletterSignUpPageId });6128 form.Add(new Text { Content = "<p>" + Translate("Sign up if you would like to receive occasional treats from us") + "</p>" });6129 form.Add(new TextField {6130 Id = "NewsletterEmail", Name = "NewsletterEmail", Placeholder = Translate("Your email address"),6131 Type = TextFieldType.Email, CssClass = "use-btn-primary-height",6132 ActionButton = new Button {6133 ButtonType = ButtonType.Submit, Id="Submitter", Title = Translate("Go"), OnClick = "Buttons.LockButton(event)", CssClass = "btn--condensed"6134 }6135 });61366137 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3>6138 <div class="footer__content dw-mod">6139 @Render(form)6140 </div>6141 }61426143 @helper RenderFooterSocialLinks()6144 {6145 <h3 class="footer__heading dw-mod">@Translate("Social links")</h3>6146 <div class="footer__content dw-mod">6147 <div class="collection dw-mod">6148 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks"))6149 {6150 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel;6151 string socialIconClass = socialIcon.SelectedValue;6152 string socialIconTitle = socialIcon.SelectedName;6153 string socialLink = socialitem.GetString("Link");61546155 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a>6156 }6157 </div>6158 </div>6159 }61606161 @helper RenderFooterPayments()6162 {6163 <div class="footer__content dw-mod">6164 <div class="collection dw-mod">6165 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments"))6166 {6167 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel;6168 string paymentImage = null;6169 string paymentTitle = paymentItem.SelectedName;6170 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault();6171 if (selected != null)6172 {6173 paymentImage = selected.Icon;6174 }61756176 <div class="footer__card-type">6177 <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" />6178 </div>6179 }6180 </div>6181 </div>6182 }61836184 @helper RenderFooterCopyright()6185 {6186 <div class="grid__col-12 footer__copyright dw-mod">6187 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p>6188 </div>6189 }6190 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>61916192 @using System6193 @using System.Web6194 @using System.Collections.Generic6195 @using Dynamicweb.Rapido.Blocks.Extensibility6196 @using Dynamicweb.Rapido.Blocks6197 @using Dynamicweb.Ecommerce.Common61986199 @{6200 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master");62016202 Block masterScriptReferences = new Block()6203 {6204 Id = "MasterScriptReferences",6205 SortId = 1,6206 Template = RenderMasterScriptReferences()6207 };6208 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences);6209 }62106211 @helper RenderMasterScriptReferences() {6212 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script>6213 <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script>62146215 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript"))6216 {6217 const string folderName = "custom";6218 var minify = Model.Area.Item.GetItem("Rizzo").GetBoolean("MinifyJavascript");6219 var customBundle = Dna.Optimizer.Renderer.RenderScripts($"/Files/Templates/Designs/Rapido/js/{folderName}", $"-{folderName}-scripts", new List<string>(), new List<string>(), minify, false, false);6220 <script src="@customBundle"></script>6221 PushPromise(customBundle);6222 }62236224 PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js");6225 PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js");6226 }6227 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>62286229 @using System6230 @using System.Web6231 @using System.Collections.Generic6232 @using Dynamicweb.Rapido.Blocks.Extensibility6233 @using Dynamicweb.Rapido.Blocks6234 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce62356236 @{6237 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master");6238 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");6239 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID"));62406241 if (!navigationItemsHideSearch || isFavoriteList)6242 {6243 Block masterSearchScriptTemplates = new Block()6244 {6245 Id = "MasterSearchScriptTemplates",6246 SortId = 1,6247 Template = RenderSearchScriptTemplates()6248 };62496250 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates);6251 }6252 }62536254 @helper RenderSearchScriptTemplates()6255 {6256 int productsPageId = GetPageIdByNavigationTag("ProductsPage");6257 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;6258 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID"));6259 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0;6260 onlyPreview = Dynamicweb.Rapido.Services.User.IsUserAnonymous() ? true : onlyPreview;6261 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID"));6262 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults");6263 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton");6264 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton");6265 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton");6266 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");62676268 <script id="SearchGroupsTemplate" type="text/x-template">6269 {{#.}}6270 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li>6271 {{/.}}6272 </script>62736274 <script id="SearchProductsTemplate" type="text/x-template">6275 {{#each .}}6276 {{#Product}}6277 {{#ifCond template "!==" "SearchMore"}}6278 <li class="dropdown__item dropdown__item--seperator dw-mod">6279 @if (useFacebookPixel)6280 {6281 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text>6282 }6283 @if (useGoogleTagManager)6284 {6285 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text>6286 }6287 <div>6288 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}">6289 <div class="u-margin-right u-pull--left {{noimage}} u-hidden-xs u-hidden-xxs"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=45&height=36&crop=5&FillCanvas=True&Compression=75&image={{image}}" alt="{{name}}"></div>6290 <div class="u-pull--left">6291 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}</div>6292 @if (showPrice && !onlyPreview)6293 {6294 if (pointShopOnly)6295 {6296 <text>6297 {{#if havePointPrice}}6298 <div>6299 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points")6300 </div>6301 {{else}}6302 <small class="help-text u-no-margin">@Translate("Not available")</small>6303 {{/if}}6304 {{#unless canBePurchasedWithPoints}}6305 {{#if havePointPrice}}6306 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small>6307 {{/if}}6308 {{/unless}}6309 </text>6310 }6311 else6312 {6313 <div>{{price}}</div>6314 }6315 }6316 </div>6317 </a>6318 <div class="u-margin-left u-pull--right">6319 @{6320 var viewBtn = new Link6321 {6322 Href = "{{link}}",6323 OnClick = "{{googleImpressionClick}}",6324 ButtonLayout = ButtonLayout.Secondary,6325 CssClass = "btn--condensed u-no-margin js-ignore-click-outside",6326 Title = Translate("View")6327 };6328 }6329 @if (showAddToCartButton && !onlyPreview)6330 {6331 <text>{{#if hideAddToCartButton}}</text>6332 @Render(viewBtn)6333 <text>{{else}}</text>6334 AddToCart btn = new AddToCart {6335 ProductId = "{{productId}}",6336 ProductInfo = "{{productInfo}}",6337 BuyForPoints = pointShopOnly,6338 AddButton = new AddToCartButton6339 {6340 HideTitle = true,6341 OnClick = "{{facebookPixelAction}}",6342 CssClass = "js-ignore-click-outside",6343 Icon = new Icon {6344 CssClass = "js-ignore-click-outside"6345 },6346 ExtraAttributes = new Dictionary<string, string>6347 {6348 { "{{disabledBuyButton}}", "" }6349 }6350 }6351 };6352 @Render(btn)6353 <text>{{/if}}</text>6354 }6355 else if (showViewButton)6356 {6357 @Render(viewBtn)6358 }6359 @if (showAddToDownloadButton)6360 {6361 <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}}">6362 <i class="fas fa-plus js-button-icon"></i>6363 </button>6364 }6365 </div>6366 </div>6367 </li>6368 {{/ifCond}}6369 {{#ifCond template "===" "SearchMore"}}6370 {{>SearchMoreProducts}}6371 {{/ifCond}}6372 {{/Product}}6373 {{else}}6374 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod">6375 @Translate("Your search gave 0 results")6376 </li>6377 {{/each}}6378 </script>63796380 <script id="SearchMoreProducts" type="text/x-template">6381 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod">6382 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link">6383 @Translate("View all")6384 </a>6385 </li>6386 </script>63876388 <script id="SearchMorePages" type="text/x-template">6389 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod">6390 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link">6391 @Translate("View all")6392 </a>6393 </li>6394 </script>63956396 <script id="SearchPagesTemplate" type="text/x-template">6397 {{#each .}}6398 {{#ifCond template "!==" "SearchMore"}}6399 <li class="dropdown__item dropdown__item--seperator dw-mod">6400 <div>6401 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit">6402 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div>6403 <div class="u-pull--left">6404 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div>6405 </div>6406 </a>6407 </div>6408 </li>6409 {{/ifCond}}6410 {{#ifCond template "===" "SearchMore"}}6411 {{>SearchMorePages}}6412 {{/ifCond}}6413 {{else}}6414 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod">6415 @Translate("Your search gave 0 results")6416 </li>6417 {{/each}}6418 </script>64196420 <script id="SearchPagesTemplateWrap" type="text/x-template">6421 <div class="dropdown__column-header">@Translate("Pages")</div>6422 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod">6423 {{>SearchPagesTemplate}}6424 </ul>6425 </script>64266427 <script id="SearchProductsTemplateWrap" type="text/x-template">6428 <div class="dropdown__column-header">@Translate("Products")</div>6429 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod">6430 {{>SearchProductsTemplate}}6431 </ul>6432 </script>6433 }64346435 @using Dynamicweb.Rapido.Blocks.Components6436 @using Dynamicweb.Rapido.Blocks.Components.General6437 @using Dynamicweb.Rapido.Blocks6438 @using System.IO643964406441 @using Dynamicweb.Rapido.Blocks.Components.General6442 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce644364446445 @* Component *@64466447 @helper RenderVariantMatrix(VariantMatrix settings) {6448 if (settings != null)6449 {6450 int productLoopCounter = 0;6451 int groupCount = 0;6452 List<VariantOption> firstDimension = new List<VariantOption>();6453 List<VariantOption> secondDimension = new List<VariantOption>();6454 List<VariantOption> thirdDimension = new List<VariantOption>();64556456 foreach (VariantGroup variantGroup in settings.GetVariantGroups())6457 {6458 foreach (VariantOption variantOptions in variantGroup.GetVariantOptions())6459 {6460 if (groupCount == 0) {6461 firstDimension.Add(variantOptions);6462 }6463 if (groupCount == 1)6464 {6465 secondDimension.Add(variantOptions);6466 }6467 if (groupCount == 2)6468 {6469 thirdDimension.Add(variantOptions);6470 }6471 }6472 groupCount++;6473 }64746475 int rowCount = 0;6476 int columnCount = 0;64776478 <script>6479 var variantsCollection = [];6480 </script>64816482 <table class="table table--compact js-variants-matrix dw-mod" id="VariantMatrixTable_@settings.ProductId">6483 @if (groupCount == 1)6484 {6485 <tbody>6486 @foreach (VariantOption firstVariantOption in firstDimension)6487 {6488 var variantId = firstVariantOption.Id;6489 <tr>6490 <td class="u-bold">6491 @firstVariantOption.Name6492 </td>6493 <td>6494 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount)6495 </td>6496 </tr>6497 productLoopCounter++;6498 }64996500 <tr>6501 <td>&nbsp;</td>6502 <td>6503 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div>6504 </td>6505 </tr>6506 </tbody>6507 }6508 @if (groupCount == 2)6509 {6510 <thead>6511 <tr>6512 <td>&nbsp;</td>6513 @foreach (VariantOption variant in secondDimension)6514 {6515 <td>@variant.Name</td>6516 }6517 </tr>6518 </thead>6519 <tbody>6520 @foreach (VariantOption firstVariantOption in firstDimension)6521 {6522 string variantId = "";6523 columnCount = 0;65246525 <tr>6526 <td class="u-min-w120px">@firstVariantOption.Name</td>65276528 @foreach (VariantOption secondVariantOption in secondDimension)6529 {6530 variantId = firstVariantOption.Id + "." + secondVariantOption.Id;6531 <td>6532 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount)6533 </td>65346535 columnCount++;65366537 productLoopCounter++;6538 }65396540 <td>6541 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div>6542 </td>6543 </tr>65446545 rowCount++;6546 }65476548 @{6549 columnCount = 0;6550 }65516552 <tr>6553 <td>&nbsp;</td>6554 @foreach (VariantOption secondVariantOption in secondDimension)6555 {6556 <td>6557 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div>6558 </td>65596560 columnCount++;6561 }6562 <td>&nbsp;</td>6563 </tr>6564 </tbody>6565 }6566 @if (groupCount == 3)6567 {6568 <thead>6569 <tr>6570 <td>&nbsp;</td>6571 @foreach (VariantOption thirdVariantOption in thirdDimension)6572 {6573 <td>@thirdVariantOption.Name</td>6574 }6575 </tr>6576 </thead>6577 <tbody>6578 @foreach (VariantOption firstVariantOption in firstDimension)6579 {6580 int colspan = (thirdDimension.Count + 1);65816582 <tr>6583 <td colspan="@colspan" class="u-color-light-gray--bg u-bold">@firstVariantOption.Name</td>6584 </tr>65856586 foreach (VariantOption secondVariantOption in secondDimension)6587 {6588 string variantId = "";6589 columnCount = 0;65906591 <tr>6592 <td class="u-min-w120px">@secondVariantOption.Name</td>65936594 @foreach (VariantOption thirdVariantOption in thirdDimension)6595 {6596 variantId = firstVariantOption.Id + "." + secondVariantOption.Id + "." + thirdVariantOption.Id;65976598 <td>6599 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount)6600 </td>66016602 columnCount++;6603 productLoopCounter++;6604 }66056606 <td>6607 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div>6608 </td>6609 </tr>6610 rowCount++;6611 }6612 }66136614 @{6615 columnCount = 0;6616 }66176618 <tr>6619 <td>&nbsp;</td>6620 @foreach (VariantOption thirdVariantOption in thirdDimension)6621 {6622 <td>6623 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div>6624 </td>66256626 columnCount++;6627 }6628 <td>&nbsp;</td>6629 </tr>6630 </tbody>6631 }6632 </table>66336634 <script>6635 document.addEventListener("DOMContentLoaded", function (event) {6636 VariantMatrix.MatrixUpdateQuantity("@settings.ProductId");6637 });66386639 MatrixUpdateQuantity = function (productId) {6640 var currentMatrix = document.getElementById("VariantMatrixTable_" + productId);6641 var allQtyFields = currentMatrix.getElementsByClassName("js-qty");66426643 var qtyRowArr = [];6644 var qtyColumnArr = [];66456646 var totalQty = 0;66476648 for (var i = 0; i < allQtyFields.length; i++) {6649 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] = 0;6650 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] = 0;6651 }66526653 for (var i = 0; i < allQtyFields.length; i++) {6654 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] += parseFloat(allQtyFields[i].value);6655 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] += parseFloat(allQtyFields[i].value);6656 totalQty += parseFloat(allQtyFields[i].value);6657 }66586659 //Update row counters6660 for (var i = 0; i < qtyRowArr.length; i++) {6661 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0];66626663 if (qtyRowArr[i] != undefined && qtyCounter != null) {6664 var currentCount = qtyCounter.innerHTML;6665 qtyCounter.innerHTML = qtyRowArr[i];66666667 if (currentCount != qtyCounter.innerHTML) {6668 qtyCounter.classList.add("qty-field--active");6669 }6670 }66716672 }66736674 //Update column counters6675 for (var i = 0; i < qtyColumnArr.length; i++) {6676 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0];66776678 if (qtyColumnArr[i] != undefined && qtyCounter != null) {6679 var currentCount = qtyCounter.innerHTML;6680 qtyCounter.innerHTML = qtyColumnArr[i];66816682 if (currentCount != qtyCounter.innerHTML) {6683 qtyCounter.classList.add("qty-field--active");6684 }6685 }6686 }66876688 if (document.getElementById("TotalQtyCount_" + productId)) {6689 document.getElementById("TotalQtyCount_" + productId).innerHTML = totalQty;6690 }66916692 //Clean up animations6693 setTimeout(function () {6694 for (var i = 0; i < qtyRowArr.length; i++) {6695 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0];6696 if (qtyCounter != null) {6697 qtyCounter.classList.remove("qty-field--active");6698 }6699 }6700 for (var i = 0; i < qtyColumnArr.length; i++) {6701 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0];6702 if (qtyCounter != null) {6703 qtyCounter.classList.remove("qty-field--active");6704 }6705 }6706 }, 1000);6707 }6708 </script>6709 }6710 }67116712 @helper RenderVariantMatrixQuantityField(string variantId, VariantMatrix settings, int productLoopCounter, int rowCount, int columnCount)6713 {6714 string loopCount = productLoopCounter.ToString();67156716 bool combinationFound = false;6717 double stock = 0;6718 double quantityValue = 0;6719 string note = "";67206721 VariantProduct variantProduct = null;67226723 if (settings.GetVariantProducts().TryGetValue(variantId, out variantProduct))6724 {6725 stock = variantProduct.Stock;6726 quantityValue = variantProduct.Quantity;6727 combinationFound = true;6728 }67296730 if (combinationFound)6731 {6732 <input type="hidden" name="ProductLoopCounter@(loopCount)" value="@loopCount" />6733 <input type="hidden" name="ProductID@(loopCount)" value="@settings.ProductId" />6734 <input type="hidden" name="VariantID@(loopCount)" value="@variantId" />6735 <input type="hidden" name="CurrentNote@(loopCount)" id="CurrentNote_@(settings.ProductId)_@variantId" value="@note" />6736 <input type="number" name="Quantity@(loopCount)" id="Quantity_@(settings.ProductId)_@variantId" value="@quantityValue" min="0" class="js-qty u-no-margin use-btn-primary-height u-full-max-width" style="width: 100%; max-width: 100%" onkeyup="MatrixUpdateQuantity('@settings.ProductId')" onmouseup="MatrixUpdateQuantity('@settings.ProductId')" data-qty-row-group="@rowCount" data-qty-column-group="@columnCount">67376738 if (stock != 0)6739 {6740 <small>@Translate("Stock") @stock</small>6741 }67426743 <script>6744 var variants = '{ "ProductId" :' + '"@settings.ProductId"' + ', "VariantId": ' + '"@variantId"' +'}';6745 variantsCollection.push(variants);6746 document.getElementById("Quantity_@(settings.ProductId)_@variantId").closest(".js-variants-matrix").setAttribute("data-variants-collection", "[" + variantsCollection + "]" );6747 </script>6748 }6749 else6750 {6751 <div class="use-btn-primary-height" style="background-color: #a8a8a8"></div>6752 }6753 }6754 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce67556756 @* Component *@67576758 @helper RenderAddToCart(AddToCart settings)6759 {6760 if (!settings.AddButton.HideTitle)6761 {6762 if (string.IsNullOrEmpty(settings.AddButton.Title))6763 {6764 if (settings.BuyForPoints)6765 {6766 settings.AddButton.Title = Translate("Buy with points");6767 }6768 else6769 {6770 settings.AddButton.Title = Translate("Add to cart");6771 }6772 }6773 }6774 else6775 {6776 settings.AddButton.Title = "";6777 }67786779 if (settings.AddButton.Icon == null)6780 {6781 settings.AddButton.Icon = new Icon();6782 }67836784 if (string.IsNullOrEmpty(settings.AddButton.Icon.Name))6785 {6786 settings.AddButton.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue;6787 }67886789 if (settings.Disabled)6790 {6791 settings.AddButton.Disabled = true;6792 }67936794 //set Id for quantity selector to get it's value from button6795 if (settings.QuantitySelector != null)6796 {6797 if (string.IsNullOrEmpty(settings.QuantitySelector.Id))6798 {6799 settings.QuantitySelector.Id = Guid.NewGuid().ToString("N");6800 }68016802 if (settings.Disabled)6803 {6804 settings.QuantitySelector.Disabled = true;6805 }68066807 if (string.IsNullOrEmpty(settings.QuantitySelector.Name))6808 {6809 settings.QuantitySelector.Name = settings.QuantitySelector.Id;6810 }6811 }68126813 settings.AddButton.CssClass += " btn--condensed u-no-margin";68146815 settings.AddButton.OnClick = "Cart.AddToCart(event, { " +6816 "id: '" + settings.ProductId + "'," +6817 (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") +6818 (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") +6819 (settings.BuyForPoints ? "buyForPoints: true," : "") +6820 (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") +6821 "quantity: " + (settings.QuantitySelector == null ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelector.Id + "').value)") +6822 "});" + settings.AddButton.OnClick;68236824 //unitsSelector6825 if (settings.UnitSelector != null)6826 {6827 if (settings.Disabled)6828 {6829 settings.QuantitySelector.Disabled = true;6830 }6831 }68326833 <div class="buttons-collection @settings.WrapperCssClass" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>6834 @if (settings.UnitSelector != null)6835 {6836 @Render(settings.UnitSelector)6837 }6838 @if (settings.QuantitySelector != null)6839 {6840 @Render(settings.QuantitySelector)6841 }6842 @Render(settings.AddButton)6843 </div>6844 }6845 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce68466847 @* Component *@6848 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce68496850 @* Component *@68516852 @helper RenderUnitSelector(UnitSelector settings)6853 {6854 var id = settings.Id;6855 var disabledClass = settings.Disabled ? "disabled" : "";6856 settings.CssClass += " u-w150px u-w100px--xs";68576858 <input type="checkbox" id="@id" class="dropdown-trigger" />6859 <div class="dropdown @settings.CssClass @disabledClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>6860 <label class="dropdown__header dropdown__btn dw-mod" for="@id">@settings.SelectedOption</label>6861 <div class="dropdown__content dw-mod">6862 @settings.OptionsContent6863 </div>6864 <label class="dropdown-trigger-off" for="@id"></label>6865 </div>6866 }6867 @using System.Reflection6868 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce68696870 @* Component *@68716872 @helper RenderQuantitySelector(QuantitySelector settings)6873 {6874 var attributes = new Dictionary<string, string>();68756876 /*base settings*/6877 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }6878 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }6879 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }6880 if (settings.Disabled) { attributes.Add("disabled", "true"); }6881 if (settings.Required) { attributes.Add("required", "true"); }6882 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }6883 /*end*/68846885 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }6886 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }6887 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }6888 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }6889 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); }6890 if (settings.Min == null) { settings.Min = 1; }6891 attributes.Add("min", settings.Min.ToString());6892 if (settings.Step != 0) { attributes.Add("step", settings.Step.ToString()); }6893 if (settings.Value == null) { settings.Value = 1; }6894 attributes.Add("value", settings.Value.ToString());6895 attributes.Add("type", "number");68966897 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);68986899 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />6900 }6901 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>69026903 @using System6904 @using System.Web6905 @using System.Collections.Generic6906 @using Dynamicweb.Rapido.Blocks.Extensibility6907 @using Dynamicweb.Rapido.Blocks69086909 @{6910 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master");69116912 Block primaryBottomSnippets = new Block()6913 {6914 Id = "MasterJavascriptInitializers",6915 SortId = 100,6916 Template = RenderPrimaryBottomSnippets()6917 };6918 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets);6919 }69206921 @helper RenderPrimaryBottomSnippets() {6922 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode");6923 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));69246925 if (isWireframeMode)6926 {6927 <script>6928 Wireframe.Init(true);6929 </script>6930 }693169326933 if (useGoogleTagManager)6934 {6935 <script>6936 document.addEventListener('addToCart', function(event) {6937 var googleImpression = event.detail.productInfo.googleImpression;6938 dataLayer.push({6939 'event': 'addToCart',6940 'ecommerce': {6941 'currencyCode': '@Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency().Code',6942 'add': {6943 'products': [{6944 'name': googleImpression.name,6945 'id': googleImpression.id,6946 'price': googleImpression.price,6947 'brand': googleImpression.brand,6948 'category': googleImpression.category,6949 'variant': googleImpression.variant,6950 'quantity': event.detail.quantity6951 }]6952 }6953 }6954 });6955 });6956 </script>6957 }69586959 //if digitalwarehouse6960 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart"))6961 {6962 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]);69636964 if (string.IsNullOrEmpty(cartContextId)) {6965 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2");6966 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps);6967 cartContextId = cartSettings.OrderContextID;6968 HttpContext.Current.Application["DownloadCartContext"] = cartContextId;6969 }69706971 <script>6972 let downloadCart = new DownloadCart({6973 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"),6974 contextId: "@cartContextId",6975 addButtonText: "@Translate("Add")",6976 removeButtonText: "@Translate("Remove")"6977 });6978 </script>6979 }69806981 <!--@Javascripts-->6982 }6983 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>6984 @using System6985 @using System.Web6986 @using System.Collections.Generic6987 @using Dynamicweb.Rapido.Blocks6988 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>6989 @using Dynamicweb.Rapido.Blocks6990 @using System.Collections.Generic6991 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>6992 @using Dynamicweb.Core6993 @using Dynamicweb.Rapido.Blocks6994 @using Dynamicweb.Rapido.Blocks.Extensibility6995 @{6996 BlocksPage.GetBlockPage("Master").RemoveBlockById("ImpersonationBar");69976998 if (Model.CurrentUser.ID > 0 && Dna.AutoImpersonate.Helpers.AmountOfUserICanSetAsSecondary > 1)6999 {7000 BlocksPage.GetBlockPage("Master").Add(MasterBlockId.MasterDesktopNavigation, new Block()7001 {7002 Id = "ImpersonationBarRizzo",7003 SortId = 5,7004 Design = new Design()7005 {7006 Size = "12",7007 CssClass = "grid--justify-end",7008 RenderType = RenderType.Column7009 },7010 Template = RenderImpersonationBarRizzo()7011 });70127013 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request[Dna.AutoImpersonate.Constants.Parameters.RequireManaging]))7014 {7015 BlocksPage.GetBlockPage("Master").Add(MasterBlockId.MasterMain, new Block()7016 {7017 Id = "RequireManageAccount",7018 SortId = 15,7019 Design = new Design()7020 {7021 Size = "width-auto",7022 HidePadding = true,7023 CssClass = "u-color-warning--bg",7024 RenderType = RenderType.Column7025 },7026 Template = RenderRequireManageAccount()7027 });7028 }7029 }7030 }7031 @helper RenderImpersonationBarRizzo()7032 {7033 var switchAccountUrl = string.Format("Default.aspx?Id={0}", GetPageIdByNavigationTag(Dna.AutoImpersonate.Constants.PageProperties.NavigationTags.Impersonation));7034 var isManagingAccount = Model.CurrentSecondaryUser.ID > 0;7035 var userName = Model.CurrentUser.Name.IsNotNullOrEmpty() ? Model.CurrentUser.Name : Model.CurrentUser.FirstName.IsNotNullOrEmpty() || Model.CurrentUser.LastName.IsNotNullOrEmpty() ? string.Format("{0}{1}", Model.CurrentUser.FirstName, Model.CurrentUser.LastName) : Model.CurrentUser.UserName;70367037 <div class="u-font-size--sm">7038 @string.Format("{0}: {1}", isManagingAccount ? Translate("Managing Account") : Translate("Welcome Back"), userName)7039 <a class="u-margin-left" href="@switchAccountUrl">7040 @RenderIcon(new Icon()7041 {7042 Prefix = "fas",7043 Name = "fa-address-book",7044 Label = Translate("Manage Account"),7045 LabelPosition = IconLabelPosition.After7046 })7047 </a>7048 <a class="u-margin-left" href="/Admin/Public/ExtranetLogoff.aspx">7049 @RenderIcon(new Icon()7050 {7051 Prefix = "fas",7052 Name = "fa-sign-out",7053 Label = Translate("Logout"),7054 LabelPosition = IconLabelPosition.After7055 })7056 </a>7057 </div>7058 }70597060 @helper RenderRequireManageAccount()7061 {7062 <div class="center-container">7063 <div class="grid">7064 <div class="grid--align-self-center grid__col-x">7065 <div class="grid-cell u-bold">7066 @RenderIcon(new Icon7067 {7068 Prefix = "fas",7069 Name = "fa-exclamation-triangle",7070 Label = Translate("Please select an account to manage before continuing"),7071 LabelPosition = IconLabelPosition.After7072 })7073 </div>7074 </div>7075 </div>7076 </div>7077 }7078 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>7079 @using Dynamicweb.Rapido.Blocks70807081 @{7082 BlocksPage rizzoMiniCartBlocksPage = BlocksPage.GetBlockPage("Master");70837084 Block rizzoMiniCartOrderLinesList = new Block {7085 Id = "MiniCartOrderLinesList",7086 SortId = 20,7087 Template = RenderRizzoMiniCartOrderLinesList()7088 };7089 rizzoMiniCartBlocksPage.ReplaceBlock(rizzoMiniCartOrderLinesList);7090 }70917092 @helper RenderRizzoMiniCartOrderLinesList()7093 {7094 <text>7095 {{#OrderLines}}7096 {{#ifCond template "===" "CartOrderline"}}7097 {{>MiniCartOrderline}}7098 {{/ifCond}}7099 {{#ifCond template "===" "CartOrderlineMobile"}}7100 {{>MiniCartOrderline}}t7101 {{/ifCond}}7102 {{#ifCond template "===" "CartOrderlineDiscount"}}7103 {{>MiniCartOrderlineDiscount}}7104 {{/ifCond}}7105 {{/OrderLines}}7106 {{#OrderLinesOutOfStock}}7107 {{#ifCond template "===" "CartOrderline"}}7108 {{>MiniCartOrderline}}7109 {{/ifCond}}7110 {{#ifCond template "===" "CartOrderlineMobile"}}7111 {{>MiniCartOrderline}}7112 {{/ifCond}}7113 {{#ifCond template "===" "CartOrderlineDiscount"}}7114 {{>MiniCartOrderlineDiscount}}7115 {{/ifCond}}7116 {{/OrderLinesOutOfStock}}7117 </text>7118 }7119 @{7120 var rizzoReferencesBlocksPage = BlocksPage.GetBlockPage("Master");71217122 var rizzoMasterScriptReferences = new Block()7123 {7124 Id = "RizzoMasterScriptReferences",7125 SortId = 2,7126 Template = RenderRizzoMasterScriptReferences()7127 };7128 rizzoReferencesBlocksPage.Add(MasterBlockId.MasterReferences, rizzoMasterScriptReferences);71297130 var rizzoMasterStylesReferences = new Block()7131 {7132 Id = "RizzoMasterStylesReferences",7133 SortId = 22,7134 Template = RenderRizzoMasterStylesReferences()7135 };7136 rizzoReferencesBlocksPage.Add("Head", rizzoMasterStylesReferences);7137 }71387139 @helper RenderRizzoMasterScriptReferences() {7140 if (Model.Area.Item.GetItem("Rizzo").GetBoolean("UseRizzoJavascript"))7141 {7142 const string folderName = "rizzo";7143 var minify = Model.Area.Item.GetItem("Rizzo").GetBoolean("MinifyJavascript");7144 var bundle = Dna.Optimizer.Renderer.RenderScripts($"/Files/Templates/Designs/Rapido/js/{folderName}", $"-{folderName}-scripts", new List<string>(), new List<string>(), minify, false, false);7145 <script src="@bundle"></script>7146 PushPromise(bundle);7147 }7148 }71497150 @helper RenderRizzoMasterStylesReferences() {7151 if (Model.Area.Item.GetItem("Rizzo").GetBoolean("UseRizzoCss"))7152 {7153 const string folderName = "rizzo";7154 var minify = Model.Area.Item.GetItem("Rizzo").GetBoolean("MinifyCss");7155 var variablesFile = "/Files/Templates/Designs/Rapido/css/rapido/_variables_" + Model.Area.ID + ".auto.less";7156 var bundle = Dna.Optimizer.Renderer.RenderStyles($"/Files/Templates/Designs/Rapido/css/{folderName}", $"-{folderName}-styles", new [] {variablesFile}, new[] { $"{folderName}.css", $"{folderName}.min.css" }, minify, false, false);7157 <link id="rizzoCss" type="text/css" rel="stylesheet" href="@bundle" />7158 PushPromise(bundle);7159 }7160 }7161 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>7162 @using Dynamicweb.Rapido.Blocks7163 @{7164 var rizzoPackagesReferencesBlocksPage = BlocksPage.GetBlockPage("Master");71657166 var rizzoPackagesMasterScriptReferences = new Block()7167 {7168 Id = "RizzoPackagesMasterScriptReferences",7169 SortId = 3,7170 Template = RenderRizzoPackagesMasterScriptReferences()7171 };7172 rizzoPackagesReferencesBlocksPage.Add(MasterBlockId.MasterReferences, rizzoPackagesMasterScriptReferences);71737174 var rizzoPackagesMasterStylesReferences = new Block()7175 {7176 Id = "RizzoPackagesMasterStylesReferences",7177 SortId = 23,7178 Template = RenderRizzoPackagesMasterStylesReferences()7179 };7180 rizzoPackagesReferencesBlocksPage.Add("Head", rizzoPackagesMasterStylesReferences);7181 }71827183 @helper RenderRizzoPackagesMasterScriptReferences() {7184 if (Model.Area.Item.GetItem("RizzoPackages").GetBoolean("UseRizzoJavascript"))7185 {7186 const string folderName = "rizzoPackages";7187 var minify = Model.Area.Item.GetItem("Rizzo").GetBoolean("MinifyJavascript");7188 var bundle = Dna.Optimizer.Renderer.RenderScripts($"/Files/Templates/Designs/Rapido/js/{folderName}", $"-{folderName}-scripts", new List<string>(), new List<string>(), minify, false, false);7189 <script src="@bundle"></script>7190 PushPromise(bundle);7191 }7192 }71937194 @helper RenderRizzoPackagesMasterStylesReferences() {7195 if (Model.Area.Item.GetItem("RizzoPackages").GetBoolean("UseRizzoCss"))7196 {7197 const string folderName = "rizzoPackages";7198 var minify = Model.Area.Item.GetItem("Rizzo").GetBoolean("MinifyCss");7199 var variablesFile = "/Files/Templates/Designs/Rapido/css/rapido/_variables_" + Model.Area.ID + ".auto.less";7200 var bundle = Dna.Optimizer.Renderer.RenderStyles($"/Files/Templates/Designs/Rapido/css/{folderName}", $"-{folderName}-styles", new [] {variablesFile}, new[] { $"{folderName}.css", $"{folderName}.min.css" }, minify, false, false);7201 <link id="rizzoPackagesCss" type="text/css" rel="stylesheet" href="@bundle" />7202 PushPromise(bundle);7203 }7204 }7205 @{7206 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master");7207 BlocksPage pageCustomBlocksPage = BlocksPage.GetBlockPage("Page");72087209 }721072117212 @functions {7213 public class ManifestIcon7214 {7215 public string src { get; set; }7216 public string type { get; set; }7217 public string sizes { get; set; }7218 }72197220 public class Manifest7221 {7222 public string name { get; set; }7223 public string short_name { get; set; }7224 public string start_url { get; set; }7225 public string display { get; set; }7226 public string background_color { get; set; }7227 public string theme_color { get; set; }7228 public List<ManifestIcon> icons { get; set; }7229 }7230 }72317232 <!DOCTYPE html>72337234 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName">7235723672377238 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@7239 @RenderBlockList(masterPage.BlocksRoot.BlocksList)7240724172427243 @helper RenderMasterHead() {7244 List<Block> subBlocks = this.masterPage.GetBlockListById("Head").OrderBy(item => item.SortId).ToList();72457246 <head>7247 <!-- Rapido version 3.2 (US) BETA -->72487249 @RenderBlockList(subBlocks)7250 </head>7251 }72527253 @helper RenderMasterMetadata() {7254 var swatches = new Dynamicweb.Content.Items.ColorSwatchService();7255 var brandColors = swatches.GetColorSwatch(1);7256 string brandColorOne = brandColors.Palette["BrandColor1"];7257 //noindex,nofollow7258 List<string> robots = new List<string>();7259 robots.Add(Model.Area.Item.GetItem("Rizzo").GetBoolean("NoIndex") ? "noindex" : "index");7260 robots.Add(Model.Area.Item.GetItem("Rizzo").GetBoolean("NoFollow") ? "nofollow" : "follow");726172627263 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) {7264 Manifest manifest = new Manifest7265 {7266 name = Model.Area.Item.GetItem("Settings").GetString("AppName"),7267 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"),7268 start_url = "/",7269 display = "standalone",7270 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"),7271 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor")7272 };72737274 manifest.icons = new List<ManifestIcon> {7275 new ManifestIcon {7276 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,7277 sizes = "192x192",7278 type = "image/png"7279 },7280 new ManifestIcon {7281 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,7282 sizes = "512x512",7283 type = "image/png"7284 },7285 new ManifestIcon {7286 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,7287 sizes = "1024x1024",7288 type = "image/png"7289 }7290 };72917292 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json");7293 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest);7294 string currentManifest = File.ReadAllText(manifestFilePath);72957296 if (manifestJSON != currentManifest)7297 {7298 File.WriteAllText(manifestFilePath, manifestJSON);7299 }7300 }73017302 <meta charset="utf-8" />7303 <title>@Model.Title</title>7304 <meta name="viewport" content="width=device-width, initial-scale=1.0">7305 <meta name="robots" content="@string.Join(", ",robots)">7306 <meta name="theme-color" content="@brandColorOne" />73077308 @Model.MetaTags73097310 <meta property="og:title" content="@Model.Title" />7311 <meta property="og:description" content="@Model.Description" />7312 <meta property="og:site_name" content="@Model.Name" />7313 <meta property="og:url" content="@HttpContext.Current.Request.Url" />7314 <meta property="og:image" content="@string.Format("{0}://{1}{2}", Dynamicweb.Context.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, Model.PropertyItem.GetFile("OpenGraphImage"))" />7315 <meta property="og:type" content="Website" />7316 <meta property="fb:page_id" content="@Model.ID" />7317 }73187319 @helper RenderMasterCss() {7320 var fonts = new string[] {7321 getFontFamily("Layout", "HeaderFont"),7322 getFontFamily("Layout", "SubheaderFont"),7323 getFontFamily("Layout", "TertiaryHeaderFont"),7324 getFontFamily("Layout", "BodyText"),7325 getFontFamily("Layout", "Header", "ToolsFont"),7326 getFontFamily("Layout", "Header", "NavigationFont"),7327 getFontFamily("Layout", "MobileNavigation", "Font"),7328 getFontFamily("ProductList", "Facets", "HeaderFont"),7329 getFontFamily("ProductPage", "PriceFontDesign"),7330 getFontFamily("Ecommerce", "SaleSticker", "Font"),7331 getFontFamily("Ecommerce", "NewSticker", "Font"),7332 getFontFamily("Ecommerce", "CustomSticker", "Font")7333 };73347335 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks;7336 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png";7337 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro");7338 string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css";7339 if (useFontAwesomePro)7340 {7341 fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css";7342 }73437344 //Favicon7345 <link href="@favicon" rel="icon" type="image/png">73467347 //Base (Default, wireframe) styles7348 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css">73497350 //Rapido Css from Website Settings7351 <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css">73527353 //Ignite Css (Custom site specific styles)7354 const string folderName = "ignite";7355 var minify = Model.Area.Item.GetItem("Rizzo").GetBoolean("MinifyCss");7356 var variablesFile = "/Files/Templates/Designs/Rapido/css/rapido/_variables_" + Model.Area.ID + ".auto.less";7357 var igniteBundle = Dna.Optimizer.Renderer.RenderStyles($"/Files/Templates/Designs/Rapido/css/{folderName}", $"-{folderName}-styles", new [] {variablesFile}, new[] { $"{folderName}.css", $"{folderName}.min.css" }, minify, false, false);7358 <link id="igniteCss" type="text/css" rel="stylesheet" href="@igniteBundle" />73597360 //Font awesome7361 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css">73627363 //Flag icon7364 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css">73657366 //Google fonts7367 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)));73687369 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet">73707371 PushPromise(favicon);7372 PushPromise(fontAwesomeCssLink);7373 PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css");7374 PushPromise(autoCssLink);7375 PushPromise(igniteBundle);7376 PushPromise("/Files/Images/placeholder.gif");7377 PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css");7378 }73797380 @helper RenderMasterManifest() {7381 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")))7382 {7383 <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json">7384 PushPromise("/Files/Templates/Designs/Rapido/manifest.json");7385 }7386 }73877388 @helper RenderMasterBody() {7389 List<Block> subBlocks = this.masterPage.GetBlockListById("Body").OrderBy(item => item.SortId).ToList();7390 var designLayout = Model.PropertyItem.GetItem("CustomSettings") != null ? Model.PropertyItem.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.PropertyItem.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : "";7391 var designLayoutAttribute = "";7392 if (designLayout.IsNotNullOrEmpty()) {7393 designLayoutAttribute = "class=\"" + designLayout + "\"";7394 }73957396 <body @designLayoutAttribute>7397 @RenderBlockList(subBlocks)7398 </body>7399 }74007401 @helper RenderMasterHeader()7402 {7403 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList();7404 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop");7405 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : "";74067407 <header class="top-container @stickyTop dw-mod" id="Top">7408 @RenderBlockList(subBlocks)7409 </header>7410 }74117412 @helper RenderMain()7413 {7414 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList();74157416 <main class="site dw-mod">7417 @RenderBlockList(subBlocks)7418 </main>7419 }74207421 @helper RenderPageContent()7422 {7423 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop");7424 string pagePos = isNavigationStickyMenu ? "js-page-pos" : "";74257426 <div id="Page" class="page @pagePos">7427 <section class="center-container content-container dw-mod" id="content">7428 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>7429743074317432 @using Dynamicweb.Rapido.Blocks.Components.General7433 @using Dynamicweb.Rapido.Blocks74347435 @functions {7436 BlocksPage page = BlocksPage.GetBlockPage("Page");7437 }74387439 @{7440 bool isProductPage = HttpContext.Current.Request.QueryString.Get("ProductID") != null;7441 string backgroundColorClass = Model.PropertyItem.GetList("BackgroundColor") != null && !isProductPage ? "u-" + Model.PropertyItem.GetList("BackgroundColor").SelectedValue + "--bg" : "";7442 string navigationMarkup = "";74437444 Block pageContainer = new Block7445 {7446 Id = "PageContainer",7447 SortId = 10,7448 BlocksList = new List<Block> {7449 new Block {7450 Id = "PageRow",7451 SortId = 20,7452 Design = new Design {7453 RenderType = RenderType.Row7454 }7455 }7456 }7457 };7458 page.Add(pageContainer);74597460 if (Model.PropertyItem.GetList("ShowBreadcrumb") != null && Model.PropertyItem.GetList("ShowBreadcrumb").SelectedValue == "True")7461 {7462 Block breadcrumbNavigation = new Block7463 {7464 Id = "PageBreadcrumbNavigation",7465 SortId = 10,7466 Component = new BreadcrumbNavigation { Id = "breadcrumb", Template = "Breadcrumb.xslt" }7467 };7468 page.Add("PageContainer", breadcrumbNavigation);7469 }74707471 if (Model.PropertyItem.GetList("LeftMenu") != null && Model.PropertyItem.GetList("LeftMenu").SelectedValue == "True" && (Pageview.Page.NavigationSettings == null || !Pageview.Page.NavigationSettings.UseEcomGroups))7472 {7473 navigationMarkup = RenderNavigation(new7474 {7475 id = "leftnav",7476 cssclass = "dwnavigation",7477 startLevel = 2,7478 expandmode = "all",7479 endlevel = 5,7480 template = "LeftNavigation.xslt"7481 });74827483 if (!string.IsNullOrEmpty(navigationMarkup))7484 {7485 Block leftNavigation = new Block7486 {7487 Id = "PageLeftNavigation",7488 SortId = 10,7489 Component = new LeftNavigation { Id = "leftnav", CssClass = "dwnavigation", StartLevel = 2, EndLevel = 5, Expandmode = "all", Template = "LeftNavigation.xslt" },7490 Design = new Design7491 {7492 RenderType = RenderType.Column,7493 Size = "3"7494 }7495 };7496 page.Add("PageRow", leftNavigation);7497 }7498 }74997500 string contentColumnSize = !string.IsNullOrEmpty(navigationMarkup) ? "9" : "12";75017502 Block pageContent = new Block7503 {7504 Id = "PageContent",7505 SortId = 20,7506 Design = new Design7507 {7508 RenderType = RenderType.Column,7509 Size = contentColumnSize,7510 CssClass = "grid__col--bleed"7511 },7512 BlocksList = new List<Block> {7513 new Block {7514 Id = "PageContentRow",7515 SortId = 10,7516 Component = new Text { Content = @Model.Placeholder("dwcontent", "content", "default:true;sort:1") },7517 Design = new Design {7518 RenderType = RenderType.Row7519 }7520 }7521 }7522 };7523 page.Add("PageRow", pageContent);7524 }75257526 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@7527 @RenderBlockList(page.BlocksRoot.BlocksList)752875297530 @* Very small hack to make it cleanly, and easily possible to change the background color on a single page *@7531 @if (backgroundColorClass != "")7532 {7533 <script>7534 document.getElementById("Page").classList.add("@backgroundColorClass");7535 </script>7536 }7537 </section>7538 </div>7539 }7540 </html>75417542