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_b93c5daf9c844d3e87c6c5fbf09b10fe.<RenderMasterMetadata>b__224_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\norskstaal.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 8947
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_b93c5daf9c844d3e87c6c5fbf09b10fe.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\norskstaal.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 246
   at CompiledRazorTemplates.Dynamic.RazorEngine_b93c5daf9c844d3e87c6c5fbf09b10fe.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\norskstaal.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_b93c5daf9c844d3e87c6c5fbf09b10fe.<RenderMasterHead>b__223_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\norskstaal.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 8892
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_b93c5daf9c844d3e87c6c5fbf09b10fe.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\norskstaal.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 246
   at CompiledRazorTemplates.Dynamic.RazorEngine_b93c5daf9c844d3e87c6c5fbf09b10fe.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\norskstaal.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_b93c5daf9c844d3e87c6c5fbf09b10fe.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\norskstaal.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 279
   at CompiledRazorTemplates.Dynamic.RazorEngine_b93c5daf9c844d3e87c6c5fbf09b10fe.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\norskstaal.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_b93c5daf9c844d3e87c6c5fbf09b10fe.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\norskstaal.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 8882
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()
  1     @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
  2     
  3     @using System.Web;
  4     @using Dynamicweb.Frontend
  5     @using Dynamicweb.Frontend.Devices
  6     @using Dynamicweb.Extensibility
  7     @using Dynamicweb.Content
  8     @using Dynamicweb.Security
  9     @using Dynamicweb.Core
 10     @using System
 11     @using System.Web
 12     @using System.IO
 13     @using Dynamicweb.Rapido.Blocks
 14     @using System.Net
 15     
 16     
 17     @functions {
 18     	BlocksPage masterPage = BlocksPage.GetBlockPage("Master");
 19     
 20     	string getFontFamily(params string[] items)
 21     	{
 22     		var itemParent = Pageview.AreaSettings;
 23     		foreach (var item in items)
 24     		{
 25     			itemParent = itemParent.GetItem(item);
 26     			if (itemParent == null)
 27     			{
 28     				return null;
 29     			}
 30     		}
 31     
 32     		var googleFont = itemParent.GetGoogleFont("FontFamily");
 33     		if (googleFont == null)
 34     		{
 35     			return null;
 36     		}
 37     		return googleFont.Family.Replace(" ", "+");
 38     	}
 39     }
 40     
 41     @{
 42         Block root = new Block
 43         {
 44             Id = "Root",
 45             SortId = 10,
 46             BlocksList = new List<Block>
 47             {
 48                 new Block {
 49                     Id = "Head",
 50                     SortId = 10,
 51                     SkipRenderBlocksList = true,
 52                     Template = RenderMasterHead(),
 53                     BlocksList = new List<Block>
 54                     {
 55                         new Block {
 56                             Id = "HeadMetadata",
 57                             SortId = 10,
 58                             Template = RenderMasterMetadata(),
 59                         },
 60                         new Block {
 61                             Id = "HeadCss",
 62                             SortId = 20,
 63                             Template = RenderMasterCss(),
 64                         },
 65                         new Block {
 66                             Id = "HeadManifest",
 67                             SortId = 30,
 68                             Template = RenderMasterManifest(),
 69                         }
 70                     }
 71                 },
 72                 new Block {
 73                     Id = "Body",
 74                     SortId = 20,
 75                     SkipRenderBlocksList = true,
 76                     Template = RenderMasterBody(),
 77                     BlocksList = new List<Block>
 78                     {
 79                         new Block()
 80                         {
 81                             Id = "Master",
 82                             SortId = 10,
 83                             BlocksList = new List<Block> {
 84                                 new Block {
 85                                     Id = "MasterTopSnippets",
 86                                     SortId = 10
 87                                 },
 88                                 new Block {
 89                                     Id = "MasterMain",
 90                                     SortId = 20,
 91                                     Template = RenderMain(),
 92                                     SkipRenderBlocksList = true,
 93                                     BlocksList = new List<Block> {
 94                                         new Block {
 95                                             Id = "MasterHeader",
 96                                             SortId = 10,
 97                                             Template = RenderMasterHeader(),
 98                                             SkipRenderBlocksList = true
 99                                         },
100                                         new Block {
101                                             Id = "MasterPageContent",
102                                             SortId = 20,
103                                             Template = RenderPageContent()
104                                         }
105                                     }
106                                 },
107                                 new Block {
108                                     Id = "MasterFooter",
109                                     SortId = 30
110                                 },
111                                 new Block {
112                                     Id = "MasterReferences",
113                                     SortId = 40
114                                 },
115                                 new Block {
116                                     Id = "MasterBottomSnippets",
117                                     SortId = 50
118                                 }
119                             }
120                         }
121                     }
122                 }
123             }
124         };
125     
126         masterPage.Add(root);
127     }
128     
129     @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@
130     @using System.Text.RegularExpressions
131     @using System.Collections.Generic
132     @using System.Reflection
133     @using System.Web
134     @using System.Web.UI.HtmlControls
135     @using Dynamicweb.Rapido.Blocks.Components
136     @using Dynamicweb.Rapido.Blocks.Components.Articles
137     @using Dynamicweb.Rapido.Blocks.Components.Documentation
138     @using Dynamicweb.Rapido.Blocks
139     
140     
141     @*--- START: Base block renderers ---*@
142     
143     @helper RenderBlockList(List<Block> blocks)
144     {
145         bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false;
146         blocks = blocks.OrderBy(item => item.SortId).ToList();
147     
148         foreach (Block item in blocks)
149         {
150             if (debug) {
151             <!-- Block START: @item.Id -->
152             }
153     
154             if (item.Design == null)
155             {
156                 @RenderBlock(item)
157             }
158             else if (item.Design.RenderType == RenderType.None) {
159                 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : "";
160     
161                 <div class="@cssClass dw-mod">
162                    @RenderBlock(item)
163                 </div>
164             }
165             else if (item.Design.RenderType != RenderType.Hide)
166             {
167                 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : "";
168     
169                 if (!item.SkipRenderBlocksList) {
170                     if (item.Design.RenderType == RenderType.Row)
171                     {
172                         <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id">
173                             @RenderBlock(item)
174                         </div>
175                     }
176     
177                     if (item.Design.RenderType == RenderType.Column)
178                     {
179                         string hidePadding = item.Design.HidePadding ? "u-no-padding" : "";
180                         string size = item.Design.Size ?? "12";
181                         size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size;
182     
183                         <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">
184                             @RenderBlock(item)
185                         </div>
186                     }
187     
188                     if (item.Design.RenderType == RenderType.Table)
189                     {
190                         <table class="table @cssClass dw-mod" id="Block__@item.Id">
191                             @RenderBlock(item)
192                         </table>
193                     }
194     
195                     if (item.Design.RenderType == RenderType.TableRow)
196                     {
197                         <tr class="@cssClass dw-mod" id="Block__@item.Id">
198                             @RenderBlock(item)
199                         </tr>
200                     }
201     
202                     if (item.Design.RenderType == RenderType.TableColumn)
203                     {
204                         <td class="@cssClass dw-mod" id="Block__@item.Id">
205                             @RenderBlock(item)
206                         </td>
207                     }
208     
209                     if (item.Design.RenderType == RenderType.CardHeader)
210                     {
211                         <div class="card-header @cssClass dw-mod">
212                             @RenderBlock(item)
213                         </div>
214                     }
215     
216                     if (item.Design.RenderType == RenderType.CardBody)
217                     {
218                         <div class="card @cssClass dw-mod">
219                             @RenderBlock(item)
220                         </div>
221                     }
222     
223                     if (item.Design.RenderType == RenderType.CardFooter)
224                     {
225                         <div class="card-footer @cssClass dw-mod">
226                             @RenderBlock(item)
227                         </div>
228                     }
229                 }
230                 else 
231                 {
232                     @RenderBlock(item)
233                 }
234             }
235     
236             if (debug) {
237             <!-- Block END: @item.Id -->
238             }
239         }
240     }
241     
242     @helper RenderBlock(Block item)
243     {
244         bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false;
245     
246         if (item.Template != null)
247         {
248             @BlocksPage.RenderTemplate(item.Template)
249         }
250     
251         if (item.Component != null)
252         {
253             string customSufix = "Custom";
254             string methodName = item.Component.HelperName;
255     
256             ComponentBase[] methodParameters = new ComponentBase[1]; 
257             methodParameters[0] = item.Component; 
258             Type methodType = this.GetType();
259     
260             MethodInfo customMethod = methodType.GetMethod(methodName + customSufix);
261             MethodInfo generalMethod = methodType.GetMethod(methodName);
262     
263             try {
264                 if (debug) {
265                 <!-- Component: @methodName.Replace("Render", "") -->
266                 }
267                 @customMethod.Invoke(this, methodParameters).ToString();
268             } catch {
269                 try {
270                     @generalMethod.Invoke(this, methodParameters).ToString();
271                 } catch(Exception ex) {
272                     throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked", ex);
273                 }
274             }
275         }
276     
277         if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList)
278         {
279             @RenderBlockList(item.BlocksList)
280         }
281     }
282     
283     @*--- END: Base block renderers ---*@
284     
285     
286     @* Include the components *@
287     @using Dynamicweb.Rapido.Blocks.Components
288     @using Dynamicweb.Rapido.Blocks.Components.General
289     @using Dynamicweb.Rapido.Blocks
290     @using System.IO
291     
292     @* Required *@
293     @using Dynamicweb.Rapido.Blocks.Components
294     @using Dynamicweb.Rapido.Blocks.Components.General
295     @using Dynamicweb.Rapido.Blocks
296     
297     
298     @helper Render(ComponentBase component)
299     {
300         if (component != null)
301         {
302             @component.Render(this)
303         }
304     }
305     
306     
307     @* Components *@
308     @using System.Reflection
309     @using Dynamicweb.Rapido.Blocks.Components.General
310     
311     
312     @* Component *@
313     
314     @helper RenderIcon(Icon settings)
315     {
316         if (settings != null)
317         {
318             string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : "";
319     
320             if (settings.Name != null)
321             {
322                 if (string.IsNullOrEmpty(settings.Label))
323                 {
324                     <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i>
325                 }
326                 else
327                 {
328                     if (settings.LabelPosition == IconLabelPosition.Before)
329                     {
330                         <span>@settings.Label <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i></span>
331                     }
332                     else
333                     {
334                         <span><i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> @settings.Label</span>
335                     }
336                 }
337             }
338             else if (!string.IsNullOrEmpty(settings.Label))
339             {
340                 @settings.Label
341             }
342         }
343     }
344     @using System.Reflection
345     @using Dynamicweb.Rapido.Blocks.Components.General
346     @using Dynamicweb.Rapido.Blocks.Components
347     @using Dynamicweb.Core
348     
349     @* Component *@
350     
351     @helper RenderButton(Button settings)
352     {
353         if (settings != null && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null))
354         {
355             Dictionary<string, string> attributes = new Dictionary<string, string>();
356             List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>();
357             if (settings.Disabled) {
358                 attributes.Add("disabled", "true");
359                 classList.Add("disabled");
360             }
361             
362             if (!string.IsNullOrEmpty(settings.ConfirmText) || !string.IsNullOrEmpty(settings.ConfirmTitle))
363             {
364                 settings.Id = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N");
365                 @RenderConfirmDialog(settings);
366             settings.OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = true";
367         }
368     
369         if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
370         if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
371         if (!string.IsNullOrEmpty(settings.AltText))
372         {
373             attributes.Add("title", settings.AltText);
374         }
375         else if (!string.IsNullOrEmpty(settings.Title))
376         {
377             attributes.Add("title", settings.Title);
378         }
379     
380         var onClickEvents = new List<string>();
381         if (!string.IsNullOrEmpty(settings.OnClick))
382         {
383             onClickEvents.Add(settings.OnClick);
384         }
385         if (!string.IsNullOrEmpty(settings.Href))
386         {
387             onClickEvents.Add("location.href='" + settings.Href + "'");
388         }
389         if (onClickEvents.Count > 0)
390         {
391             attributes.Add("onClick", string.Join(";", onClickEvents));
392         }
393     
394         if (settings.ButtonLayout != ButtonLayout.None)
395         {
396             classList.Add("btn");
397             string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower();
398             if (btnLayout == "linkclean")
399             {
400                 btnLayout = "link-clean"; //fix
401             }
402             classList.Add("btn--" + btnLayout);
403         }
404     
405         if (settings.Icon == null)
406         {
407             settings.Icon = new Icon();
408         }
409         settings.Icon.Label = settings.Title;
410     
411         attributes.Add("type", Enum.GetName(typeof(ButtonType), settings.ButtonType).ToLower());
412     
413             <button class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</button>
414         }
415     }
416     
417     @helper RenderConfirmDialog(Button settings)
418     {
419         Modal confirmDialog = new Modal {
420             Id = settings.Id,
421             Width = ModalWidth.Sm,
422             Heading = new Heading
423             {
424                 Level = 2,
425                 Title = settings.ConfirmTitle
426             },
427             BodyText = settings.ConfirmText
428         };
429     
430         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 });
432     
433         @Render(confirmDialog)
434     }
435     @using Dynamicweb.Rapido.Blocks.Components.General
436     @using Dynamicweb.Rapido.Blocks.Components
437     @using Dynamicweb.Core
438     
439     @helper RenderDashboard(Dashboard settings)
440     {
441         var widgets = settings.GetWidgets();
442     
443         if (!string.IsNullOrEmpty(settings.WidgetsBaseBackgroundColor))
444         {
445             //set bg color for them
446     
447             System.Drawing.Color color = System.Drawing.ColorTranslator.FromHtml(settings.WidgetsBaseBackgroundColor);
448             int r = Convert.ToInt16(color.R);
449             int g = Convert.ToInt16(color.G);
450             int b = Convert.ToInt16(color.B);
451     
452             var count = widgets.Length;
453             var max = Math.Max(r, Math.Max(g, b));
454             double step = 255.0 / (max * count);
455             var i = 0;
456             foreach (var widget in widgets)
457             {
458                 i++;
459     
460                 var shade = "rgb(" + Converter.ToString(r * step * i).Replace(",", ".") + ", " + Converter.ToString(g * step * i).Replace(",", ".") + ", " + Converter.ToString(b * step * i).Replace(",", ".") + ")";
461                 widget.BackgroundColor = shade;
462             }
463         }
464     
465         <div class="dashboard @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
466             @foreach (var widget in widgets)
467             {
468                 <div class="dashboard__widget">
469                     @Render(widget)
470                 </div>
471             }
472         </div>
473     }
474     @using Dynamicweb.Rapido.Blocks.Components.General
475     @using Dynamicweb.Rapido.Blocks.Components
476     
477     @helper RenderDashboardWidgetLink(DashboardWidgetLink settings)
478     {
479         if (!string.IsNullOrEmpty(settings.Link))
480         {
481             var backgroundStyles = "";
482             if (!string.IsNullOrEmpty(settings.BackgroundColor))
483             {
484                 backgroundStyles = "style=\"background-color:" + settings.BackgroundColor + "\"";
485             }
486     
487             <a href="@settings.Link" class="widget widget--link @settings.CssClass dw-mod" @backgroundStyles title="@settings.Title" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
488                 <div class="u-center-middle u-color-light">
489                     @if (settings.Icon != null)
490                     {
491                         settings.Icon.CssClass += "widget__icon";
492                         @Render(settings.Icon)
493                     }
494                     <div class="widget__title">@settings.Title</div>
495                 </div>
496             </a>
497         }
498     }
499     @using Dynamicweb.Rapido.Blocks.Components.General
500     @using Dynamicweb.Rapido.Blocks.Components
501     
502     @helper RenderDashboardWidgetCounter(DashboardWidgetCounter settings)
503     {
504         var backgroundStyles = "";
505         if (!string.IsNullOrEmpty(settings.BackgroundColor))
506         {
507             backgroundStyles = "style='background-color:" + settings.BackgroundColor + "'";
508         }
509     
510         <div class="widget @settings.CssClass dw-mod" @backgroundStyles @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
511             <div class="u-center-middle u-color-light">
512                 @if (settings.Icon != null)
513                 {
514                     settings.Icon.CssClass += "widget__icon";
515                     @Render(settings.Icon)
516                 }
517                 <div class="widget__counter">@settings.Count</div>
518                 <div class="widget__title">@settings.Title</div>
519             </div>
520         </div>
521     }
522     @using System.Reflection
523     @using Dynamicweb.Rapido.Blocks.Components.General
524     @using Dynamicweb.Rapido.Blocks.Components
525     @using Dynamicweb.Core
526     
527     @* Component *@
528     
529     @helper RenderLink(Link settings)
530     {
531         if (settings != null && !string.IsNullOrEmpty(settings.Href) && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null))
532         {
533             Dictionary<string, string> attributes = new Dictionary<string, string>();
534             List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>();
535             if (settings.Disabled) 
536             {
537                 attributes.Add("disabled", "true");
538                 classList.Add("disabled");
539             }
540             
541             if (!string.IsNullOrEmpty(settings.AltText)) 
542             { 
543                 attributes.Add("title", settings.AltText); 
544             } 
545             else if (!string.IsNullOrEmpty(settings.Title)) 
546             { 
547                 attributes.Add("title", settings.Title); 
548             }
549     
550             if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
551             if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
552             if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onClick", settings.OnClick); }
553             attributes.Add("href", settings.Href);
554     
555             if (settings.ButtonLayout != ButtonLayout.None) 
556             {
557                 classList.Add("btn");
558                 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower();
559                 if (btnLayout == "linkclean") 
560                 {
561                     btnLayout = "link-clean"; //fix
562                 }
563                 classList.Add("btn--" + btnLayout);
564             }
565             
566             if (settings.Icon == null)
567             {
568                 settings.Icon = new Icon();
569             }
570             settings.Icon.Label = settings.Title;
571             
572             if (settings.Target == LinkTargetType.Blank && settings.Rel == LinkRelType.None) 
573             {
574                 settings.Rel = LinkRelType.Noopener;
575             }
576             if (settings.Target != LinkTargetType.None) 
577             { 
578                 attributes.Add("target", "_" + Enum.GetName(typeof(LinkTargetType), settings.Target).ToLower()); 
579             }
580             if (settings.Download) 
581             { 
582                 attributes.Add("download", "true"); 
583             }
584             if (settings.Rel != LinkRelType.None) 
585             { 
586                 attributes.Add("rel", Enum.GetName(typeof(LinkRelType), settings.Rel).ToLower()); 
587             }
588     
589             <a class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</a>
590         }
591     }
592     @using System.Reflection
593     @using Dynamicweb.Rapido.Blocks.Components
594     @using Dynamicweb.Rapido.Blocks.Components.General
595     @using Dynamicweb.Rapido.Blocks
596     
597     
598     @* Component *@
599     
600     @helper RenderRating(Rating settings)
601     {
602         if (settings.Score > 0)
603         {
604             int rating = settings.Score;
605             string iconType = "fa-star";
606     
607             switch (settings.Type.ToString()) {
608                 case "Stars":
609                     iconType = "fa-star";
610                     break;
611                 case "Hearts":
612                     iconType = "fa-heart";
613                     break;
614                 case "Lemons":
615                     iconType = "fa-lemon";
616                     break;
617                 case "Bombs":
618                     iconType = "fa-bomb";
619                     break;
620             }
621     
622             <div class="u-ta-right">
623                 @for (int i = 0; i < settings.OutOf; i++)
624                 {
625                     <i class="@(rating > i ? "fas" : "far") @iconType"></i>
626                 }
627             </div>
628         }
629     }
630     @using System.Reflection
631     @using Dynamicweb.Rapido.Blocks.Components.General
632     @using Dynamicweb.Rapido.Blocks.Components
633     
634     
635     @* Component *@
636     
637     @helper RenderSelectFieldOption(SelectFieldOption settings)
638     {
639         Dictionary<string, string> attributes = new Dictionary<string, string>();
640         if (settings.Checked) { attributes.Add("selected", "true"); }
641         if (settings.Disabled) { attributes.Add("disabled", "true"); }
642         if (settings.Value != null) { attributes.Add("value", settings.Value); }
643         if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
644     
645         <option @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Label</option>
646     }
647     @using System.Reflection
648     @using Dynamicweb.Rapido.Blocks.Components.General
649     @using Dynamicweb.Rapido.Blocks.Components
650     
651     
652     @* Component *@
653     
654     @helper RenderNavigation(Navigation settings) {
655         @RenderNavigation(new
656         {
657             id = settings.Id,
658             cssclass = settings.CssClass,
659             startLevel = settings.StartLevel,
660             endlevel = settings.EndLevel,
661             expandmode = settings.Expandmode,
662             sitemapmode = settings.SitemapMode,
663             template = settings.Template
664         })
665     }
666     @using Dynamicweb.Rapido.Blocks.Components.General
667     @using Dynamicweb.Rapido.Blocks.Components
668     
669     
670     @* Component *@
671     
672     @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) {
673         settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id;
674         settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template;
675         settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel;
676         settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel;
677         settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode;
678         settings.SitemapMode = false;
679     
680         @RenderNavigation(settings)         
681     }
682     @using Dynamicweb.Rapido.Blocks.Components.General
683     @using Dynamicweb.Rapido.Blocks.Components
684     
685     
686     @* Component *@
687     
688     @helper RenderLeftNavigation(LeftNavigation settings) {
689         settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id;
690         settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template;
691         settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel;
692         settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel;
693         settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode;
694     
695         <div class="grid__cell">
696             @RenderNavigation(settings) 
697         </div>       
698     }
699     @using System.Reflection
700     @using Dynamicweb.Rapido.Blocks.Components.General
701     @using Dynamicweb.Core
702     
703     @* Component *@
704     
705     @helper RenderHeading(Heading settings)
706     {
707         if (settings != null && !string.IsNullOrEmpty(settings.Title))
708         {
709             string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : "";
710             string tagName = settings.Level != 0 ? "h" + settings.Level.ToString() : "div";
711     
712             @("<" + tagName + " class=\"" + settings.CssClass + " dw-mod\" " + color + ">")
713                 if (!string.IsNullOrEmpty(settings.Link))
714                 {
715                     @Render(new Link { Href = settings.Link, Icon = settings.Icon, Title = settings.Title, ButtonLayout = ButtonLayout.None })
716                 } 
717                 else
718                 {
719                     if (settings.Icon == null)
720                     {
721                         settings.Icon = new Icon();
722                     }
723                     settings.Icon.Label = settings.Title;
724                     @Render(settings.Icon)
725                 }
726             @("</" + tagName + ">");
727         }
728     }
729     @using Dynamicweb.Rapido.Blocks.Components
730     @using Dynamicweb.Rapido.Blocks.Components.General
731     @using Dynamicweb.Rapido.Blocks
732     
733     
734     @* Component *@
735     
736     @helper RenderImage(Image settings)
737     {
738         if (settings.FilterPrimary != ImageFilter.None || settings.FilterSecondary != ImageFilter.None)
739         {
740             Dictionary<string, string> optionalAttributes = new Dictionary<string, string>();
741             if (!string.IsNullOrEmpty(settings.FilterColor)) { optionalAttributes.Add("style", "background-color: " + settings.FilterColor); }
742             
743             if (settings.Caption != null)
744             {
745                 @:<div>
746             }
747     
748             var primaryFilterClass = settings.FilterPrimary.ToString().ToLower();
749             var secondaryFilterClass = settings.FilterSecondary.ToString().ToLower();
750     
751             <div class="image-filter image-filter--@primaryFilterClass u-position-relative dw-mod" @ComponentMethods.AddAttributes(optionalAttributes)>
752                 <div class="image-filter image-filter--@secondaryFilterClass dw-mod">
753                     @if (settings.Link != null)
754                     {
755                         <a href="@settings.Link">
756                             @RenderTheImage(settings)
757                         </a>
758                     }
759                     else
760                     {
761                         @RenderTheImage(settings)
762                     }
763                 </div>
764             </div>
765     
766             if (settings.Caption != null)
767             {
768                 <span class="image-caption dw-mod">@settings.Caption</span>
769                 @:</div>
770             }
771         }
772         else 
773         {
774             if (settings.Caption != null)
775             {
776                 @:<div>
777             }
778             if (!string.IsNullOrEmpty(settings.Link))
779             {
780                 <a href="@settings.Link">
781                     @RenderTheImage(settings)
782                 </a>
783             }
784             else
785             {
786                 @RenderTheImage(settings)
787             }
788     
789             if (settings.Caption != null)
790             {
791                 <span class="image-caption dw-mod">@settings.Caption</span>
792                 @:</div>
793             }
794         }
795     }
796     
797     @helper RenderTheImage(Image settings)
798     {
799         if (settings != null)
800         {
801             string placeholderImage = "/Files/Images/placeholder.gif";
802             string imageEngine = "/Admin/Public/GetImage.ashx?";
803     
804             string imageStyle = "";
805     
806             switch (settings.Style)
807             {
808                 case ImageStyle.Ball:
809                     imageStyle = "grid__cell-img--ball";
810                     break;
811             }
812     
813             if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle)
814             {
815                 if (settings.ImageDefault != null)
816                 {
817                     settings.ImageDefault.Height = settings.ImageDefault.Width;
818                 }
819                 if (settings.ImageMedium != null)
820                 {
821                     settings.ImageMedium.Height = settings.ImageMedium.Width;
822                 }
823                 if (settings.ImageSmall != null)
824                 {
825                     settings.ImageSmall.Height = settings.ImageSmall.Width;
826                 }
827             }
828     
829             string defaultImage = imageEngine;
830             string imageSmall = "";
831             string imageMedium = "";
832     
833             if (settings.DisableImageEngine) 
834             {
835                 defaultImage = settings.Path;
836             } 
837             else 
838             {
839                 if (settings.ImageDefault != null)
840                 {
841                     defaultImage += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageDefault);
842     
843                     if (settings.Path.GetType() != typeof(string))
844                     {
845                         defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
846                         defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
847                     }
848                     else
849                     {
850                         defaultImage += settings.Path != null ? "Image=" + settings.Path : "";
851                     }
852                 }
853     
854                 if (settings.ImageSmall != null)
855                 {
856                     imageSmall = "data-src-small=\"" + imageEngine;
857                     imageSmall += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageSmall);
858     
859                     if (settings.Path.GetType() != typeof(string))
860                     {
861                         imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
862                         imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
863                     }
864                     else
865                     {
866                         imageSmall += settings.Path != null ? "Image=" + settings.Path : "";
867                     }
868     
869                     imageSmall += "\"";
870                 }
871     
872                 if (settings.ImageMedium != null)
873                 {
874                     imageMedium = "data-src-medium=\"" + imageEngine;
875                     imageMedium += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageMedium);
876     
877                     if (settings.Path.GetType() != typeof(string))
878                     {
879                         imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
880                         imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
881                     }
882                     else
883                     {
884                         imageMedium += settings.Path != null ? "Image=" + settings.Path : "";
885                     }
886     
887                     imageMedium += "\"";
888                 }
889             }
890     
891             Dictionary<string, string> optionalAttributes = new Dictionary<string, string>();
892             if (!string.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); }
893             if (!string.IsNullOrEmpty(settings.Title)) 
894             { 
895                 optionalAttributes.Add("alt", settings.Title); 
896                 optionalAttributes.Add("title", settings.Title); 
897             }
898     
899             if (settings.DisableLazyLoad) 
900             {
901                 <img id="@settings.Id" class="@imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) />
902             } 
903             else 
904             {
905                 <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) />
906             }
907         }
908     }
909     @using System.Reflection
910     @using Dynamicweb.Rapido.Blocks.Components.General
911     @using Dynamicweb.Rapido.Blocks.Components
912     
913     @* Component *@
914     
915     @helper RenderFileField(FileField settings)
916     {
917         var attributes = new Dictionary<string, string>();
918         if (string.IsNullOrEmpty(settings.Id)) 
919         {
920             settings.Id = Guid.NewGuid().ToString("N");
921         }
922         
923         if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
924         if (settings.Disabled) { attributes.Add("disabled", "true"); }
925         if (settings.Required) { attributes.Add("required", "true"); }
926         if (settings.Multiple) { attributes.Add("multiple", "true"); }
927         if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
928         if (string.IsNullOrEmpty(settings.ChooseFileText)) 
929         { 
930             settings.ChooseFileText = Translate("Choose file");
931         }
932         if (string.IsNullOrEmpty(settings.NoFilesChosenText)) 
933         { 
934             settings.NoFilesChosenText = Translate("No files chosen...");
935         }
936         if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
937     
938         string setValueToFakeInput = "FileUpload.setValueToFakeInput(this)";
939         attributes.Add("onchange", setValueToFakeInput + (!string.IsNullOrEmpty(settings.OnChange) ? settings.OnChange : ""));
940     
941         attributes.Add("type", "file");
942         if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); }
943         settings.CssClass = "u-full-width " + settings.CssClass;
944     
945         var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
946     
947         <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod">
948             @if (!string.IsNullOrEmpty(settings.Label))
949             {
950                 <label for="@settings.Id">@settings.Label</label>
951             }
952             @if (!string.IsNullOrEmpty(settings.HelpText))
953             {
954                 <small class="form__help-text">@settings.HelpText</small>
955             }
956     
957             <div class="form__field-combi file-input u-no-margin dw-mod">
958                 <input @ComponentMethods.AddAttributes(resultAttributes) class="file-input__real-input" data-no-files-text="@settings.NoFilesChosenText" data-many-files-text="@Translate("files")" />
959                 <label for="@settings.Id" class="file-input__btn btn--secondary btn dw-mod">@settings.ChooseFileText</label>
960                 <label for="@settings.Id" class="@settings.CssClass file-input__fake-input js-fake-input dw-mod">@settings.NoFilesChosenText</label>
961                 @if (settings.UploadButton != null)
962                 {
963                     settings.UploadButton.CssClass += " btn--condensed u-no-margin";
964                     @Render(settings.UploadButton)
965                 }
966             </div>
967             @Render(new NotificationMessage { Message = settings.ErrorMessage })
968         </div>
969     }
970     @using System.Reflection
971     @using Dynamicweb.Rapido.Blocks.Components.General
972     @using Dynamicweb.Rapido.Blocks.Components
973     @using Dynamicweb.Core
974     @using System.Linq
975     
976     @* Component *@
977     
978     @helper RenderDateTimeField(DateTimeField settings)
979     {
980         if (string.IsNullOrEmpty(settings.Id)) 
981         {
982             settings.Id = Guid.NewGuid().ToString("N");
983         }
984     
985         var textField = new TextField {
986             Name = settings.Name,
987             Id = settings.Id,
988             Label = settings.Label,
989             HelpText = settings.HelpText,
990             Value = settings.Value,
991             Disabled = settings.Disabled,
992             Required = settings.Required,
993             ErrorMessage = settings.ErrorMessage,
994             CssClass = settings.CssClass,
995             WrapperCssClass = settings.WrapperCssClass,
996             OnChange = settings.OnChange,
997             OnClick = settings.OnClick,
998             ExtraAttributes = settings.ExtraAttributes,
999             //
1000             Placeholder = settings.Placeholder
1001         };
1002     
1003         @Render(textField)
1004     
1005         List<string> jsAttributes = new List<string>();
1006     
1007         jsAttributes.Add("mode: '" + Enum.GetName(typeof(DateTimeFieldMode), settings.Mode).ToLower() + "'");
1008     
1009         if (!string.IsNullOrEmpty(settings.DateFormat))
1010         {
1011             jsAttributes.Add("dateFormat: '" + settings.DateFormat + "'");
1012         }
1013         if (!string.IsNullOrEmpty(settings.MinDate))
1014         {
1015             jsAttributes.Add("minDate: '" + settings.MinDate + "'");
1016         }
1017         if (!string.IsNullOrEmpty(settings.MaxDate))
1018         {
1019             jsAttributes.Add("maxDate: '" + settings.MaxDate + "'");
1020         }
1021         if (settings.IsInline)
1022         {
1023             jsAttributes.Add("inline: " + Converter.ToString(settings.IsInline).ToLower());
1024         }
1025         if (settings.EnableTime)
1026         {
1027             jsAttributes.Add("enableTime: " + Converter.ToString(settings.EnableTime).ToLower());
1028         }
1029         if (settings.EnableWeekNumbers)
1030         {
1031             jsAttributes.Add("weekNumbers: " + Converter.ToString(settings.EnableWeekNumbers).ToLower());
1032         }
1033         
1034         jsAttributes.AddRange(settings.GetFlatPickrOptions().Select(x => x.Key + ": " + x.Value));
1035     
1036         <script>
1037             document.addEventListener("DOMContentLoaded", function () {
1038                 flatpickr("#@textField.Id", {
1039                     @string.Join(",", jsAttributes)
1040                 });
1041             });
1042         </script>
1043     }
1044     @using System.Reflection
1045     @using Dynamicweb.Rapido.Blocks.Components.General
1046     @using Dynamicweb.Rapido.Blocks.Components
1047     
1048     @* Component *@
1049     
1050     @helper RenderTextField(TextField settings)
1051     {
1052         var attributes = new Dictionary<string, string>();
1053         if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 
1054         {
1055             settings.Id = Guid.NewGuid().ToString("N");
1056         }
1057     
1058         /*base settings*/
1059         if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1060         if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1061         if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1062         if (settings.Disabled) { attributes.Add("disabled", "true"); }
1063         if (settings.Required) { attributes.Add("required", "true"); }
1064         if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1065         /*end*/
1066         
1067         if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
1068         if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
1069         if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
1070         if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
1071         if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); }
1072         if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); }
1073         attributes.Add("type", Enum.GetName(typeof(TextFieldType), settings.Type).ToLower());
1074         if (settings.Type == TextFieldType.Password) { attributes.Add("autocomplete", "off"); };
1075         if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); }
1076         settings.CssClass = "u-full-width " + settings.CssClass;
1077     
1078         var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1079     
1080         string noMargin = "u-no-margin";
1081         if (!settings.ReadOnly) {
1082             noMargin = "";
1083         }
1084     
1085         <div class="form__field-group u-full-width @noMargin @settings.WrapperCssClass dw-mod">
1086             @if (!string.IsNullOrEmpty(settings.Label))
1087             {
1088                 <label for="@settings.Id">@settings.Label</label>
1089             }
1090             @if (!string.IsNullOrEmpty(settings.HelpText))
1091             {
1092                 <small class="form__help-text">@settings.HelpText</small>
1093             }
1094     
1095             @if (settings.ActionButton != null)
1096             {
1097                 settings.ActionButton.CssClass += " btn--condensed u-no-margin";
1098                 <div class="form__field-combi u-no-margin dw-mod">
1099                     <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1100                     @Render(settings.ActionButton)
1101                 </div>
1102             }
1103             else
1104             {
1105                 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1106             }
1107     
1108             @Render(new NotificationMessage { Message = settings.ErrorMessage })
1109         </div>
1110     }
1111     @using System.Reflection
1112     @using Dynamicweb.Rapido.Blocks.Components.General
1113     @using Dynamicweb.Rapido.Blocks.Components
1114     
1115     @* Component *@
1116     
1117     @helper RenderNumberField(NumberField settings)
1118     {
1119         var attributes = new Dictionary<string, string>();
1120         if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 
1121         {
1122             settings.Id = Guid.NewGuid().ToString("N");
1123         }
1124     
1125         /*base settings*/
1126         if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1127         if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1128         if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1129         if (settings.Disabled) { attributes.Add("disabled", "true"); }
1130         if (settings.Required) { attributes.Add("required", "true"); }
1131         if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1132         /*end*/
1133     
1134         if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
1135         if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
1136         if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
1137         if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
1138         if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); }
1139         if (settings.Min != null) { attributes.Add("min", settings.Min.ToString()); }
1140         if (settings.Step != 0) { attributes.Add("step", settings.Step.ToString()); }
1141         if (settings.Value != null && !string.IsNullOrEmpty(settings.Value.ToString())) { attributes.Add("value", settings.Value.ToString()); }
1142         attributes.Add("type", "number");
1143     
1144         var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1145     
1146         <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod">
1147             @if (!string.IsNullOrEmpty(settings.Label))
1148             {
1149                 <label for="@settings.Id">@settings.Label</label>
1150             }
1151             @if (!string.IsNullOrEmpty(settings.HelpText))
1152             {
1153                 <small class="form__help-text">@settings.HelpText</small>
1154             }
1155     
1156             @if (settings.ActionButton != null)
1157             {
1158                 settings.ActionButton.CssClass += " btn--condensed u-no-margin";
1159                 <div class="form__field-combi u-no-margin dw-mod">
1160                     <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1161                     @Render(settings.ActionButton)
1162                 </div>
1163             }
1164             else
1165             {
1166                 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1167             }
1168     
1169             @Render(new NotificationMessage { Message = settings.ErrorMessage })
1170         </div>
1171     }
1172     @using System.Reflection
1173     @using Dynamicweb.Rapido.Blocks.Components.General
1174     @using Dynamicweb.Rapido.Blocks.Components
1175     
1176     
1177     @* Component *@
1178     
1179     @helper RenderTextareaField(TextareaField settings)
1180     {
1181         Dictionary<string, string> attributes = new Dictionary<string, string>();    
1182         string id = settings.Id;
1183         if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(id)) 
1184         {
1185             id = Guid.NewGuid().ToString("N");
1186         }
1187         
1188         if (!string.IsNullOrEmpty(id)) { attributes.Add("id", id); }
1189         if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1190         if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
1191         if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
1192         if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
1193         if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1194         if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); }
1195         if (settings.Disabled) { attributes.Add("disabled", "true"); }
1196         if (settings.Required) { attributes.Add("required", "true"); }
1197         if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
1198         if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); }
1199         if (settings.Rows != 0) { attributes.Add("rows", settings.Rows.ToString()); }
1200         attributes.Add("name", settings.Name);
1201     
1202         <div class="form__field-group @settings.WrapperCssClass dw-mod">
1203             @if (!string.IsNullOrEmpty(settings.Label))
1204             {
1205                 <label for="@id">@settings.Label</label>
1206             }
1207             @if (!string.IsNullOrEmpty(settings.HelpText))
1208             {
1209                 <small class="form__help-text">@settings.HelpText</small>
1210             }
1211     
1212             <textarea class="u-full-width @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Value</textarea>
1213     
1214             @Render(new NotificationMessage { Message = settings.ErrorMessage })
1215         </div>
1216     }
1217     @using System.Reflection
1218     @using Dynamicweb.Rapido.Blocks.Components.General
1219     @using Dynamicweb.Rapido.Blocks.Components
1220     
1221     
1222     @* Component *@
1223     
1224     @helper RenderHiddenField(HiddenField settings) {
1225         var attributes = new Dictionary<string, string>();
1226         attributes.Add("type", "hidden");
1227         if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1228         if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); }
1229         if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1230     
1231         <input @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)/>
1232     }
1233     @using System.Reflection
1234     @using Dynamicweb.Rapido.Blocks.Components.General
1235     @using Dynamicweb.Rapido.Blocks.Components
1236     
1237     @* Component *@
1238     
1239     @helper RenderCheckboxField(CheckboxField settings)
1240     {
1241         var attributes = new Dictionary<string, string>();
1242         if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 
1243         {
1244             settings.Id = Guid.NewGuid().ToString("N");
1245         }
1246         
1247         /*base settings*/
1248         if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1249         if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1250         if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1251         if (settings.Disabled) { attributes.Add("disabled", "true"); }
1252         if (settings.Required) { attributes.Add("required", "true"); }
1253         if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1254         /*end*/
1255         
1256         attributes.Add("type", "checkbox");
1257         if (settings.Checked) { attributes.Add("checked", "true"); }
1258         settings.CssClass = "form__control " + settings.CssClass;
1259         if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); }
1260     
1261         var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1262     
1263         <div class="form__field-group @settings.WrapperCssClass dw-mod">
1264             <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1265             @if (!string.IsNullOrEmpty(settings.Label))
1266             {
1267                 <label for="@settings.Id" class="dw-mod">@settings.Label</label>
1268             }
1269             @if (!string.IsNullOrEmpty(settings.HelpText))
1270             {
1271                 <small class="form__help-text">@settings.HelpText</small>
1272             }
1273             @Render(new NotificationMessage { Message = settings.ErrorMessage })
1274         </div>
1275     }
1276     @using System.Reflection
1277     @using Dynamicweb.Rapido.Blocks.Components.General
1278     @using Dynamicweb.Rapido.Blocks.Components
1279     
1280     
1281     @* Component *@
1282     
1283     @helper RenderCheckboxListField(CheckboxListField settings)
1284     {
1285         <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1286             @if (!string.IsNullOrEmpty(settings.Label))
1287             {
1288                 <label>@settings.Label</label>
1289             }
1290             @if (!string.IsNullOrEmpty(settings.HelpText))
1291             {
1292                 <small class="form__help-text">@settings.HelpText</small>
1293             }
1294     
1295             @foreach (var item in settings.Options)
1296             {
1297                 if (settings.Required)
1298                 {
1299                     item.Required = true;
1300                 }
1301                 if (settings.Disabled)
1302                 {
1303                     item.Disabled = true;
1304                 }
1305                 if (!string.IsNullOrEmpty(settings.Name))
1306                 {
1307                     item.Name = settings.Name;
1308                 }
1309                 if (!string.IsNullOrEmpty(settings.CssClass))
1310                 {
1311                     item.CssClass += settings.CssClass;
1312                 }
1313     
1314                 /* value is not supported */
1315     
1316                 if (!string.IsNullOrEmpty(settings.OnClick))
1317                 {
1318                     item.OnClick += settings.OnClick;
1319                 }
1320                 if (!string.IsNullOrEmpty(settings.OnChange))
1321                 {
1322                     item.OnChange += settings.OnChange;
1323                 }
1324                 @Render(item)
1325             }
1326     
1327             @Render(new NotificationMessage { Message = settings.ErrorMessage })
1328         </div>
1329     }
1330     @using System.Reflection
1331     @using Dynamicweb.Rapido.Blocks.Components.General
1332     @using Dynamicweb.Rapido.Blocks.Components
1333     
1334     
1335     @* Component *@
1336     
1337     @helper RenderSelectField(SelectField settings)
1338     {
1339         if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1340         {
1341             settings.Id = Guid.NewGuid().ToString("N");
1342         }
1343     
1344         <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod">
1345             @if (!string.IsNullOrEmpty(settings.Label))
1346             {
1347                 <label for="@settings.Id">@settings.Label</label>
1348             }
1349             @if (!string.IsNullOrEmpty(settings.HelpText))
1350             {
1351                 <small class="form__help-text">@settings.HelpText</small>
1352             }
1353     
1354             @if (settings.ActionButton != null)
1355             {
1356                 settings.ActionButton.CssClass += " btn--condensed u-no-margin";
1357                 <div class="form__field-combi u-no-margin dw-mod">
1358                     @RenderSelectBase(settings)
1359                     @Render(settings.ActionButton)
1360                 </div>
1361             }
1362             else
1363             {
1364                 @RenderSelectBase(settings)
1365             }
1366     
1367             @Render(new NotificationMessage { Message = settings.ErrorMessage })
1368         </div>
1369     }
1370     
1371     @helper RenderSelectBase(SelectField settings)
1372     {
1373         var attributes = new Dictionary<string, string>();
1374     
1375         /*base settings*/
1376         if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1377         if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1378         if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1379         if (settings.Disabled) { attributes.Add("disabled", "true"); }
1380         if (settings.Required) { attributes.Add("required", "true"); }
1381         if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1382         /*end*/
1383     
1384         var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1385     
1386         <select @ComponentMethods.AddAttributes(resultAttributes) class="u-full-width @settings.CssClass dw-mod">
1387             @if (settings.Default != null)
1388             {
1389                 @Render(settings.Default)
1390             }
1391     
1392             @foreach (var item in settings.Options)
1393             {
1394                 if (!string.IsNullOrEmpty(settings.Value)) {
1395                     item.Checked = item.Value == settings.Value;
1396                 }
1397                 @Render(item)
1398             }
1399         </select>
1400     }
1401     @using System.Reflection
1402     @using Dynamicweb.Rapido.Blocks.Components.General
1403     @using Dynamicweb.Rapido.Blocks.Components
1404     
1405     @* Component *@
1406     
1407     @helper RenderRadioButtonField(RadioButtonField settings)
1408     {
1409         var attributes = new Dictionary<string, string>();
1410         if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 
1411         {
1412             settings.Id = Guid.NewGuid().ToString("N");
1413         }
1414     
1415         /*base settings*/
1416         if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1417         if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1418         if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1419         if (settings.Disabled) { attributes.Add("disabled", "true"); }
1420         if (settings.Required) { attributes.Add("required", "true"); }
1421         if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1422         /*end*/
1423         
1424         attributes.Add("type", "radio");
1425         if (settings.Checked) { attributes.Add("checked", "true"); }
1426         settings.CssClass = "form__control " + settings.CssClass;
1427         if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); }
1428     
1429         var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1430     
1431         <div class="form__field-group @settings.WrapperCssClass dw-mod">
1432             <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1433             @if (!string.IsNullOrEmpty(settings.Label))
1434             {
1435                 <label for="@settings.Id" class="dw-mod">@settings.Label</label>
1436             }
1437             @if (!string.IsNullOrEmpty(settings.HelpText))
1438             {
1439                 <small class="form__help-text">@settings.HelpText</small>
1440             }
1441             @Render(new NotificationMessage { Message = settings.ErrorMessage })
1442         </div>
1443     }
1444     @using System.Reflection
1445     @using Dynamicweb.Rapido.Blocks.Components.General
1446     @using Dynamicweb.Rapido.Blocks.Components
1447     
1448     
1449     @* Component *@
1450     
1451     @helper RenderRadioButtonListField(RadioButtonListField settings)
1452     {
1453         <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1454             @if (!string.IsNullOrEmpty(settings.Label))
1455             {
1456                 <label>@settings.Label</label>
1457             }
1458             @if (!string.IsNullOrEmpty(settings.HelpText))
1459             {
1460                 <small class="form__help-text">@settings.HelpText</small>
1461             }
1462     
1463             @foreach (var item in settings.Options)
1464             {
1465                 if (settings.Required)
1466                 {
1467                     item.Required = true;
1468                 }
1469                 if (settings.Disabled)
1470                 {
1471                     item.Disabled = true;
1472                 }
1473                 if (!string.IsNullOrEmpty(settings.Name))
1474                 {
1475                     item.Name = settings.Name;
1476                 }
1477                 if (!string.IsNullOrEmpty(settings.Value) && settings.Value == item.Value)
1478                 {
1479                     item.Checked = true;
1480                 }
1481                 if (!string.IsNullOrEmpty(settings.OnClick))
1482                 {
1483                     item.OnClick += settings.OnClick;
1484                 }
1485                 if (!string.IsNullOrEmpty(settings.OnChange))
1486                 {
1487                     item.OnChange += settings.OnChange;
1488                 }
1489                 if (!string.IsNullOrEmpty(settings.CssClass))
1490                 {
1491                     item.CssClass += settings.CssClass;
1492                 }
1493                 @Render(item)
1494             }
1495     
1496             @Render(new NotificationMessage { Message = settings.ErrorMessage })
1497         </div>
1498     }
1499     @using System.Reflection
1500     @using Dynamicweb.Rapido.Blocks.Components.General
1501     @using Dynamicweb.Rapido.Blocks.Components
1502     
1503     
1504     @* Component *@
1505     
1506     @helper RenderNotificationMessage(NotificationMessage settings)
1507     {
1508         if (!string.IsNullOrEmpty(settings.Message))
1509         {
1510             var attributes = new Dictionary<string, string>();
1511             if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1512     
1513             string messageTypeClass = Enum.GetName(typeof(NotificationMessageType), settings.MessageType).ToLower();
1514             <div class="field-@messageTypeClass @settings.CssClass u-full-width dw-mod" @ComponentMethods.AddAttributes(attributes)>@settings.Message</div>
1515         }
1516     }
1517     @using Dynamicweb.Rapido.Blocks.Components.General
1518     
1519     
1520     @* Component *@
1521     
1522     @helper RenderHandlebarsRoot(HandlebarsRoot settings) {
1523         string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : "";
1524     
1525         <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>
1526             @if (settings.SubBlocks != null) {
1527                 @RenderBlockList(settings.SubBlocks)
1528             }
1529         </div>
1530     }
1531     @using System.Reflection
1532     @using Dynamicweb.Rapido.Blocks.Components.General
1533     @using Dynamicweb.Rapido.Blocks.Components
1534     @using System.Text.RegularExpressions
1535     
1536     
1537     @* Component *@
1538     
1539     @helper RenderSticker(Sticker settings) {
1540         if (!String.IsNullOrEmpty(settings.Title)) {
1541             string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : "";
1542             string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : "";
1543     
1544             Dictionary<String, String> optionalAttributes = new Dictionary<string, string>();
1545             if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) {
1546                 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : "";
1547                 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : "";
1548                 optionalAttributes.Add("style", styleTag);
1549             }
1550     
1551             <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div>   
1552         }
1553     }
1554     
1555     @using System.Reflection
1556     @using Dynamicweb.Rapido.Blocks.Components.General
1557     @using Dynamicweb.Rapido.Blocks.Components
1558     
1559     
1560     @* Component *@
1561     
1562     @helper RenderStickersCollection(StickersCollection settings)
1563     {
1564         if (settings.Stickers.Count > 0) 
1565         {
1566             string position = "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower();
1567     
1568             <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1569                 @foreach (Sticker sticker in settings.Stickers)
1570                 {
1571                     @Render(sticker)
1572                 }
1573             </div> 
1574         }
1575     }
1576     
1577     @using Dynamicweb.Rapido.Blocks.Components.General
1578     
1579     
1580     @* Component *@
1581     
1582     @helper RenderForm(Form settings) {
1583         if (settings != null)
1584         {
1585             Dictionary<string, string> optionalAttributes = new Dictionary<string, string>();
1586             if (!string.IsNullOrEmpty(settings.Action)) { optionalAttributes.Add("action", settings.Action); };
1587             if (!string.IsNullOrEmpty(settings.Name)) { optionalAttributes.Add("name", settings.Name); };
1588             if (!string.IsNullOrEmpty(settings.OnSubmit)) { optionalAttributes.Add("onsubmit", settings.OnSubmit); };
1589             var enctypes = new Dictionary<string, string>
1590             {
1591                 { "multipart", "multipart/form-data" },
1592                 { "text", "text/plain" },
1593                 { "application", "application/x-www-form-urlencoded" }
1594             };
1595             if (settings.Enctype != FormEnctype.none) { optionalAttributes.Add("enctype", enctypes[Enum.GetName(typeof(FormEnctype), settings.Enctype).ToLower()]); };
1596             optionalAttributes.Add("method", settings.Method.ToString());
1597     
1598             if (!string.IsNullOrEmpty(settings.FormStartMarkup))
1599             {
1600                 @settings.FormStartMarkup
1601             }
1602             else
1603             {
1604                 @:<form class="@settings.CssClass u-no-margin dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1605             }
1606     
1607             foreach (var field in settings.GetFields())
1608             {
1609                 @Render(field)
1610             }
1611     
1612             @:</form>
1613         }
1614     }
1615     @using System.Reflection
1616     @using Dynamicweb.Rapido.Blocks.Components.General
1617     @using Dynamicweb.Rapido.Blocks.Components
1618     
1619     
1620     @* Component *@
1621     
1622     @helper RenderText(Text settings)
1623     {
1624         @settings.Content 
1625     }
1626     @using System.Reflection
1627     @using Dynamicweb.Rapido.Blocks.Components.General
1628     @using Dynamicweb.Rapido.Blocks.Components
1629     
1630     
1631     @* Component *@
1632     
1633     @helper RenderContentModule(ContentModule settings) {
1634         if (!string.IsNullOrEmpty(settings.Content))
1635         {
1636             @settings.Content 
1637         } 
1638     }
1639     @using System.Reflection
1640     @using Dynamicweb.Rapido.Blocks.Components.General
1641     @using Dynamicweb.Rapido.Blocks.Components
1642     
1643     
1644     @* Component *@
1645     
1646     @helper RenderModal(Modal settings) {
1647         if (settings != null)
1648         {
1649             string modalId = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N");
1650     
1651             string onchange = !string.IsNullOrEmpty(settings.OnClose) ? "onchange=\"if(!this.checked){" + settings.OnClose + "}\"" : "";
1652     
1653             <input type="checkbox" id="@(modalId)ModalTrigger" class="modal-trigger" @onchange />
1654     
1655             <div class="modal-container">
1656                 @if (!settings.DisableDarkOverlay)
1657                 {
1658                     <label for="@(modalId)ModalTrigger" id="@(modalId)ModalOverlay" class="modal-overlay"></label>
1659                 }
1660                 <div class="modal modal--@settings.Width.ToString().ToLower() modal-height--@settings.Height.ToString().ToLower()" id="@(modalId)Modal">
1661                     @if (settings.Heading != null)
1662                     {
1663                         if (!string.IsNullOrEmpty(settings.Heading.Title))
1664                         {
1665                             <div class="modal__header">
1666                                 @Render(settings.Heading)
1667                             </div>
1668                         }
1669                     }
1670                     <div class="modal__body @(settings.Width.ToString().ToLower() == "full" ? "modal__body--full" : "")">
1671                         @if (!string.IsNullOrEmpty(settings.BodyText))
1672                         {
1673                             @settings.BodyText
1674                         }
1675                         @if (settings.BodyTemplate != null)
1676                         {
1677                             @settings.BodyTemplate
1678                         }
1679                         @{
1680                             var actions = settings.GetActions();
1681                         }
1682                     </div>
1683                     @if (actions.Length > 0)
1684                     {
1685                         <div class="modal__footer">
1686                             @foreach (var action in actions)
1687                             {
1688                                 action.CssClass += " u-no-margin";
1689                                 @Render(action)
1690                             }
1691                         </div>
1692                     }
1693                     <label class="modal__close-btn" for="@(modalId)ModalTrigger"></label>
1694                 </div>
1695             </div>
1696         } 
1697     }
1698     @using Dynamicweb.Rapido.Blocks.Components.General
1699     
1700     @* Component *@
1701     
1702     @helper RenderMediaListItem(MediaListItem settings)
1703     {
1704         <div class="media-list-item @settings.CssClass dw-mod" @(!string.IsNullOrEmpty(settings.Id) ? "id=\"" + settings.Id + "\"" : "")>
1705             @if (!string.IsNullOrEmpty(settings.Label))
1706             {
1707                 if (!string.IsNullOrEmpty(settings.Link))
1708                 {
1709                     @Render(new Link
1710                     {
1711                         Href = settings.Link,
1712                         CssClass = "media-list-item__sticker dw-mod",
1713                         ButtonLayout = ButtonLayout.None,
1714                         Title = settings.Label,
1715                         OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : ""
1716                     })
1717                 }
1718                 else if (!string.IsNullOrEmpty(settings.OnClick))
1719                 {
1720                     <span class="media-list-item__sticker dw-mod" onclick="@(settings.OnClick)">
1721                         <span class="u-uppercase">@settings.Label</span>
1722                     </span>
1723                 }
1724                 else
1725                 {
1726                     <span class="media-list-item__sticker media-list-item__sticker--no-link dw-mod">
1727                         <span class="u-uppercase">@settings.Label</span>
1728                     </span>
1729                 }
1730             }
1731             <div class="media-list-item__wrap">
1732                 <div class="media-list-item__info dw-mod">
1733                     <div class="media-list-item__header dw-mod">
1734                         @if (!string.IsNullOrEmpty(settings.Title))
1735                         {
1736                             if (!string.IsNullOrEmpty(settings.Link))
1737                             {
1738                                 @Render(new Link
1739                                 {
1740                                     Href = settings.Link,
1741                                     CssClass = "media-list-item__name dw-mod",
1742                                     ButtonLayout = ButtonLayout.None,
1743                                     Title = settings.Title,
1744                                     OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : ""
1745                                 })
1746                             }
1747                             else if (!string.IsNullOrEmpty(settings.OnClick))
1748                             {
1749                                 <span class="media-list-item__name dw-mod" onclick="@(settings.OnClick)">@settings.Title</span>
1750                             }
1751                             else
1752                             {
1753                                 <span class="media-list-item__name media-list-item__name--no-link dw-mod">@settings.Title</span>
1754                             }
1755                         }
1756     
1757                         @if (!string.IsNullOrEmpty(settings.Status))
1758                         {
1759                             <div class="media-list-item__state dw-mod">@settings.Status</div>
1760                         }
1761                     </div>
1762                     @{
1763                         settings.InfoTable.CssClass += " media-list-item__parameters-table";
1764                     }
1765                 
1766                     @Render(settings.InfoTable)
1767                 </div>
1768                 <div class="media-list-item__actions dw-mod">
1769                     <div class="media-list-item__actions-list dw-mod">
1770                         @{
1771                             var actions = settings.GetActions();
1772     
1773                             foreach (ButtonBase action in actions)
1774                             {
1775                                 action.ButtonLayout = ButtonLayout.None;
1776                                 action.CssClass += " media-list-item__action link";
1777     
1778                                 @Render(action)
1779                             }
1780                         }
1781                     </div>
1782     
1783                     @if (settings.SelectButton != null && !string.IsNullOrEmpty(settings.SelectButton.Title))
1784                     {
1785                         settings.SelectButton.CssClass += " u-no-margin";
1786     
1787                         <div class="media-list-item__action-button">
1788                             @Render(settings.SelectButton)
1789                         </div>
1790                     }
1791                 </div>
1792             </div>
1793         </div>
1794     }
1795     @using Dynamicweb.Rapido.Blocks.Components.General
1796     @using Dynamicweb.Rapido.Blocks.Components
1797     
1798     @helper RenderTable(Table settings)
1799     {
1800         Dictionary<string, string> attributes = new Dictionary<string, string>();
1801         if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1802         
1803         var enumToClasses = new Dictionary<TableDesign, string> 
1804         {
1805             { TableDesign.Clean, "table--clean" },
1806             { TableDesign.Bordered, "table--bordered" },
1807             { TableDesign.Striped, "table--striped" },
1808             { TableDesign.Hover, "table--hover" },
1809             { TableDesign.Compact, "table--compact" },
1810             { TableDesign.Condensed, "table--condensed" },
1811             { TableDesign.NoTopBorder, "table--no-top-border" }
1812         };
1813         string tableDesignClass = "";
1814         if (settings.Design != TableDesign.None) 
1815         {
1816             tableDesignClass = enumToClasses[settings.Design];
1817         }
1818     
1819         if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableDesign.None) { attributes.Add("class", "table " + tableDesignClass + " " + settings.CssClass + " dw-mod"); }
1820         
1821         var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);
1822     
1823         <table @ComponentMethods.AddAttributes(resultAttributes)>
1824             @if (settings.Header != null)
1825             {
1826                 <thead>
1827                     @Render(settings.Header)
1828                 </thead>
1829             }
1830             <tbody>
1831                 @foreach (var row in settings.Rows)
1832                 {
1833                     @Render(row)
1834                 }
1835             </tbody>
1836             @if (settings.Footer != null)
1837             {
1838                 <tfoot>
1839                     @Render(settings.Footer)
1840                 </tfoot>
1841             }
1842         </table>
1843     }
1844     @using Dynamicweb.Rapido.Blocks.Components.General
1845     @using Dynamicweb.Rapido.Blocks.Components
1846     
1847     @helper RenderTableRow(TableRow settings)
1848     {
1849         Dictionary<string, string> attributes = new Dictionary<string, string>();
1850         if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1851         
1852         var enumToClasses = new Dictionary<TableRowDesign, string> 
1853         {
1854             { TableRowDesign.NoBorder, "table__row--no-border" },
1855             { TableRowDesign.Border, "table__row--border" },
1856             { TableRowDesign.TopBorder, "table__row--top-line" },
1857             { TableRowDesign.BottomBorder, "table__row--bottom-line" },
1858             { TableRowDesign.Solid, "table__row--solid" }
1859         };
1860     
1861         string tableRowDesignClass = "";
1862         if (settings.Design != TableRowDesign.None) 
1863         {
1864             tableRowDesignClass = enumToClasses[settings.Design];
1865         }
1866     
1867         if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableRowDesign.None) { attributes.Add("class", "table__row " + tableRowDesignClass + " " + settings.CssClass + " dw-mod"); }
1868     
1869         var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);
1870     
1871         <tr @ComponentMethods.AddAttributes(resultAttributes)>
1872             @foreach (var cell in settings.Cells)
1873             {
1874                 if (settings.IsHeaderRow)
1875                 {
1876                     cell.IsHeader = true;
1877                 }
1878                 @Render(cell)
1879             }
1880         </tr>
1881     }
1882     @using Dynamicweb.Rapido.Blocks.Components.General
1883     @using Dynamicweb.Rapido.Blocks.Components
1884     @using Dynamicweb.Core
1885     
1886     @helper RenderTableCell(TableCell settings)
1887     {
1888         Dictionary<string, string> attributes = new Dictionary<string, string>();
1889         if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1890         if (settings.Colspan != 0) { attributes.Add("colspan", Converter.ToString(settings.Colspan)); }
1891         if (settings.Rowspan != 0) { attributes.Add("rowspan", Converter.ToString(settings.Rowspan)); }
1892         if (!string.IsNullOrEmpty(settings.CssClass)) { attributes.Add("class", settings.CssClass + " dw-mod"); }
1893     
1894         var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);
1895     
1896         string tagName = settings.IsHeader ? "th" : "td";
1897     
1898         @("<" + tagName + " " + ComponentMethods.AddAttributes(resultAttributes) + ">")
1899             @settings.Content
1900         @("</" + tagName + ">");
1901     }
1902     @using System.Linq
1903     @using Dynamicweb.Rapido.Blocks.Components.General
1904     
1905     @* Component *@
1906     
1907     @helper RenderPagination(Dynamicweb.Rapido.Blocks.Components.General.Pagination settings)
1908     {
1909         var pageNumberQueryStringName = Dynamicweb.Rapido.Services.Pagination.GetPageNumberQueryStringName(settings);    // Get the proper 'page number' query string parameter
1910         var queryParameters = Dynamicweb.Rapido.Services.Url.GetQueryParameters(pageNumberQueryStringName);              // Get the NameValueCollection from the querystring
1911     
1912         if (settings.NumberOfPages > 1)
1913         {
1914             string url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/Default.aspx";
1915             string ariaLabel = !string.IsNullOrWhiteSpace(settings.AriaLabel) ? settings.AriaLabel : Translate("Page navigation");
1916             Dictionary<string, int> startAndEndPageNumber = Dynamicweb.Rapido.Services.Pagination.GetStartAndEndPageNumber(settings);
1917     
1918             <div class="pager u-margin-top dw-mod @settings.CssClass" aria-label="@ariaLabel">
1919                 @if (settings.ShowPagingInfo)
1920                 {
1921                     <div class="pager__info dw-mod">
1922                         @Translate("Page") @settings.CurrentPageNumber @Translate("of") @settings.NumberOfPages
1923                     </div>
1924                 }
1925                 <ul class="pager__list dw-mod">
1926                     @if (!string.IsNullOrWhiteSpace(settings.FirstPageUrl) && settings.ShowFirstAndLastControls)
1927                     {
1928                         @Render(new PaginationItem { Link = settings.FirstPageUrl, Icon = settings.FirstIcon })
1929                     }
1930                     @if (!string.IsNullOrWhiteSpace(settings.PreviousPageUrl) && settings.ShowNextAndPrevControls)
1931                     {
1932                         @Render(new PaginationItem { Link = settings.PreviousPageUrl, Icon = settings.PrevIcon })
1933                     }
1934                     @if (settings.GetPages().Any())
1935                     {
1936                         foreach (var page in settings.GetPages())
1937                         {
1938                             @Render(page)
1939                         }
1940                     }
1941                     else
1942                     {
1943                         for (var page = startAndEndPageNumber["StartPage"]; page <= startAndEndPageNumber["EndPage"]; page++)
1944                         {
1945                             queryParameters = Dynamicweb.Rapido.Services.Url.UpdateQueryStringParameter(queryParameters, pageNumberQueryStringName, page.ToString());
1946                             @Render(new PaginationItem { Label = page.ToString(), Link = Dynamicweb.Rapido.Services.Url.BuildUri(url, queryParameters).PathAndQuery, IsActive = (settings.CurrentPageNumber == page) });
1947                         }
1948                     }
1949                     @if (!string.IsNullOrWhiteSpace(settings.NextPageUrl) && settings.ShowNextAndPrevControls)
1950                     {
1951                         @Render(new PaginationItem { Link = settings.NextPageUrl, Icon = settings.NextIcon })
1952                     }
1953                     @if (!string.IsNullOrWhiteSpace(settings.LastPageUrl) && settings.ShowFirstAndLastControls)
1954                     {
1955                         @Render(new PaginationItem { Link = settings.LastPageUrl, Icon = settings.LastIcon })
1956                     }
1957                 </ul>
1958             </div>
1959         }
1960     }
1961     
1962     @helper RenderPaginationItem(PaginationItem settings)
1963     {
1964         if (settings.Icon == null)
1965         {
1966             settings.Icon = new Icon();
1967         }
1968     
1969         settings.Icon.Label = settings.Label;
1970         <li class="pager__btn dw-mod">
1971             @if (settings.IsActive)
1972             {
1973                 <span class="pager__num pager__num--current dw-mod">
1974                     @Render(settings.Icon)
1975                 </span>
1976             }
1977             else
1978             {
1979                 <a href="@settings.Link" class="pager__num dw-mod">
1980                     @Render(settings.Icon)
1981                 </a>
1982             }
1983         </li>
1984     }
1985     
1986     
1987     @using Dynamicweb.Rapido.Blocks.Components.General
1988     @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
1989     
1990     @* Component *@
1991     
1992     @functions
1993     {
1994         public class CustomNumberField : FieldBase
1995         {
1996             public string Min { get; set; }
1997             public string Max { get; set; }
1998             public string Step { get; set; }
1999             public bool ReadOnly { get; set; }
2000             public string OnKeyUp { get; set; }
2001             public string OnInput { get; set; }
2002             public string OnFocus { get; set; }
2003             public Button ActionButton { get; set; }
2004             public string Value { get; set; }
2005         }
2006     }
2007     
2008     @helper RenderCustomNumberField(CustomNumberField settings)
2009     {
2010         var attributes = new Dictionary<string, string>();
2011         if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
2012         {
2013             settings.Id = Guid.NewGuid().ToString("N");
2014         }
2015     
2016         /*base settings*/
2017         if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
2018         if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
2019         if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
2020         if (settings.Disabled) { attributes.Add("disabled", "true"); }
2021         if (settings.Required) { attributes.Add("required", "true"); }
2022         if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
2023         /*end*/
2024     
2025         if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
2026         if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
2027         if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
2028         if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
2029         if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); }
2030         if (settings.Min != null) { attributes.Add("min", settings.Min.ToString()); }
2031         if (settings.Step != null) { attributes.Add("step", settings.Step.ToString()); }
2032         if (settings.Value != null && !string.IsNullOrEmpty(settings.Value.ToString())) { attributes.Add("value", settings.Value.ToString()); }
2033         attributes.Add("type", "number");
2034     
2035         var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);
2036     
2037         <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod">
2038             @if (!string.IsNullOrEmpty(settings.Label))
2039             {
2040                 <label for="@settings.Id">@settings.Label</label>
2041             }
2042             @if (!string.IsNullOrEmpty(settings.HelpText))
2043             {
2044                 <small class="form__help-text">@settings.HelpText</small>
2045             }
2046     
2047             @if (settings.ActionButton != null)
2048             {
2049                 settings.ActionButton.CssClass += " btn--condensed u-no-margin";
2050                 <div class="form__field-combi u-no-margin dw-mod">
2051                     <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
2052                     @Render(settings.ActionButton)
2053                 </div>
2054             }
2055             else
2056             {
2057                 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
2058             }
2059     
2060             @Render(new NotificationMessage { Message = settings.ErrorMessage })
2061         </div>
2062     }
2063     
2064     @helper RenderAddToCartButtonCustom(AddToCartButton settings)
2065     {
2066         if (!settings.HideTitle)
2067         {
2068             if (string.IsNullOrEmpty(settings.Title))
2069             {
2070                 if (settings.BuyForPoints)
2071                 {
2072                     settings.Title = Translate("Buy with points");
2073                 }
2074                 else
2075                 {
2076                     settings.Title = Translate("Add to cart");
2077                 }
2078             }
2079         }
2080         else
2081         {
2082             settings.Title = "";
2083         }
2084     
2085         if (settings.Icon == null)
2086         {
2087             settings.Icon = new Icon();
2088             settings.Icon.LabelPosition = Dynamicweb.Rapido.Blocks.Components.General.IconLabelPosition.After;
2089         }
2090     
2091         if (string.IsNullOrEmpty(settings.Icon.Name))
2092         {
2093             settings.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue;
2094         }
2095     
2096         var parentId = "";
2097     
2098         if (!string.IsNullOrEmpty(settings.QuantitySelectorId))
2099         {
2100             if (settings.QuantitySelectorId.Contains("_"))
2101             {
2102                 parentId = settings.QuantitySelectorId.Split('_')[1];
2103             }
2104             else
2105             {
2106                 parentId = settings.QuantitySelectorId.Substring(8);
2107             }
2108         }
2109     
2110         settings.OnClick = "Cart.AddToCart(event, { " +
2111             "id: '" + settings.ProductId + "'," +
2112             "parentId: '" + parentId + "'," +
2113             (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") +
2114             (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") +
2115             (settings.BuyForPoints ? "buyForPoints: true," : "") +
2116             (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") +
2117             "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value)") +
2118         "});" + settings.OnClick;
2119     
2120         @RenderButton(settings)
2121     }
2122     
2123     
2124     @helper RenderImageCustom(Image settings)
2125     {
2126         if (settings.FilterPrimary != ImageFilter.None || settings.FilterSecondary != ImageFilter.None)
2127         {
2128             Dictionary<string, string> optionalAttributes = new Dictionary<string, string>();
2129             if (!string.IsNullOrEmpty(settings.FilterColor)) { optionalAttributes.Add("style", "background-color: " + settings.FilterColor); }
2130     
2131             if (settings.Caption != null)
2132             {
2133                 @:<div>
2134                 }
2135     
2136                 var primaryFilterClass = settings.FilterPrimary.ToString().ToLower();
2137                 var secondaryFilterClass = settings.FilterSecondary.ToString().ToLower();
2138     
2139                 <div class="image-filter image-filter--@primaryFilterClass u-position-relative dw-mod" @ComponentMethods.AddAttributes(optionalAttributes)>
2140                     <div class="image-filter image-filter--@secondaryFilterClass dw-mod">
2141                         @if (settings.Link != null)
2142                         {
2143                             <a href="@settings.Link">
2144                                 @RenderTheImageCustom(settings)
2145                             </a>
2146                         }
2147                         else
2148                         {
2149                             @RenderTheImageCustom(settings)
2150                         }
2151                     </div>
2152                 </div>
2153     
2154                 if (settings.Caption != null)
2155                 {
2156                     <span class="image-caption dw-mod">@settings.Caption</span>
2157                 @:</div>
2158             }
2159         }
2160         else
2161         {
2162             if (settings.Caption != null)
2163             {
2164                 @:<div>
2165                 }
2166                 if (!string.IsNullOrEmpty(settings.Link))
2167                 {
2168                     <a href="@settings.Link">
2169                         @RenderTheImageCustom(settings)
2170                     </a>
2171                 }
2172                 else
2173                 {
2174                     @RenderTheImageCustom(settings)
2175                 }
2176     
2177                 if (settings.Caption != null)
2178                 {
2179                     <span class="image-caption dw-mod">@settings.Caption</span>
2180                 @:</div>
2181             }
2182         }
2183     }
2184     
2185     @helper RenderTheImageCustom(Image settings)
2186     {
2187         if (settings != null)
2188         {
2189             string placeholderImage = "/Files/Images/placeholder.gif";
2190             string imageEngine = "/Admin/Public/GetImage.ashx?";
2191     
2192             string imageStyle = "";
2193     
2194             switch (settings.Style)
2195             {
2196                 case ImageStyle.Ball:
2197                     imageStyle = "grid__cell-img--ball";
2198                     break;
2199             }
2200     
2201             if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle)
2202             {
2203                 if (settings.ImageDefault != null)
2204                 {
2205                     settings.ImageDefault.Height = settings.ImageDefault.Width;
2206                 }
2207                 if (settings.ImageMedium != null)
2208                 {
2209                     settings.ImageMedium.Height = settings.ImageMedium.Width;
2210                 }
2211                 if (settings.ImageSmall != null)
2212                 {
2213                     settings.ImageSmall.Height = settings.ImageSmall.Width;
2214                 }
2215             }
2216     
2217             string defaultImage = imageEngine;
2218             string imageSmall = "";
2219             string imageMedium = "";
2220     
2221             if (settings.DisableImageEngine)
2222             {
2223                 defaultImage = settings.Path;
2224             }
2225             else
2226             {
2227                 if (settings.ImageDefault != null)
2228                 {
2229                     defaultImage += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageDefault);
2230     
2231                     if (settings.Path.GetType() != typeof(string))
2232                     {
2233                         defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
2234                         defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
2235                     }
2236                     else
2237                     {
2238                         defaultImage += settings.Path != null ? "Image=" + settings.Path : "";
2239                     }
2240                 }
2241     
2242                 if (settings.ImageSmall != null)
2243                 {
2244                     imageSmall = "data-src-small=\"" + imageEngine;
2245                     imageSmall += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageSmall);
2246     
2247                     if (settings.Path.GetType() != typeof(string))
2248                     {
2249                         imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
2250                         imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
2251                     }
2252                     else
2253                     {
2254                         imageSmall += settings.Path != null ? "Image=" + settings.Path : "";
2255                     }
2256     
2257                     imageSmall += "\"";
2258                 }
2259     
2260                 if (settings.ImageMedium != null)
2261                 {
2262                     imageMedium = "data-src-medium=\"" + imageEngine;
2263                     imageMedium += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageMedium);
2264     
2265                     if (settings.Path.GetType() != typeof(string))
2266                     {
2267                         imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
2268                         imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
2269                     }
2270                     else
2271                     {
2272                         imageMedium += settings.Path != null ? "Image=" + settings.Path : "";
2273                     }
2274     
2275                     imageMedium += "\"";
2276                 }
2277             }
2278     
2279             Dictionary<string, string> optionalAttributes = new Dictionary<string, string>();
2280             if (!string.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); }
2281             if (!string.IsNullOrEmpty(settings.Title))
2282             {
2283                 optionalAttributes.Add("alt", settings.Title);
2284                 optionalAttributes.Add("title", settings.Title);
2285             }
2286     
2287             if (settings.DisableLazyLoad)
2288             {
2289                 <img id="@settings.Id" class="@imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) />
2290             }
2291             else
2292             {
2293                 <img id="@settings.Id" class="@imageStyle @settings.CssClass dw-mod" src="@defaultImage" data-src="@defaultImage" @imageSmall @imageMedium @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) />
2294             }
2295         }
2296     }
2297     
2298     @helper RenderArticleRelatedCustom(ArticleRelated settings)
2299     {
2300         string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : "";
2301         string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : "";
2302     
2303         <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width">
2304             <div class="center-container dw-mod">
2305                 <div class="grid u-padding">
2306                     <div class="grid__col-md-12 grid__col-xs-12">
2307                         <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2>
2308                     </div>
2309                 </div>
2310     
2311                 <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>
2312     
2313                 <script id="RelatedSimpleTemplate" type="text/x-template">
2314                     {{#.}}
2315                     <div class="grid u-padding-bottom--lg">
2316                         {{#Cases}}
2317                         <div class="grid__col-md-3 grid__col-sm-6 grid__col-xs-12 image-hover--zoom dw-mod">
2318                             <a href="{{link}}" class="u-full-height u-color-light--bg">
2319                                 {{#if image}}
2320                                 <div class="u-color-light--bg u-no-padding dw-mod">
2321                                     <div class="flex-img image-hover__wrapper">
2322                                         <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=680&height=314&crop=1&DoNotUpscale=True&Compression=75&image={{image}}" alt="{{title}}" />
2323                                     </div>
2324                                 </div>
2325                                 {{/if}}
2326     
2327                                 <div class="card u-color-light--bg dw-mod">
2328                                     <h3 class="article-list__item-header u-truncate-text dw-mod">{{title}}</h3>
2329                                     <p class="article__short-summary dw-mod">{{summary}}</p>
2330                                 </div>
2331                             </a>
2332                         </div>
2333                         {{/Cases}}
2334                     </div>
2335                     {{/.}}
2336                 </script>
2337             </div>
2338         </section>
2339     }
2340     @using Dynamicweb.Frontend
2341     @using System.Reflection
2342     @using Dynamicweb.Content.Items
2343     @using System.Web.UI.HtmlControls
2344     @using Dynamicweb.Rapido.Blocks.Components
2345     @using Dynamicweb.Rapido.Blocks
2346     @using Dynamicweb.Rapido.Blocks.Components.Articles
2347     
2348     @* Components for the articles *@
2349     @using System.Reflection
2350     @using Dynamicweb.Rapido.Blocks.Components.Articles
2351     
2352     
2353     @* Component for the articles *@
2354     
2355     @helper RenderArticleBanner(dynamic settings) { 
2356         string filterClasses = "image-filter image-filter--darken";
2357         settings.Layout = ArticleHeaderLayout.Banner;
2358     
2359         if (settings.Image != null)
2360         {
2361             if (settings.Image.Path != null)
2362             {
2363                 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width">
2364                     <div class="background-image @filterClasses dw-mod">
2365                         <div class="background-image__wrapper @filterClasses dw-mod">
2366                             @{ 
2367                                 settings.Image.CssClass += "background-image__cover dw-mod";
2368                             }
2369                             @Render(settings.Image)
2370                         </div>
2371                     </div>
2372                     <div class="center-container dw-mod">
2373                         <div class="grid">
2374                             <div class="grid__col-md-8 grid__col-xs-12 paragraph-container paragraph-container--height-lg">
2375                                 <div class="u-left-middle">
2376                                     <div>
2377                                         @if (!String.IsNullOrEmpty(settings.Heading))
2378                                         {
2379                                             <h1 class="article__header article__header--giant dw-mod" style="color: @settings.TextColor">@settings.Heading</h1>
2380                                         }
2381                                         @if (!String.IsNullOrEmpty(settings.Subheading))
2382                                         {
2383                                             <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div>
2384                                         }
2385                                         @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2386                                         {
2387                                             <small class="article__post-info u-margin-bottom--lg dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small>
2388                                         }
2389                                         @if (!String.IsNullOrEmpty(settings.Link)) {
2390                                             <div class="grid__cell">
2391                                                 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2392                                             </div>
2393                                         }
2394                                     </div>
2395                                 </div>
2396                             </div>
2397                             @if (settings.ExternalParagraphId != 0)
2398                             {
2399                                 <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod">
2400                                     <div class="u-color-light-gray--bg u-color-dark dw-mod">
2401                                         @RenderParagraphContent(settings.ExternalParagraphId)
2402                                     </div>
2403                                 </div> 
2404                             }
2405                             
2406                         </div>
2407                     </div>
2408                 </section>
2409                 if (!String.IsNullOrEmpty(settings.Image.Caption)) {
2410                     <div class="image-caption dw-mod">@settings.Image.Caption</div>
2411                 }
2412             }
2413             else 
2414             {
2415                 settings.Layout = ArticleHeaderLayout.Clean;
2416                 @RenderArticleCleanHeader(settings);
2417             }
2418         }
2419         else
2420         {
2421             settings.Layout = ArticleHeaderLayout.Clean;
2422             @RenderArticleCleanHeader(settings);
2423         }
2424     }
2425     @using System.Reflection
2426     @using Dynamicweb.Rapido.Blocks.Components
2427     @using Dynamicweb.Rapido.Blocks.Components.General
2428     @using Dynamicweb.Rapido.Blocks.Components.Articles
2429     @using Dynamicweb.Rapido.Blocks
2430     
2431     
2432     @* Component for the articles *@
2433     
2434     @helper RenderArticleHeader(ArticleHeader settings) {
2435         dynamic[] methodParameters = new dynamic[1]; 
2436         methodParameters[0] = settings; 
2437         MethodInfo customMethod = this.GetType().GetMethod("RenderArticleHeaderCustom");
2438     
2439         if (customMethod != null)
2440         {  
2441             @customMethod.Invoke(this, methodParameters).ToString();                                         
2442         } else {
2443             switch (settings.Layout)
2444             {
2445                 case ArticleHeaderLayout.Clean:
2446                     @RenderArticleCleanHeader(settings);
2447                     break;
2448                 case ArticleHeaderLayout.Split:
2449                     @RenderArticleSplitHeader(settings);
2450                     break;
2451                 case ArticleHeaderLayout.Banner:
2452                     @RenderArticleBannerHeader(settings);
2453                     break;
2454                 case ArticleHeaderLayout.Overlay:
2455                     @RenderArticleOverlayHeader(settings);
2456                     break;
2457                 default:
2458                     @RenderArticleCleanHeader(settings);
2459                     break;
2460             }
2461         }
2462     }
2463     
2464     @helper RenderArticleCleanHeader(ArticleHeader settings) {
2465         dynamic[] methodParameters = new dynamic[1];
2466         methodParameters[0] = settings;
2467         MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom");
2468     
2469         if (customMethod != null)
2470         {
2471                 @customMethod.Invoke(this, methodParameters).ToString();
2472         }
2473         else
2474         {
2475             string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12";
2476     
2477             <div class="grid grid--align-content-start grid--justify-start">
2478                 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod">
2479                     @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0)
2480                     {
2481                         <div class="u-border-bottom u-padding-bottom">
2482                             @if (!String.IsNullOrEmpty(settings.Category))
2483                             {
2484                                 <div class="u-pull--left">
2485                                     <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div>
2486                                 </div>
2487                             }
2488                             <div class="u-pull--right">
2489                                 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2490                                 {
2491                                     <small class="article__post-info dw-mod">@settings.Author @settings.Date</small>
2492                                 }
2493                                 @if (settings.RatingOutOf != 0)
2494                                 {
2495                                     @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })
2496                                 }
2497                             </div>
2498                         </div>
2499                     }
2500     
2501                     <div class="grid__cell">
2502                        @if (!String.IsNullOrEmpty(settings.Heading))
2503                        {
2504                             <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1>
2505                        }
2506                         @if (settings.Image != null)
2507                         {
2508                             if (settings.Image.Path != null)
2509                             {
2510                                 settings.Image.Title = settings.Heading;
2511                                 <div class="u-padding-bottom--lg">
2512                                     @Render(settings.Image)
2513                                 </div>
2514                             }
2515                         }
2516                         @if (!String.IsNullOrEmpty(settings.Subheading))
2517                         {
2518                             <div class="article__leadtext dw-mod">@settings.Subheading</div>
2519                         }
2520                         @if (!String.IsNullOrEmpty(settings.Link))
2521                         {
2522                             <div class="grid__cell">
2523                                 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2524                             </div>
2525                         }
2526                     </div>
2527                 </div>
2528                 @if (settings.ExternalParagraphId != 0)
2529                 {
2530                     <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod">
2531                         @RenderParagraphContent(settings.ExternalParagraphId)
2532                     </div>
2533                 }
2534             </div>
2535         }
2536     }
2537     
2538     @helper RenderArticleSplitHeader(ArticleHeader settings) { 
2539         dynamic[] methodParameters = new dynamic[1];
2540         methodParameters[0] = settings;
2541         MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSplitHeaderCustom");
2542     
2543         if (customMethod != null)
2544         {
2545             @customMethod.Invoke(this, methodParameters).ToString();
2546         }
2547         else
2548         {
2549             string headerColumnWidth = settings.ExternalParagraphId != 0 ? "4" : "6";
2550         
2551             if (settings.Image != null)
2552             {
2553                 if (settings.Image.Path != null)
2554                 {
2555                     <section class="multiple-paragraphs-container paragraph-container--full-width">
2556                         <div class="grid">
2557                             <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod">
2558                                 <div class="u-left-middle u-padding--lg">
2559                                     <div>
2560                                         @if (!String.IsNullOrEmpty(settings.Category))
2561                                         {
2562                                             <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div>
2563                                         }
2564                                         @if (!String.IsNullOrEmpty(settings.Heading))
2565                                         {
2566                                             <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1>
2567                                         }
2568                                         @if (!String.IsNullOrEmpty(settings.Subheading))
2569                                         {
2570                                             <div class="article__leadtext dw-mod">@settings.Subheading</div>
2571                                         }
2572                                         @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2573                                         {
2574                                             <small class="article__post-info u-pull--left dw-mod">@settings.Author @settings.Date</small>
2575                                         }
2576                                         @if (settings.RatingOutOf != 0)
2577                                         {
2578                                             <div class="u-pull--right">
2579                                                 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })
2580                                             </div>
2581                                         }
2582                                         @if (!String.IsNullOrEmpty(settings.Link)) {
2583                                             <div class="u-full-width u-pull--left u-margin-top">
2584                                                 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2585                                             </div>
2586                                         }
2587                                     </div>
2588                                 </div>
2589                             </div>
2590                             <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&height=1100&crop=0&Compression=85&DoNotUpscale=true&image=@settings.Image.Path); background-position: center center; background-size: cover;"></div>
2591                             @if (settings.ExternalParagraphId != 0)
2592                             {
2593                                 <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">
2594                                     @RenderParagraphContent(settings.ExternalParagraphId)
2595                                 </div> 
2596                             }
2597                         </div>
2598                     </section>
2599                 }
2600             }
2601             else
2602             {
2603                 @RenderArticleCleanHeader(settings);
2604             } 
2605         }   
2606     }
2607     
2608     @helper RenderArticleOverlayHeader(ArticleHeader settings) {
2609         dynamic[] methodParameters = new dynamic[1];
2610         methodParameters[0] = settings;
2611         MethodInfo customMethod = this.GetType().GetMethod("RenderArticleOverlayHeaderCustom");
2612     
2613         if (customMethod != null)
2614         {
2615             @customMethod.Invoke(this, methodParameters).ToString();
2616         }
2617         else
2618         {
2619             string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12";
2620             string contentAlignment = settings.TextLayout == ArticleHeaderTextLayout.Center ? "grid--justify-center" : "";
2621     
2622             if (settings.Image != null)
2623             {
2624                 if (settings.Image.Path != null)
2625                 {
2626                     if (settings.ExternalParagraphId == 0)
2627                     {
2628                         <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width">
2629                             <div class="background-image image-filter image-filter--darken dw-mod">
2630                                 <div class="background-image__wrapper image-filter image-filter--darken dw-mod">
2631                                     @{ 
2632                                         settings.Image.CssClass += "background-image__cover dw-mod";
2633                                     }
2634                                     @Render(settings.Image)
2635                                 </div>
2636                             </div>
2637                             <div class="center-container dw-mod">
2638                                 <div class="grid @contentAlignment">
2639                                     <div class="grid__col-md-@contentColumns grid__col-xs-12 paragraph-container paragraph-container--height-xl u-no-padding dw-mod">
2640                                         @if (!String.IsNullOrEmpty(settings.Heading))
2641                                         {
2642                                             <h1 class="article__header article__header--giant u-padding-top--lg dw-mod" style="color: @settings.TextColor">@settings.Heading</h1>
2643                                         }
2644                                         @if (!String.IsNullOrEmpty(settings.Subheading))
2645                                         {
2646                                             <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div>
2647                                         }
2648                                         <div class="u-margin-top">
2649                                             @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2650                                             {
2651                                                 <small class="article__post-info u-pull--left dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small>
2652                                             }
2653                                             @if (settings.RatingOutOf != 0)
2654                                             {
2655                                                 <div class="u-pull--right">
2656                                                     @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })
2657                                                 </div>
2658                                             }
2659                                         </div>
2660                                         @if (!String.IsNullOrEmpty(settings.Link))
2661                                         {
2662                                             <div class="grid__cell">
2663                                                 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2664                                             </div>
2665                                         }
2666                                     </div>
2667                                 </div>
2668                             </div>
2669                         </section>
2670                     }
2671                     else
2672                     {
2673                         @RenderArticleBanner(settings);
2674                     }
2675                 }
2676             }
2677             else
2678             {
2679                 @RenderArticleCleanHeader(settings);
2680             }
2681         }
2682     }
2683     
2684     @helper RenderArticleBannerHeader(dynamic settings) { 
2685         dynamic[] methodParameters = new dynamic[1];
2686         methodParameters[0] = settings;
2687         MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerHeaderCustom");
2688     
2689         if (customMethod != null)
2690         {
2691             @customMethod.Invoke(this, methodParameters).ToString();
2692         }
2693         else
2694         {
2695             @RenderArticleBanner(settings);
2696         }
2697     }
2698     @using System.Reflection
2699     @using System.Text.RegularExpressions;
2700     @using Dynamicweb.Frontend
2701     @using Dynamicweb.Content.Items
2702     @using Dynamicweb.Rapido.Blocks.Components
2703     @using Dynamicweb.Rapido.Blocks.Components.Articles
2704     @using Dynamicweb.Rapido.Blocks
2705     
2706     @* Component for the articles *@
2707     
2708     @helper RenderArticleBodyRow(ArticleBodyRow settings)
2709     {
2710         string position = settings.TopLayout == "overlay" ? "article__overlay-offset" : "";
2711         string contentAlignment = settings.TextLayout == "center" ? "grid--justify-center" : "";
2712     
2713         <div class="grid grid--align-content-start @contentAlignment @position dw-mod">
2714             @RenderBlockList(settings.SubBlocks)
2715         </div>
2716     }
2717     @using System.Reflection
2718     @using Dynamicweb.Rapido.Blocks.Components
2719     @using Dynamicweb.Rapido.Blocks.Components.General
2720     @using Dynamicweb.Rapido.Blocks.Components.Articles
2721     @using Dynamicweb.Rapido.Blocks
2722     
2723     @* Component for the articles *@
2724     
2725     @helper RenderArticleImage(ArticleImage settings)
2726     {
2727         if (settings.Image != null)
2728         {
2729             if (settings.Image.Path != null)
2730             {
2731                 <div class="u-margin-bottom--lg">
2732                     @Render(settings.Image)
2733                 </div>
2734             }
2735         }
2736     }
2737     @using System.Reflection
2738     @using Dynamicweb.Rapido.Blocks.Components
2739     @using Dynamicweb.Rapido.Blocks.Components.Articles
2740     
2741     
2742     @* Component for the articles *@
2743     
2744     @helper RenderArticleSubHeader(ArticleSubHeader settings)
2745     {
2746         if (!String.IsNullOrEmpty(settings.Title))
2747         {
2748             <h2 class="article__header">@settings.Title</h2>
2749         }
2750     }
2751     @using System.Reflection
2752     @using Dynamicweb.Rapido.Blocks.Components
2753     @using Dynamicweb.Rapido.Blocks.Components.Articles
2754     @using Dynamicweb.Rapido.Blocks
2755     
2756     
2757     @* Component for the articles *@
2758     
2759     @helper RenderArticleText(ArticleText settings)
2760     {
2761         if (!String.IsNullOrEmpty(settings.Text))
2762         {
2763             string greatTextClass = settings.EnableLargeText == true ? "article__paragraph--great-text" : "";
2764     
2765             <div class="article__paragraph @greatTextClass">
2766                 @settings.Text
2767             </div>
2768         }
2769     }
2770     @using System.Reflection
2771     @using Dynamicweb.Rapido.Blocks.Components
2772     @using Dynamicweb.Rapido.Blocks.Components.Articles
2773     @using Dynamicweb.Rapido.Blocks
2774     
2775     
2776     @* Component for the articles *@
2777     
2778     @helper RenderArticleQuote(ArticleQuote settings)
2779     {
2780         string text = Regex.Replace(settings.Text, "<.*?>", String.Empty);
2781     
2782         <div class="grid u-padding-bottom--lg">
2783             @if (settings.Image != null)
2784             {
2785                 if (settings.Image.Path != null) {
2786                     <div class="grid__col-3">
2787                         <div class="grid__cell-img">
2788                             @{ 
2789                                 settings.Image.Title = !String.IsNullOrEmpty(settings.Image.Title) ? settings.Image.Title : settings.Author;
2790                                 settings.Image.CssClass += " article__image article__image--ball";
2791                                 settings.Image.ImageDefault.Width = 200;
2792                                 settings.Image.ImageDefault.Height = 200;
2793                             }
2794                             @Render(settings.Image)
2795                         </div>
2796                     </div>
2797                 }
2798             }
2799             <div class="grid__col-auto">
2800                 @if (!String.IsNullOrEmpty(settings.Text))
2801                 {
2802                 <div class="article__quote dw-mod">
2803                     <i class="fas fa-quote-right u-margin-bottom--lg"></i>
2804                     @settings.Text
2805                     <i class="fas fa-quote-right"></i>
2806                 </div>
2807                 }
2808                 @if (!String.IsNullOrEmpty(settings.Author))
2809                 {
2810                 <div class="article__quote-author dw-mod">
2811                     - @settings.Author
2812                 </div>
2813                 }
2814             </div>
2815         </div>
2816     } 
2817     @using System.Reflection
2818     @using Dynamicweb.Rapido.Blocks.Components
2819     @using Dynamicweb.Rapido.Blocks.Components.Articles
2820     @using Dynamicweb.Rapido.Blocks
2821     
2822     @* Component for the articles *@
2823     
2824     @helper RenderArticleInfoTable(ArticleInfoTable settings)
2825     {
2826         <table class="table table--clean">
2827             @foreach (var row in settings.Rows)
2828             {
2829                 string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two";
2830     
2831                 <tr>
2832                     @if (!String.IsNullOrEmpty(row.Icon))
2833                     {
2834                         <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td>
2835                     }
2836                     <td class="u-no-margin-on-p-elements">
2837                         <div class="u-bold">@row.Title</div>
2838                         @if (!String.IsNullOrEmpty(row.SubTitle))
2839                         {
2840                             if (row.Link == null)
2841                             {
2842                             <div>@row.SubTitle</div>
2843                             }
2844                             else
2845                             {
2846                             <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a>
2847                             }
2848                         }
2849                     </td>
2850                 </tr>
2851             }
2852         </table>
2853     }
2854     @using System.Reflection
2855     @using Dynamicweb.Rapido.Blocks.Components
2856     @using Dynamicweb.Rapido.Blocks.Components.General
2857     @using Dynamicweb.Rapido.Blocks.Components.Articles
2858     @using Dynamicweb.Rapido.Blocks
2859     
2860     @* Component for the articles *@
2861     
2862     @helper RenderArticleGalleryModal(ArticleGalleryModal settings)
2863     {
2864         Modal galleryModal = new Modal
2865         {
2866             Id = "ParagraphGallery",
2867             Width = ModalWidth.Full,
2868             BodyTemplate = RenderArticleGalleryModalContent()
2869         };
2870     
2871         @Render(galleryModal)
2872     }
2873     
2874     @helper RenderArticleGalleryModalContent() {
2875         <div class="modal__image-min-size-wrapper">
2876             @Render(new Image {
2877                 Id = "ParagraphGallery",
2878                 Path = "#",
2879                 CssClass = "modal--full__img",
2880                 DisableLazyLoad = true,
2881                 DisableImageEngine = true
2882             })
2883         </div>
2884     
2885         <div class="modal__images-counter" id="ParagraphGallery_counter"></div>
2886     
2887         @Render(new Button {
2888             Id = "ParagraphGallery_prev",
2889             ButtonType = ButtonType.Button,
2890             ButtonLayout = ButtonLayout.None,
2891             CssClass = "modal__prev-btn",
2892             Icon = new Icon { Prefix = "far", Name = "fa-angle-left", LabelPosition = IconLabelPosition.After },
2893             OnClick = "Gallery.prevImage('ParagraphGallery')"
2894         })
2895     
2896         @Render(new Button {
2897             Id = "ParagraphGallery_next",
2898             ButtonType = ButtonType.Button,
2899             ButtonLayout = ButtonLayout.None,
2900             CssClass = "modal__next-btn",
2901             Icon = new Icon { Prefix = "far", Name = "fa-angle-right", LabelPosition = IconLabelPosition.After },
2902             OnClick = "Gallery.nextImage('ParagraphGallery')"
2903         })
2904     }
2905     @using System.Reflection
2906     @using Dynamicweb.Rapido.Blocks.Components
2907     @using Dynamicweb.Rapido.Blocks.Components.Articles
2908     @using Dynamicweb.Rapido.Blocks
2909     
2910     
2911     @* Component for the articles *@
2912     
2913     @helper RenderArticleRelated(ArticleRelated settings)
2914     {
2915         string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : "";
2916         string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : "";
2917     
2918         <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width">
2919             <div class="center-container dw-mod">
2920                 <div class="grid u-padding">
2921                     <div class="grid__col-md-12 grid__col-xs-12">
2922                         <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2>
2923                     </div>
2924                 </div>
2925     
2926                 <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>
2927     
2928                 <script id="RelatedSimpleTemplate" type="text/x-template">
2929                     {{#.}}
2930                     <div class="grid u-padding-bottom--lg">
2931                         {{#Cases}}
2932                         <div class="grid__col-3 image-hover--zoom dw-mod">
2933                             <a href="{{link}}" class="u-full-height u-color-light--bg">
2934                                 {{#if image}}
2935                                 <div class="u-color-light--bg u-no-padding dw-mod">
2936                                     <div class="flex-img image-hover__wrapper">
2937                                         <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=680&height=314&crop=1&DoNotUpscale=True&Compression=75&image={{image}}" alt="{{title}}" />
2938                                     </div>
2939                                 </div>
2940                                 {{/if}}
2941     
2942                                 <div class="card u-color-light--bg dw-mod">
2943                                     <h3 class="article-list__item-header u-truncate-text dw-mod">{{title}}</h3>
2944                                     <p class="article__short-summary dw-mod">{{summary}}</p>
2945                                 </div>
2946                             </a>
2947                         </div>
2948                         {{/Cases}}
2949                     </div>
2950                     {{/.}}
2951                 </script>
2952             </div>
2953         </section>
2954     }
2955     @using System.Reflection
2956     @using Dynamicweb.Rapido.Blocks.Components
2957     @using Dynamicweb.Rapido.Blocks.Components.Articles
2958     @using Dynamicweb.Rapido.Blocks
2959     
2960     
2961     @* Component for the articles *@
2962     
2963     @helper RenderArticleMenu(ArticleMenu settings)
2964     {
2965         if (!String.IsNullOrEmpty(settings.Title)) {
2966             <div class="u-margin u-border-bottom">
2967                 <h3 class="u-no-margin">@settings.Title</h3>
2968             </div>
2969         }
2970     
2971         <ul class="menu-left u-margin-bottom dw-mod">
2972             @foreach (var item in settings.Items)
2973             {
2974                 @Render(item)
2975             }
2976         </ul>
2977     }
2978     
2979     @helper RenderArticleMenuItem(ArticleMenuItem settings)
2980     {
2981         string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#";
2982     
2983         if (!String.IsNullOrEmpty(settings.Title)) {
2984             <li class="menu-left__item dw-mod">
2985                 <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a>
2986             </li>
2987         } 
2988     }
2989     @using System.Reflection
2990     @using Dynamicweb.Rapido.Blocks.Components
2991     @using Dynamicweb.Rapido.Blocks.Components.Articles
2992     @using Dynamicweb.Rapido.Blocks
2993     
2994     @* Component for the articles *@
2995     
2996     @helper RenderArticleList(ArticleList settings)
2997     {
2998         if (Pageview != null)
2999         {
3000             bool isParagraph = Pageview.CurrentParagraph != null ? true : false;
3001             string[] sortArticlesListBy = new string[2];
3002     
3003             if (isParagraph) {
3004                 sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" };
3005             }
3006             else {
3007                 sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" };
3008             }
3009     
3010             string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString();
3011     
3012             if (!settings.DisablePagination) {
3013                 @RenderItemList(new
3014                 {
3015                     ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle",
3016                     ListSourceType = settings.SourceType,
3017                     ListSourcePage = sourcePage,
3018                     ItemFieldsList = "*",
3019                     Filter = settings.Filter,
3020                     ListOrderBy = sortArticlesListBy[0],
3021                     ListOrderByDirection = sortArticlesListBy[1],
3022                     ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date",
3023                     ListSecondOrderByDirection = "ASC",
3024                     IncludeAllChildItems = true,
3025                     ListTemplate = settings.Template,
3026                     ListPageSize = settings.PageSize.ToString()
3027                 });
3028             } else {
3029                 @RenderItemList(new
3030                 {
3031                     ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle",
3032                     ListSourceType = settings.SourceType,
3033                     ListSourcePage = sourcePage,
3034                     ItemFieldsList = "*",
3035                     Filter = settings.Filter,
3036                     ListOrderBy = sortArticlesListBy[0],
3037                     ListOrderByDirection = sortArticlesListBy[1],
3038                     ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date",
3039                     ListSecondOrderByDirection = "ASC",
3040                     IncludeAllChildItems = true,
3041                     ListTemplate = settings.Template,
3042                     ListPageSize = settings.PageSize.ToString(),
3043                     ListViewMode = "Partial",
3044                     ListShowTo = settings.PageSize + 1
3045                 });
3046             }
3047         }
3048     }
3049     @using System.Reflection
3050     @using Dynamicweb.Rapido.Blocks.Components.Articles
3051     
3052     
3053     @* Component for the articles *@
3054     
3055     @helper RenderArticleSummary(ArticleSummary settings)
3056     {
3057         if (!String.IsNullOrEmpty(settings.Text))
3058         {
3059             <div class="article__summary dw-mod">@settings.Text</div>
3060         }
3061     }
3062     @using System.Reflection
3063     @using Dynamicweb.Rapido.Blocks.Components
3064     @using Dynamicweb.Rapido.Blocks.Components.Articles
3065     @using Dynamicweb.Rapido.Blocks
3066     
3067     @* Component for the articles *@
3068     
3069     @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings)
3070     {
3071         string pageId =  Pageview.ID.ToString();
3072         string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All");
3073         var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString());
3074     
3075         foreach (var option in settings.Categories)
3076         {
3077             selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter;
3078         }
3079     
3080         if (selectedFilter == pageId)
3081         {
3082             selectedFilter = Translate("All");
3083         }
3084     
3085         if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
3086         {
3087             <div class="u-pull--right u-margin-left">
3088                 <div class="collection u-no-margin">
3089                     <h5>@Translate("Category")</h5>
3090                     <input type="checkbox" id="CategorySelector" class="dropdown-trigger" />
3091                     <div class="dropdown u-w180px dw-mod">
3092                         <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label>
3093                         <div class="dropdown__content dw-mod">
3094                             @foreach (var option in settings.Categories)
3095                             {
3096                             <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div>
3097                             }
3098                         </div>
3099                         <label class="dropdown-trigger-off" for="CategorySelector"></label>
3100                     </div>
3101                 </div>
3102             </div>
3103         }
3104         else
3105         {
3106             <div class="u-full-width u-margin-bottom">
3107                 <h5 class="u-no-margin">@Translate("Category")</h5>
3108                 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" />
3109                 <div class="dropdown u-full-width dw-mod">
3110                     <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label>
3111                     <div class="dropdown__content dw-mod">
3112                         @foreach (var option in settings.Categories)
3113                         {
3114                         <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div>
3115                         }
3116                     </div>
3117                     <label class="dropdown-trigger-off" for="CategorySelector"></label>
3118                 </div>
3119             </div>
3120         }
3121     }
3122     @using System.Reflection
3123     @using Dynamicweb.Rapido.Blocks.Components
3124     @using Dynamicweb.Rapido.Blocks.Components.Articles
3125     @using Dynamicweb.Rapido.Blocks
3126     @using System.Collections.Generic
3127     
3128     @* Component for the articles *@
3129     
3130     @helper RenderArticleListFilter(ArticleListFilter settings)
3131     {
3132         string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All");
3133         var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString());
3134     
3135         if (settings.Options != null)
3136         {
3137             if (settings.Options is IEnumerable<dynamic>)
3138             {
3139                 var options = (IEnumerable<dynamic>) settings.Options;
3140                 settings.Options = options.OrderBy(item => item.Name);
3141             }
3142     
3143             foreach (var option in settings.Options)
3144             {
3145                 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter;
3146             }
3147     
3148             if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
3149             {
3150                 <div class="u-pull--right u-margin-left">
3151                     <div class="collection u-no-margin">
3152                         <h5>@settings.Label</h5>
3153                         <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" />
3154                         <div class="dropdown u-w180px dw-mod">
3155                             <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label>
3156                             <div class="dropdown__content dw-mod">
3157                                 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div>
3158                                 @foreach (var option in settings.Options)
3159             {
3160                                     <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div>
3161                                 }
3162                             </div>
3163                             <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label>
3164                         </div>
3165                     </div>
3166                 </div>
3167             }
3168             else
3169             {
3170                 <div class="u-full-width u-margin-bottom">
3171                     <h5 class="u-no-margin">@settings.Label</h5>
3172                     <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" />
3173                     <div class="dropdown u-full-width w-mod">
3174                         <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label>
3175                         <div class="dropdown__content dw-mod">
3176                             <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div>
3177                             @foreach (var option in settings.Options)
3178     {
3179                                 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div>
3180                             }
3181                         </div>
3182                         <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label>
3183                     </div>
3184                 </div>
3185             }
3186         }
3187     }
3188     @using System.Reflection
3189     @using Dynamicweb.Rapido.Blocks.Components
3190     @using Dynamicweb.Rapido.Blocks.Components.Articles
3191     @using Dynamicweb.Rapido.Blocks
3192     
3193     @* Component for the articles *@
3194     
3195     @helper RenderArticleListSearch(ArticleListSearch settings)
3196     {
3197         string searchParameter = !string.IsNullOrEmpty(settings.SearchParameter) ? settings.SearchParameter : "Title";
3198         string searchWord = HttpContext.Current.Request.QueryString.Get(searchParameter);
3199         string searchString = !string.IsNullOrEmpty(searchWord) ? searchWord.Trim('*') : "";
3200         string className = "u-w340px u-pull--right u-margin-left";
3201     
3202         if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet")
3203         {
3204             className = "u-full-width";
3205         }
3206         
3207         <div class="typeahead u-color-inherit u-margin-bottom dw-mod @className">
3208             <input type="text" class="typeahead-search-field u-no-margin dw-mod" placeholder="@Translate("Search in list")" value="@searchString" id="ArticleListSearchInput" onchange="QueryArray.setParameterInCurrentURL('@searchParameter', '*' + document.getElementById('ArticleListSearchInput').value + '*')">
3209             <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button>
3210         </div>
3211     }
3212     @using System.Reflection
3213     @using Dynamicweb.Rapido.Blocks.Components
3214     @using Dynamicweb.Rapido.Blocks.Components.Articles
3215     @using Dynamicweb.Rapido.Blocks
3216     
3217     @* Component for the articles *@
3218     
3219     @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings)
3220     {
3221         <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div>
3222     }
3223     @using System.Reflection
3224     @using Dynamicweb.Rapido.Blocks.Components
3225     @using Dynamicweb.Rapido.Blocks.Components.General
3226     @using Dynamicweb.Rapido.Blocks.Components.Articles
3227     @using Dynamicweb.Rapido.Blocks
3228     @using System.Text.RegularExpressions
3229     
3230     @* Component for the articles *@
3231     
3232     @helper RenderArticleListItem(ArticleListItem settings)
3233     {
3234         switch (settings.Type) {
3235             case ArticleListItemType.Card:
3236                 @RenderArticleListItemCard(settings);
3237                 break;
3238             case ArticleListItemType.List:
3239                 @RenderArticleListItemList(settings);
3240                 break;
3241             case ArticleListItemType.Simple:
3242                 @RenderArticleListItemSimple(settings);
3243                 break;
3244             default:
3245                 @RenderArticleListItemCard(settings);
3246             break;
3247         }
3248     }
3249     
3250     @helper RenderArticleListItemCard(ArticleListItem settings) {
3251         <a href="@settings.Link" class="u-full-height u-color-light--bg">
3252             <div class="u-color-light--bg u-no-padding dw-mod">
3253                 @if (settings.Logo != null)
3254                 {
3255                     string backgroundImage = settings.Image != null ? "background-image:url(/Admin/Public/GetImage.ashx?width=992&height=760&crop=0&Compression=75&DoNotUpscale=True&image=" + settings.Image.Path + "); background-size: cover;" : "";
3256                     settings.Logo.ImageDefault.Crop = 5;
3257                     settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width;
3258                     settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height;
3259                     <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage">
3260                         @if (settings.Stickers != null)
3261                         {
3262                             if (settings.Stickers.Position != StickersListPosition.Custom)
3263                             {
3264                                 @Render(settings.Stickers);
3265                             }
3266                         }
3267                         @RenderImage(settings.Logo)
3268                     </div>
3269                 } else if (settings.Image != null)
3270                 {
3271                     <div class="flex-img image-hover__wrapper u-position-relative dw-mod">
3272                         @if (settings.Stickers != null)
3273                         {
3274                             if (settings.Stickers.Position != StickersListPosition.Custom)
3275                             {
3276                                 @Render(settings.Stickers);
3277                             }                                                        
3278                         }
3279                         @Render(settings.Image)
3280                     </div>
3281                 }
3282             </div>
3283     
3284             @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary))
3285             {
3286                 <div class="card u-color-light--bg dw-mod">
3287                     @if (settings.Stickers != null)
3288                     {
3289                         if (settings.Stickers.Position == StickersListPosition.Custom)
3290                         {
3291                             @Render(settings.Stickers);
3292                         }                                                        
3293                     }
3294                     @if (!String.IsNullOrEmpty(settings.Title))
3295                     {
3296                         <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3>
3297                     }
3298                     @if (!String.IsNullOrEmpty(settings.SubTitle))
3299                     {
3300                         <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>
3301                     }
3302                     @if (!String.IsNullOrEmpty(settings.Summary))
3303                     {
3304                         <p class="article__short-summary dw-mod">@settings.Summary</p>
3305                     }
3306                 </div>
3307             }
3308         </a>
3309     }
3310     
3311     @helper RenderArticleListItemList(ArticleListItem settings) { 
3312         <a href="@settings.Link">
3313             <div class="grid u-color-light--bg u-no-padding dw-mod">
3314                 <div class="grid__col-md-3">
3315                     <div class="u-color-light--bg u-no-padding dw-mod">
3316                         @if (settings.Logo != null)
3317                         {
3318                             string backgroundImage = settings.Image != null ? "background-image:url(/Admin/Public/GetImage.ashx?width=992&height=760&crop=0&Compression=75&DoNotUpscale=True&image=" + settings.Image.Path + "); background-size: cover;" : "";
3319                             settings.Logo.ImageDefault.Crop = 5;
3320                             settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width;
3321                             settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height;
3322                             <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage">
3323                                 @if (settings.Stickers != null)
3324                                 {
3325                                     if (settings.Stickers.Position != StickersListPosition.Custom)
3326                                     {
3327                                         @Render(settings.Stickers);
3328                                     }                                                        
3329                                 }
3330                                 @RenderImage(settings.Logo)
3331                             </div>
3332                         } else if (settings.Image != null)
3333                         {
3334                             <div class="flex-img image-hover__wrapper dw-mod">
3335                                 @if (settings.Stickers != null)
3336                                 {
3337                                     if (settings.Stickers.Position != StickersListPosition.Custom)
3338                                     {
3339                                         @Render(settings.Stickers);
3340                                     }                                                        
3341                                 }
3342                                 @Render(settings.Image)
3343                             </div>
3344                         }
3345                     </div>
3346                 </div>
3347     
3348                 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary))
3349                 {
3350                     <div class="grid__col-md-9">
3351                         @if (!String.IsNullOrEmpty(settings.Title))
3352                         {
3353                             <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3>
3354                         }
3355                         @if (settings.Stickers != null)
3356                         {
3357                             if (settings.Stickers.Position == StickersListPosition.Custom)
3358                             {
3359                                 @Render(settings.Stickers);
3360                             }
3361                         }
3362                         @if (!String.IsNullOrEmpty(settings.SubTitle))
3363                         {
3364                             <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>
3365                         }
3366                         @if (!String.IsNullOrEmpty(settings.Summary))
3367                         {
3368                         <p class="article__short-summary dw-mod">@settings.Summary</p>
3369                         }
3370                     </div>
3371                 }
3372             </div>
3373         </a>
3374     }
3375     
3376     @helper RenderArticleListItemSimple(ArticleListItem settings) {
3377         <a href="@settings.Link" class="u-color-inherit">
3378             <div class="grid u-color-light--bg u-no-padding dw-mod">
3379                 <div class="grid__col-md-12">
3380                     @if (!String.IsNullOrEmpty(settings.Title))
3381                     {
3382                         <div class="article-list-item__header u-truncate-text u-no-margin dw-mod">@settings.Title</div>
3383                     }
3384                     @if (!String.IsNullOrEmpty(settings.SubTitle))
3385                     {
3386                         <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>
3387                     }
3388                 </div>
3389             </div>
3390         </a>
3391     }
3392     @using System.Reflection
3393     @using Dynamicweb.Rapido.Blocks.Components.Articles
3394     
3395     
3396     @* Component for the articles *@
3397     
3398     @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings)
3399     {
3400         <small class="article__subscription">
3401             @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date)))
3402             {
3403                 <text>@Translate("Written")</text>
3404             }
3405             @if (!string.IsNullOrWhiteSpace(settings.Author))
3406             {
3407                 <text>@Translate("by") @settings.Author</text>
3408             }
3409             @if (!string.IsNullOrWhiteSpace(settings.Date))
3410             {
3411                 <text>@Translate("on") @settings.Date</text>
3412             }
3413         </small>
3414     }
3415     @using System.Reflection
3416     @using Dynamicweb.Rapido.Blocks.Components.Articles
3417     @using Dynamicweb.Rapido.Blocks.Components.General
3418     
3419     
3420     @* Component for the articles *@
3421     
3422     @helper RenderArticleLink(ArticleLink settings)
3423     {
3424         if (!string.IsNullOrEmpty(settings.Title))
3425         {
3426             Button link = new Button {
3427                 ConfirmText = settings.ConfirmText,
3428                 ConfirmTitle = settings.ConfirmTitle,
3429                 ButtonType = settings.ButtonType,
3430                 Id = settings.Id,
3431                 Title = settings.Title,
3432                 AltText = settings.AltText,
3433                 OnClick = settings.OnClick,
3434                 CssClass = settings.CssClass,
3435                 Disabled = settings.Disabled,
3436                 Icon = settings.Icon,
3437                 Name = settings.Name,
3438                 Href = settings.Href,
3439                 ButtonLayout = settings.ButtonLayout,
3440                 ExtraAttributes = settings.ExtraAttributes
3441             };
3442             <div class="grid__cell">
3443                 @Render(link)
3444             </div>
3445         }
3446     }
3447     @using System.Reflection
3448     @using Dynamicweb.Rapido.Blocks
3449     @using Dynamicweb.Rapido.Blocks.Components.Articles
3450     @using Dynamicweb.Rapido.Blocks.Components.General
3451     
3452     
3453     @* Component for the articles *@
3454     
3455     @helper RenderArticleCarousel(ArticleCarousel settings)
3456     {
3457         <div class="grid">
3458             <div class="grid__col-12">
3459                 <div class="carousel" id="carousel_@settings.Id">
3460                     <div class="carousel__container js-carousel-slides dw-mod">
3461                         @RenderBlockList(settings.SubBlocks)
3462                     </div>
3463                 </div>
3464             </div>
3465         </div>
3466     
3467         <script>
3468             document.addEventListener("DOMContentLoaded", function () {
3469                 new CarouselModule("#carousel_@settings.Id", {
3470                     slideTime: 0,
3471                     dots: true
3472                 });
3473             });
3474         </script>
3475     }
3476     
3477     @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings)
3478     {
3479         string imageEngine = "/Admin/Public/GetImage.ashx?";
3480     
3481         string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image;
3482         if (settings.ImageSettings != null)
3483         {
3484             defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : "";
3485             defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : "";
3486             defaultImage += "Crop=" + settings.ImageSettings.Crop + "&";
3487             defaultImage += "Compression=" + settings.ImageSettings.Compression + "&";
3488             defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&";
3489             defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&";
3490         }
3491         defaultImage += "&Image=" + settings.Image;
3492     
3493         <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')">
3494             <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title">
3495                 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2>
3496                 <div class="article-list__item-info">
3497                     @if (settings.Stickers != null)
3498                     {
3499                         settings.Stickers.Position = StickersListPosition.Custom;
3500                         @Render(settings.Stickers);
3501                     }
3502     
3503                     <small class="u-margin-top--lg u-color-light">
3504                         @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date)))
3505                         {
3506                         <text>@Translate("Written")</text>
3507                         }
3508                         @if (!string.IsNullOrWhiteSpace(settings.Author))
3509                         {
3510                         <text>@Translate("by") @settings.Author</text>
3511                         }
3512                         @if (!string.IsNullOrWhiteSpace(settings.Date))
3513                         {
3514                         <text>@Translate("on") @settings.Date</text>
3515                         }
3516                     </small>
3517                 </div>
3518     
3519                 <h3 class="article__short-summary u-color-light">@settings.Summary</h3>
3520             </a>
3521             @if (settings.UseFilters == true)
3522             {
3523                 <div class="background-image image-filter image-filter--darken dw-mod"></div>
3524             }
3525         </div>
3526     }
3527     @using System.Text.RegularExpressions
3528     @using Dynamicweb.Rapido.Blocks.Components
3529     @using Dynamicweb.Rapido.Blocks.Components.General
3530     @using Dynamicweb.Rapido.Blocks.Components.Articles
3531     @using Dynamicweb.Rapido.Blocks
3532     
3533     @* Component for the articles *@
3534     
3535     @helper RenderArticleVideo(ArticleVideo settings)
3536     {
3537         if (settings.Url != null)
3538         {
3539             //getting video ID from youtube URL
3540             string videoCode = settings.Url;
3541             Regex regex = new Regex(@".be\/(.[^?]*)");
3542             Match match = regex.Match(videoCode);
3543             string videoId = "";
3544             if (match.Success)
3545             {
3546                 videoId = match.Groups[1].Value;
3547             }
3548             else
3549             {
3550                 regex = new Regex(@"v=([^&]+)");
3551                 match = regex.Match(videoCode);
3552                 if (match.Success)
3553                 {
3554                     videoId = match.Groups[1].Value;
3555                 }
3556             }
3557     
3558             int autoPlay = settings.AutoPlay == "true" ? 1 : 0;
3559     
3560             <div class="video-wrapper">
3561                 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div>
3562             </div> 
3563         }
3564     }
3565     
3566     
3567     
3568     @* Simple helpers *@
3569     
3570     @*Requires the Gallery ItemType that comes with Rapido*@
3571     @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) {
3572         if (gallery != null && gallery.Count > 0)
3573         {
3574             int count = 1;
3575     
3576             foreach (var item in gallery)
3577             {
3578                 if (item.GetFile("ImagePath") != null)
3579                 {
3580                     string image = item.GetFile("ImagePath").PathUrlEncoded;
3581                     string imagePrefix = "/Admin/Public/GetImage.ashx?width=1200&height=820&crop=5&Compression=75&DoNotUpscale=1&image=";
3582                     int imagesCount = gallery.Count;
3583     
3584                     if (count == 1)
3585                     {
3586                         <label class="gallery" for="ParagraphGalleryModalTrigger" onclick="Gallery.openImage(this.querySelector('.js-gallery'))">
3587                             <span class="gallery__main-image">
3588                                 <img src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=992&height=760&crop=0&Compression=75&DoNotUpscale=1&image=@image" class="b-lazy flex-img js-gallery" alt="" data-for="ParagraphGallery" data-image="@imagePrefix@image" />
3589                             </span>
3590                             <span class="gallery__image-counter">
3591                                 <i class="fas fa-camera fa-2x"></i> <span class="gallery__image-counter__number">@imagesCount</span>
3592                                 <span class="gallery__image-counter__text">@Translate("See all") <i class="fas fa-angle-right"></i></span>
3593                             </span>
3594                         </label>
3595                     }
3596                     else
3597                     {
3598                         <div class="u-hidden js-gallery" data-for="ParagraphGallery" data-image="@imagePrefix@image"></div>
3599                     }
3600     
3601                     count++;
3602                 }
3603             }
3604     
3605             @Render(new ArticleGalleryModal())
3606         }
3607     }
3608     
3609     @helper RenderMobileFilters(List<Block> subBlocks)
3610     {
3611         if (subBlocks.Count > 0)
3612         {
3613             <div class="grid__col-12">
3614                 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" />
3615                 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters">
3616                     @RenderBlockList(subBlocks)  
3617                 </div>
3618                 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label>
3619                 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label>
3620             </div>
3621         }
3622     } 
3623     
3624     
3625     @* Include the Blocks for the page *@
3626     @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
3627     
3628     @using System
3629     @using System.Web
3630     @using System.Collections.Generic
3631     @using Dynamicweb.Rapido.Blocks.Extensibility
3632     @using Dynamicweb.Rapido.Blocks
3633     
3634     @{ 
3635         BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master");
3636     
3637         Block tagManager = new Block()
3638         {
3639             Id = "TagManager",
3640             SortId = 1,
3641             Template = RenderGoogleTagManager()
3642         };
3643     
3644         Block facebookPixel = new Block()
3645         {
3646             Id = "FacebookPixel",
3647             SortId = 2,
3648             Template = RenderFacebookPixel()
3649         };
3650     
3651         topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManager);
3652         topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel);
3653     }
3654     
3655     @helper RenderGoogleTagManager() { 
3656         string GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID");
3657     
3658         if (!string.IsNullOrWhiteSpace(GoogleTagManagerID))
3659         {
3660             <script>
3661                 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
3662                 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
3663                 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
3664                 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
3665                 })(window,document,'script','dataLayer','@GoogleTagManagerID');
3666             </script>
3667             <!-- Google Tag Manager (noscript) -->
3668             <noscript>
3669                 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID"
3670                         height="0" width="0" style="display:none;visibility:hidden"></iframe>
3671             </noscript>
3672             <!-- End Google Tag Manager (noscript) -->
3673         } 
3674     }
3675     
3676     @helper RenderFacebookPixel() {
3677         string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID");
3678     
3679         if (!string.IsNullOrWhiteSpace(FacebookPixelID))
3680         {
3681             <!-- Facebook Pixel Code -->
3682             <script>
3683               !function(f,b,e,v,n,t,s)
3684               {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
3685               n.callMethod.apply(n,arguments):n.queue.push(arguments)};
3686               if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
3687               n.queue=[];t=b.createElement(e);t.async=!0;
3688               t.src=v;s=b.getElementsByTagName(e)[0];
3689               s.parentNode.insertBefore(t,s)}(window, document,'script',
3690               'https://connect.facebook.net/en_US/fbevents.js');
3691               fbq('init', '@FacebookPixelID');
3692               fbq('track', 'PageView');
3693             </script>
3694             <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript>
3695         }
3696     } 
3697     @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
3698     
3699     @using System
3700     @using System.Web
3701     @using System.Collections.Generic
3702     @using Dynamicweb.Rapido.Blocks
3703     @using Dynamicweb.Rapido.Blocks.Extensibility
3704     @using Dynamicweb.Security.UserManagement
3705     @using Dynamicweb.Security.UserManagement.ExternalAuthentication
3706     @using Dynamicweb.Rapido.Blocks.Components.General
3707     
3708     @{
3709         BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master");
3710     
3711         Block loginModal = new Block()
3712         {
3713             Id = "LoginModal",
3714             SortId = 10,
3715             Component = new Modal
3716             {
3717                 Id = "SignIn",
3718                 Heading = new Heading
3719                 {
3720                     Level = 0,
3721                     Title = Translate("Sign in")
3722                 },
3723                 Width = ModalWidth.Xs,
3724                 BodyTemplate = RenderLoginForm()
3725             }
3726         };
3727     
3728         loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal);
3729     }
3730     
3731     @helper RenderLoginForm()
3732     {
3733         int pageId = Model.TopPage.ID;
3734         string userSignedInErrorText = "";
3735         int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
3736         string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery";
3737         int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");
3738         bool showModalOnStart = pageId != GetPageIdByNavigationTag("CustomerCenter") && Model.LogOnFailed;
3739         bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");
3740         bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink");
3741     
3742         ProviderCollection providers = Provider.GetActiveProviders();
3743     
3744         if (Model.LogOnFailed)
3745         {
3746             switch (Model.LogOnFailedReason)
3747             {
3748                 case LogOnFailedReason.PasswordLengthInvalid:
3749                     userSignedInErrorText = Translate("Password length is invalid");
3750                     break;
3751                 case LogOnFailedReason.IncorrectLogin:
3752                     userSignedInErrorText = Translate("Invalid email or password");
3753                     break;
3754                 case LogOnFailedReason.ExceededFailedLogOnLimit:
3755                     userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked");
3756                     break;
3757                 case LogOnFailedReason.LoginLocked:
3758                     userSignedInErrorText = Translate("The user account is temporarily locked");
3759                     break;
3760                 case LogOnFailedReason.PasswordExpired:
3761                     userSignedInErrorText = Translate("The password has expired and needs to be renewed");
3762                     break;
3763                 default:
3764                     userSignedInErrorText = Translate("An unknown error occured");
3765                     break;
3766             }
3767         }
3768     
3769         Form form = new Form { Method = FormMethod.Post, Name = "LoginModalForm" };
3770     
3771         form.Add(new HiddenField { Name = "ID", Value = Converter.ToString(pageId) });
3772         form.Add(new HiddenField { Name = "DWExtranetUsernameRemember", Value = "True" });
3773         form.Add(new HiddenField { Name = "DWExtranetPasswordRemember", Value = "True" });
3774         form.Add(new HiddenField { Name = "LoginAction", Value = "Login" });
3775         form.Add(new TextField { Id = "LoginUsername", Name = "username", Label = Translate("Email"), CssClass = "u-full-width", Required = true });
3776         form.Add(new TextField { Id = "LoginPassword", Name = "password", Type = TextFieldType.Password, Label = Translate("Password"), CssClass = "u-full-width", Required = true });
3777         form.Add(new NotificationMessage { Message = userSignedInErrorText, MessageType = NotificationMessageType.Error });
3778         form.Add(new CheckboxField { Id = "LoginRememberMe", Value = "True", Name = "Autologin", Label = Translate("Remember me") });
3779         form.Add(new Button { ButtonType = ButtonType.Submit, Title = Translate("Sign in"), CssClass = "btn--full", OnClick = "Buttons.LockButton(event)" });
3780     
3781         foreach (Provider LoginProvider in providers)
3782         {
3783             var ProviderName = LoginProvider.Name.ToLower();
3784             form.Add(new Link {
3785                 Href = "/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=" + LoginProvider.ID,
3786                 Icon = new Icon { Prefix = "fab", Name = "fa-" + ProviderName, CssClass = "fa-1_5x", LabelPosition = IconLabelPosition.After },
3787                 ButtonLayout = ButtonLayout.LinkClean,
3788                 CssClass = "btn--condensed u-margin-bottom u-margin-right u-inline-block u-color-" + ProviderName,
3789                 AltText = ProviderName
3790             });
3791         }
3792     
3793         if (!hideCreateAccountLink) {
3794             form.Add(new Link { Href = "/default.aspx?ID=" + createAccountPageId, Title = Translate("Create account?"), ButtonLayout = ButtonLayout.None, CssClass = "u-block u-padding-bottom" });
3795         }
3796     
3797         if (!hideForgotPasswordLink) {
3798             form.Add(new Link { Href = forgotPasswordPageLink, Title = Translate("Forgot your password?"), ButtonLayout = ButtonLayout.None, CssClass = "u-block u-padding-bottom" });
3799         }
3800     
3801         @Render(form)
3802     
3803         if (showModalOnStart)
3804         {
3805             <script>
3806                 document.getElementById("SignInModalTrigger").checked = true;
3807             </script>
3808         }
3809     }
3810     
3811     @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet")
3812     {
3813         <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
3814     
3815     @using System
3816     @using System.Web
3817     @using System.Collections.Generic
3818     @using Dynamicweb.Rapido.Blocks.Extensibility
3819     @using Dynamicweb.Rapido.Blocks
3820     @using Dynamicweb.Rapido.Services
3821     
3822     
3823     @functions {
3824         BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master");
3825     }
3826     
3827     @{ 
3828         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";
3829         bool mobileHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");
3830         bool mobileHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart") || !Dynamicweb.Rapido.Services.User.IsBuyingAllowed();
3831     
3832         Block mobileHeader = new Block()
3833         {
3834             Id = "MobileTop",
3835             SortId = 10,
3836             Template = RenderMobileTop(),
3837             SkipRenderBlocksList = true
3838         };
3839         mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader);
3840     
3841         Block mobileHeaderNavigation = new Block()
3842         {
3843             Id = "MobileHeaderNavigation",
3844             SortId = 10,
3845             Template = RenderMobileHeaderNavigation(),
3846             SkipRenderBlocksList = true,
3847             BlocksList = new List<Block> {
3848                 new Block {
3849                     Id = "MobileHeaderNavigationTrigger",
3850                     SortId = 10,
3851                     Template = RenderMobileHeaderNavigationTrigger()
3852                 }
3853             }
3854         };
3855         mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation);
3856     
3857         Block mobileHeaderLogo = new Block()
3858         {
3859             Id = "MobileHeaderLogo",
3860             SortId = 20,
3861             Template = RenderMobileHeaderLogo(),
3862             SkipRenderBlocksList = true
3863         };
3864         mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo);
3865     
3866         Block mobileHeaderActions = new Block()
3867         {
3868             Id = "MobileHeaderActions",
3869             SortId = 30,
3870             Template = RenderMobileTopActions(),
3871             SkipRenderBlocksList = true
3872         };
3873         mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions);
3874     
3875         if (!mobileHideSearch)
3876         {
3877             Block mobileHeaderSearch = new Block
3878             {
3879                 Id = "MobileHeaderSearch",
3880                 SortId = 10,
3881                 Template = RenderMobileTopSearch()
3882             };
3883             mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch);
3884         }
3885     
3886         Block mobileHeaderMiniCart;
3887     
3888         if (!mobileHideCart)
3889         {
3890             mobileHeaderMiniCart = new Block
3891             {
3892                 Id = "MobileHeaderMiniCart",
3893                 SortId = 20,
3894                 Template = RenderMobileTopMiniCart()
3895             };
3896     
3897             Block miniCartCounterScriptTemplate = new Block
3898             {
3899                 Id = "MiniCartCounterScriptTemplate",
3900                 Template = RenderMobileMiniCartCounterContent()
3901             };
3902             BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate);
3903         }
3904         else
3905         {
3906             mobileHeaderMiniCart = new Block
3907             {
3908                 Id = "MobileHeaderMiniCart",
3909                 SortId = 20
3910             };
3911         }
3912     
3913         if (!mobileHideSearch)
3914         {
3915             Block mobileHeaderSearchBar = new Block()
3916             {
3917                 Id = "MobileHeaderSearchBar",
3918                 SortId = 30,
3919                 Template = RenderMobileTopSearchBar()
3920             };
3921             mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar);
3922         }
3923     
3924         switch (mobileTopLayout)
3925         {
3926             case "nav-left":
3927                 mobileHeaderNavigation.SortId = 10;
3928                 mobileHeaderLogo.SortId = 20;
3929                 mobileHeaderActions.SortId = 30;
3930                 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart);
3931                 break;
3932             case "nav-right":
3933                 mobileHeaderLogo.SortId = 10;
3934                 mobileHeaderActions.SortId = 20;
3935                 mobileHeaderNavigation.SortId = 30;
3936                 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart);
3937                 break;
3938             case "nav-search-left":
3939                 mobileHeaderNavigation.SortId = 10;
3940                 mobileHeaderLogo.SortId = 20;
3941                 mobileHeaderActions.SortId = 30;
3942                 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart);
3943                 break;
3944             case "search-left":
3945                 mobileHeaderActions.SortId = 10;
3946                 mobileHeaderLogo.SortId = 20;
3947                 mobileHeaderNavigation.SortId = 30;
3948                 mobileHeaderMiniCart.SortId = 0;
3949                 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart);
3950                 break;
3951         }
3952         if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed())
3953         {
3954             BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block {
3955                 Id = "CartInitialization",
3956                 Template = RenderMobileCartInitialization()
3957             });
3958         }
3959     }
3960     
3961     
3962     @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
3963     
3964     @using System
3965     @using System.Web
3966     @using Dynamicweb.Rapido.Blocks.Extensibility
3967     @using Dynamicweb.Rapido.Blocks
3968     
3969     @{
3970         BlocksPage customMobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master");
3971     }
3972     
3973     
3974     
3975     @helper RenderMobileCartInitialization()
3976     {
3977         int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
3978         <script>
3979             window.cartId = "@miniCartFeedPageId";
3980         </script>
3981     }
3982     
3983     @helper RenderMobileTop() { 
3984         List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList();
3985     
3986         <nav class="main-navigation-mobile dw-mod">
3987             <div class="center-container top-container__center-container dw-mod">
3988                 <div class="grid grid--align-center">
3989                     @RenderBlockList(subBlocks)
3990                 </div>
3991             </div>
3992         </nav>
3993     }
3994     
3995     @helper RenderMobileHeaderNavigation() {  
3996         List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList();
3997     
3998         <div class="grid__col-auto-width">
3999             <ul class="menu dw-mod">
4000                 @RenderBlockList(subBlocks)
4001             </ul>
4002         </div>
4003     }
4004     
4005     @helper RenderMobileHeaderNavigationTrigger() {
4006         <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">
4007             <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label>
4008         </li>
4009     }
4010     
4011     @helper RenderMobileHeaderLogo() {
4012         List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList();
4013     
4014         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";
4015         string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : "";
4016         string firstPageId = Model.Area.FirstActivePage.ID.ToString();
4017         string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName");
4018     
4019         string mobileLogo = "/Files/Images/logo-dynamicweb.png";
4020         if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null)
4021         {
4022             mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded;
4023         }
4024     
4025         if (Path.GetExtension(mobileLogo).ToLower() != ".svg")
4026         {
4027     		mobileLogo = "/Admin/Public/GetImage.ashx?height=40&width=100&crop=5&Compression=75&image=" + mobileLogo;
4028     //mobileLogo = "/Admin/Public/GetImage.ashx?height=60&width=100&crop=5&Compression=75&image=" + mobileLogo;
4029         }
4030         else
4031         {
4032             mobileLogo = HttpUtility.UrlDecode(mobileLogo);
4033         }
4034     
4035         <div class="grid__col-auto grid__col--bleed">
4036             <div class="grid__cell @centeredLogo">
4037                 <a href="/Default.aspx?ID=@firstPageId" class="logo logo--mobile u-inline-block dw-mod">
4038                     <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" />
4039                 </a>
4040             </div>
4041     
4042             @RenderBlockList(subBlocks)
4043         </div>
4044     }
4045     
4046     @helper RenderMobileTopActions() {  
4047         List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList();
4048     
4049         <div class="grid__col-auto-width">
4050             <ul class="menu dw-mod">
4051                 @RenderBlockList(subBlocks)
4052             </ul>
4053         </div>
4054     }
4055     
4056     @helper RenderMobileTopSearch() {
4057         <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">
4058             <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod">
4059                 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i>
4060             </label>
4061         </li>
4062     }
4063     
4064     @helper RenderMobileTopMiniCart() {
4065         int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
4066         int cartPageId = GetPageIdByNavigationTag("CartPage");
4067         double cartProductsCount = Model.Cart.TotalProductsCount;
4068     
4069         <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper">
4070             <div class="mini-cart dw-mod">
4071                 <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">
4072                     <div class="u-inline u-position-relative">
4073                         <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue  fa-1_5x"></i>
4074                         <div class="mini-cart__counter dw-mod">
4075                             <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">
4076                                 <div class="js-mini-cart-counter-content" data-count="@cartProductsCount">
4077                                     @cartProductsCount
4078                                 </div>
4079                             </div>
4080                         </div>
4081                     </div>
4082                 </a>
4083             </div>
4084         </li>
4085     }  
4086     
4087     @helper RenderMobileTopSearchBar()
4088     {
4089         string searchFeedId = "";
4090         string searchSecondFeedId = "";
4091         int groupsFeedId;
4092         int productsPageId = GetPageIdByNavigationTag("ProductsPage");
4093         string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;
4094         string resultPageLink;
4095         string searchPlaceholder;
4096         string searchType = "product-search";
4097         string searchTemplate;
4098         string searchContentTemplate = "";
4099         string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? "";
4100         bool showGroups = true;
4101     
4102         if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch")
4103         {
4104             searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true";
4105             resultPageLink = contentSearchPageLink;
4106             searchPlaceholder = Translate("Search page");
4107             groupsFeedId = 0;
4108             searchType = "content-search";
4109             searchTemplate = "SearchPagesTemplate";
4110             showGroups = false;
4111         }
4112         else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch")
4113         {
4114             searchFeedId = productsPageId + "&feed=true";
4115             searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true";
4116             resultPageLink = Converter.ToString(productsPageId);
4117             searchPlaceholder = Translate("Search products or pages");
4118             groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed");
4119             searchType = "combined-search";
4120             searchTemplate = "SearchProductsTemplateWrap";
4121             searchContentTemplate = "SearchPagesTemplateWrap";
4122             showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector");
4123         }
4124         else
4125         {
4126             resultPageLink = Converter.ToString(productsPageId);
4127             searchFeedId = productsPageId + "&feed=true";
4128             groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed");
4129             searchPlaceholder = Translate("Search products");
4130             searchTemplate = "SearchProductsTemplate";
4131             searchType = "product-search";
4132             showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector");
4133         }
4134     
4135         <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" />
4136     
4137         <div class="main-navigation-mobile typeahead-mobile dw-mod">
4138             <div class="center-container top-container__center-container dw-mod">
4139                 <div class="grid">
4140                     <div class="grid__col-auto">
4141                        <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">
4142                             <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue">
4143                             @if (string.IsNullOrEmpty(searchSecondFeedId))
4144                             {
4145                                 <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>
4146                             }
4147                             else
4148                             {
4149                                 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid">
4150                                     <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>
4151                                     <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>
4152                                 </div>
4153                             }
4154                             <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>
4155                         </div>
4156                     </div>
4157                     <div class="grid__col-auto-width">
4158                         <ul class="menu dw-mod">
4159                             <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">
4160                                 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod">
4161                                     <i class="fas fa-times fa-1_5x"></i>
4162                                 </label>
4163                             </li>
4164                         </ul>
4165                      </div>
4166                 </div>
4167             </div>
4168         </div>
4169     } 
4170     
4171     @helper RenderMobileMiniCartCounterContent()
4172     {
4173         <script id="MiniCartCounterContent" type="text/x-template">
4174             {{#.}}
4175                 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}">
4176                     {{numberofproducts}}
4177                 </div>
4178             {{/.}}
4179         </script>
4180     }
4181     </text>
4182         <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4183     
4184     @using System
4185     @using System.Web
4186     @using System.Collections.Generic
4187     @using Dynamicweb.Rapido.Blocks.Extensibility
4188     @using Dynamicweb.Rapido.Blocks
4189     
4190     @functions {
4191         BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master");
4192     }
4193     
4194     @{
4195         bool mobileNavigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn");
4196         bool mobileHideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");
4197         bool mobileHideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile");
4198         bool mobileHideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders");
4199         bool mobileHideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards");
4200         bool mobileHideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites");
4201     
4202         Block mobileNavigation = new Block()
4203         {
4204             Id = "MobileNavigation",
4205             SortId = 10,
4206             Template = MobileNavigation(),
4207             SkipRenderBlocksList = true
4208         };
4209         mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation);
4210     
4211         if (Model.CurrentUser.ID > 0 && !mobileHideMyProfileLink)
4212         {
4213             Block mobileNavigationSignIn = new Block
4214             {
4215                 Id = "MobileNavigationSignIn",
4216                 SortId = 10,
4217                 Template = RenderMobileNavigationSignIn()
4218             };
4219             mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn);
4220         }
4221     
4222         Block mobileNavigationMenu = new Block
4223         {
4224             Id = "MobileNavigationMenu",
4225             SortId = 20,
4226             Template = RenderMobileNavigationMenu()
4227         };
4228         mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu);
4229     
4230         Block mobileNavigationActions = new Block
4231         {
4232             Id = "MobileNavigationActions",
4233             SortId = 30,
4234             Template = RenderMobileNavigationActions(),
4235             SkipRenderBlocksList = true
4236         };
4237         mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions);
4238     
4239         if (!mobileNavigationItemsHideSignIn)
4240         {
4241             if (Model.CurrentUser.ID <= 0)
4242             {
4243                 Block mobileNavigationSignInAction = new Block
4244                 {
4245                     Id = "MobileNavigationSignInAction",
4246                     SortId = 10,
4247                     Template = RenderMobileNavigationSignInAction()
4248                 };
4249                 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction);
4250     
4251                 if (!mobileHideCreateAccountLink)
4252                 {
4253                     Block mobileNavigationCreateAccountAction = new Block
4254                     {
4255                         Id = "MobileNavigationCreateAccountAction",
4256                         SortId = 20,
4257                         Template = RenderMobileNavigationCreateAccountAction()
4258                     };
4259                     mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction);
4260                 }
4261             }
4262             else
4263             {
4264                 if (!mobileHideMyOrdersLink)
4265                 {
4266                     Block mobileNavigationOrdersAction = new Block
4267                     {
4268                         Id = "MobileNavigationOrdersAction",
4269                         SortId = 20,
4270                         Template = RenderMobileNavigationOrdersAction()
4271                     };
4272                     mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction);
4273                 }
4274                 if (!mobileHideMyFavoritesLink)
4275                 {
4276                     Block mobileNavigationFavoritesAction = new Block
4277                     {
4278                         Id = "MobileNavigationFavoritesAction",
4279                         SortId = 30,
4280                         Template = RenderMobileNavigationFavoritesAction()
4281                     };
4282                     mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction);
4283                 }
4284                 if (!mobileHideMySavedCardsLink)
4285                 {
4286                     Block mobileNavigationSavedCardsAction = new Block
4287                     {
4288                         Id = "MobileNavigationFavoritesAction",
4289                         SortId = 30,
4290                         Template = RenderMobileNavigationSavedCardsAction()
4291                     };
4292                     mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction);
4293                 }
4294     
4295                 Block mobileNavigationSignOutAction = new Block
4296                 {
4297                     Id = "MobileNavigationSignOutAction",
4298                     SortId = 40,
4299                     Template = RenderMobileNavigationSignOutAction()
4300                 };
4301                 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction);
4302             }
4303         }
4304     
4305         if (Model.Languages.Count > 1)
4306         {
4307             Block mobileNavigationLanguagesAction = new Block
4308             {
4309                 Id = "MobileNavigationLanguagesAction",
4310                 SortId = 50,
4311                 Template = RenderMobileNavigationLanguagesAction()
4312             };
4313             mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction);
4314         }
4315     }
4316     
4317     
4318     @helper MobileNavigation()
4319     {
4320         List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList();
4321         string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left";
4322         string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right";
4323     
4324         <!-- Trigger for mobile navigation -->
4325         <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" />
4326     
4327         <!-- Mobile navigation -->
4328         <nav class="mobile-navigation mobile-navigation--@position dw-mod">
4329             <div class="mobile-navigation__wrapper" id="mobileNavigationWrapper">
4330                 @RenderBlockList(subBlocks)
4331             </div>
4332         </nav>
4333     
4334         <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label>
4335     }
4336     
4337     @helper RenderMobileNavigationSignIn()
4338     {
4339         int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4340         int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");
4341         string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
4342         string myProfilePageLink = linkStart + myProfilePageId;
4343         string userName = Model.CurrentUser.FirstName ?? "";
4344         userName += " " + (Model.CurrentUser.LastName ?? "");
4345         userName += userName == "" && Model.CurrentUser.UserName != null ? Model.CurrentUser.UserName : "";
4346     
4347         <ul class="menu menu-mobile">
4348             <li class="menu-mobile__item">
4349                 <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>
4350             </li>
4351         </ul>
4352     }
4353     
4354     @helper RenderMobileNavigationMenu()
4355     {
4356         bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides";
4357         string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt";
4358         string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3";
4359         bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");
4360         int startLevel = renderPagesInToolBar ? 1 : 0;
4361     
4362         @RenderNavigation(new
4363         {
4364             id = "mobilenavigation",
4365             cssclass = "menu menu-mobile dwnavigation",
4366             startLevel = @startLevel,
4367             ecomStartLevel = @startLevel + 1,
4368             endlevel = @levels,
4369             expandmode = "all",
4370             template = @menuTemplate
4371         })
4372     
4373         if (isSlidesDesign) 
4374         {
4375             <script>
4376                 function goToLevel(level) {
                document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%";
            }
4377     
4378                 document.addEventListener('DOMContentLoaded', function () {
4379                     goToLevel(document.getElementById('mobileNavigationWrapper').querySelectorAll('input[type=radio]:checked').length);
4380                 });
4381             </script>
4382         }
4383     
4384         if (renderPagesInToolBar)
4385         {
4386             @RenderNavigation(new
4387             {
4388                 id = "topToolsMobileNavigation",
4389                 cssclass = "menu menu-mobile dwnavigation",
4390                 template = "ToolsMenuForMobile.xslt"
4391             })
4392         }
4393     }
4394     
4395     @helper RenderMobileNavigationActions()
4396     {
4397         List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ;
4398     
4399         <ul class="menu menu-mobile">
4400             @RenderBlockList(subBlocks)
4401         </ul>
4402     }
4403     
4404     @helper RenderMobileNavigationSignInAction()
4405     {
4406         <li class="menu-mobile__item">
4407             <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>
4408         </li>
4409     }
4410     
4411     @helper RenderMobileNavigationCreateAccountAction()
4412     {
4413         int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");
4414     
4415         <li class="menu-mobile__item">
4416             <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>
4417         </li>
4418     }
4419     
4420     @helper RenderMobileNavigationProfileAction()
4421     {
4422         int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4423         string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
4424         int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");
4425         string myProfilePageLink = linkStart + myProfilePageId;
4426     
4427         <li class="menu-mobile__item">
4428             <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>
4429         </li>
4430     }
4431     
4432     @helper RenderMobileNavigationOrdersAction()
4433     {
4434         int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4435         string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
4436         int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders");
4437         string myOrdersPageLink = linkStart + myOrdersPageId;
4438         string ordersIcon = "fas fa-list";
4439     
4440         <li class="menu-mobile__item">
4441             <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>
4442         </li>
4443     }
4444     
4445     @helper RenderMobileNavigationFavoritesAction()
4446     {
4447         int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4448         string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
4449         int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");
4450         string myFavoritesPageLink = linkStart + myFavoritesPageId;
4451         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";
4452     
4453     
4454         <li class="menu-mobile__item">
4455             <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>
4456         </li>
4457     }
4458     
4459     @helper RenderMobileNavigationSavedCardsAction()
4460     {
4461         int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4462         string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
4463         int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards");
4464         string mySavedCardsPageLink = linkStart + mySavedCardsPageId;
4465         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";
4466     
4467         <li class="menu-mobile__item">
4468             <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>
4469         </li>
4470     }
4471     
4472     @helper RenderMobileNavigationSignOutAction()
4473     {
4474         int pageId = Model.TopPage.ID;
4475         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";
4476     
4477         <li class="menu-mobile__item">
4478             <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>
4479         </li>
4480     }
4481     
4482     @helper RenderMobileNavigationLanguagesAction()
4483     {
4484         bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides";
4485     
4486         string selectedLanguage = "";
4487         foreach (var lang in Model.Languages)
4488         {
4489             if (lang.IsCurrent)
4490             {
4491                 selectedLanguage = lang.Name;
4492             }
4493         }
4494     
4495         <li class="menu-mobile__item dw-mod">
4496             @if (isSlidesDesign)
4497             {
4498                 <input id="MobileMenuCheck_Language" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(1);">
4499             }
4500             else
4501             {
4502                 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger">
4503             }
4504             <div class="menu-mobile__link__wrap">
4505                 <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>
4506                 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label>
4507             </div>
4508             <ul class="menu-mobile menu-mobile__submenu expand-menu">
4509                 @if (isSlidesDesign)
4510                 {
4511                     <li class="menu-mobile__item dw-mod">
4512                         <div class="menu-mobile__link__wrap">
4513                             <input id="MobileMenuCheck_Language_back" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(0);" />
4514                             <label for="MobileMenuCheck_Language_back" class="menu-mobile__trigger menu-mobile__trigger--back"></label>
4515                             <label for="MobileMenuCheck_Language_back" class="menu-mobile__link dw-mod ">@Translate("Back")</label>
4516                         </div>
4517                     </li>
4518                 }
4519                 @foreach (var lang in Model.Languages)
4520                 {
4521                     <li class="menu-mobile__item dw-mod">
4522                         <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>
4523                     </li>
4524                 }
4525             </ul>
4526         </li>
4527     }</text>
4528     }
4529     else
4530     {
4531         <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4532     
4533     @using System
4534     @using System.Web
4535     @using System.Collections.Generic
4536     @using Dynamicweb.Rapido.Blocks.Extensibility
4537     @using Dynamicweb.Rapido.Blocks
4538     
4539     @functions {
4540         BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master");
4541     }
4542     
4543     @{
4544         Block masterTools = new Block()
4545         {
4546             Id = "MasterDesktopTools",
4547             SortId = 10,
4548             Template = RenderDesktopTools(),
4549             SkipRenderBlocksList = true,
4550             BlocksList = new List<Block>
4551             {
4552                 new Block {
4553                     Id = "MasterDesktopToolsText",
4554                     SortId = 10,
4555                     Template = RenderDesktopToolsText(),
4556                     Design = new Design
4557                     {
4558                         Size = "auto",
4559                         HidePadding = true,
4560                         RenderType = RenderType.Column
4561                     }
4562                 },
4563                 new Block {
4564                     Id = "MasterDesktopToolsNavigation",
4565                     SortId = 20,
4566                     Template = RenderDesktopToolsNavigation(),
4567                     Design = new Design
4568                     {
4569                         Size = "auto-width",
4570                         HidePadding = true,
4571                         RenderType = RenderType.Column
4572                     }
4573                 }
4574             }
4575         };
4576         headerBlocksPage.Add("MasterHeader", masterTools);
4577     
4578         Block masterDesktopExtra = new Block()
4579         {
4580             Id = "MasterDesktopExtra",
4581             SortId = 10,
4582             Template = RenderDesktopExtra(),
4583             SkipRenderBlocksList = true
4584         };
4585         headerBlocksPage.Add("MasterHeader", masterDesktopExtra);
4586     
4587         Block masterDesktopNavigation = new Block()
4588         {
4589             Id = "MasterDesktopNavigation",
4590             SortId = 20,
4591             Template = RenderDesktopNavigation(),
4592             SkipRenderBlocksList = true
4593         };
4594         headerBlocksPage.Add("MasterHeader", masterDesktopNavigation);
4595     }
4596     
4597     @* Include the Blocks for the page *@
4598     @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4599     
4600     @using System
4601     @using System.Web
4602     @using Dynamicweb.Rapido.Blocks.Extensibility
4603     @using Dynamicweb.Rapido.Blocks
4604     
4605     @{
4606         Block masterDesktopLogo = new Block
4607         {
4608             Id = "MasterDesktopLogo",
4609             SortId = 10,
4610             Template = RenderDesktopLogo(),
4611             Design = new Design
4612             {
4613                 Size = "auto-width",
4614                 HidePadding = true,
4615                 RenderType = RenderType.Column,
4616                 CssClass = "grid--align-self-center"
4617             }
4618         };
4619     
4620         BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo);
4621     }
4622     
4623     
4624     @helper RenderDesktopLogo()
4625     {
4626         string firstPageId = Model.Area.FirstActivePage.ID.ToString();
4627         string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4628         string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : "";
4629         string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png";
4630         if (Path.GetExtension(logo).ToLower() != ".svg")
4631         {
4632             int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight");
4633             logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40;
4634             logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&crop=5&Compression=75&image=" + logo;
4635         }
4636         else
4637         {
4638             logo = HttpUtility.UrlDecode(logo);
4639         }
4640     
4641         <div class="logo @alignClass dw-mod">
4642             <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block">
4643                 <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" />
4644             </a>
4645         </div>
4646     }
4647     @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4648     
4649     @using System
4650     @using System.Web
4651     @using Dynamicweb.Rapido.Blocks.Extensibility
4652     @using Dynamicweb.Rapido.Blocks
4653     
4654     @functions { 
4655         bool isMegaMenu;
4656     }
4657     
4658     @{
4659         isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false;
4660         Block masterDesktopMenu = new Block
4661         {
4662             Id = "MasterDesktopMenu",
4663             SortId = 10,
4664             Template = RenderDesktopMenu(),
4665             Design = new Design
4666             {
4667                 Size = "auto",
4668                 HidePadding = true,
4669                 RenderType = RenderType.Column
4670             }
4671         };
4672     
4673         if (isMegaMenu)
4674         {
4675             masterDesktopMenu.Design.CssClass = "u-reset-position";
4676         }
4677     
4678         BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu);
4679     }
4680     
4681     @helper RenderDesktopMenu()
4682     {
4683         string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4684         string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : "";
4685         string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : "";
4686         bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");
4687         bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders");
4688         int startLevel = renderPagesInToolBar ? 1 : 0; 
4689            
4690         string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink");
4691     
4692         <div class="grid__cell u-flex @(isMegaMenu ? "u-reset-position" : "") @menuAlignment">
4693             @if (!isMegaMenu)
4694             {
4695                 @RenderNavigation(new
4696                 {
4697                     id = "topnavigation",
4698                     cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap",
4699                     startLevel = startLevel,
4700                     ecomStartLevel = startLevel + 1,
4701                     endlevel = 5,
4702                     expandmode = "all",
4703                     template = "BaseMenuWithDropdown.xslt"
4704                 });
4705             }
4706             else
4707             {
4708                 @RenderNavigation(new
4709                 {
4710                     id = "topnavigation",
4711                     cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap",
4712                     startLevel = startLevel,
4713                     ecomStartLevel = startLevel + 1,
4714                     endlevel = 5,
4715                     promotionImage = megamenuPromotionImage,
4716                     promotionLink = promotionLink,
4717                     expandmode = "all",
4718                     showOnlyHeaders = showOnlyHeaders.ToString().ToLower(),
4719                     template = "BaseMegaMenu.xslt"
4720                 });
4721             }
4722         </div>
4723     }
4724     @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4725     
4726     @using System
4727     @using System.Web
4728     @using Dynamicweb.Rapido.Blocks.Extensibility
4729     @using Dynamicweb.Rapido.Blocks
4730     
4731     @{
4732         Block masterDesktopActionsMenu = new Block
4733         {
4734             Id = "MasterDesktopActionsMenu",
4735             SortId = 10,
4736             Template = RenderDesktopActionsMenu(),
4737             Design = new Design
4738             {
4739                 CssClass = "u-flex"
4740             },
4741             SkipRenderBlocksList = true
4742     
4743         };
4744         BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu);
4745     
4746         if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink")))
4747         {
4748             Block masterDesktopActionsHeaderButton = new Block
4749             {
4750                 Id = "MasterDesktopActionsHeaderButton",
4751                 SortId = 60,
4752                 Template = RenderHeaderButton()
4753             };
4754             masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton);
4755         }
4756     }
4757     
4758     @helper RenderDesktopActionsMenu()
4759     {
4760         List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList();
4761     
4762         <ul class="menu u-flex dw-mod">
4763             @RenderBlockList(subBlocks)
4764         </ul>
4765     }
4766     
4767     @helper RenderHeaderButton()
4768     {
4769         string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText");
4770         string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink");
4771         string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : "";
4772     
4773         <li class="menu__item menu__item--horizontal menu--clean dw-mod">
4774             <a class="btn @headerButtonType dw-mod u-no-margin u-margin-top u-margin-left" href="@headerButtonLink">@headerButtonText</a>
4775         </li>
4776     }
4777     @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4778     
4779     @using System
4780     @using System.Web
4781     @using Dynamicweb.Core;
4782     @using System.Text.RegularExpressions
4783     @using Dynamicweb.Rapido.Blocks.Extensibility
4784     @using Dynamicweb.Rapido.Blocks
4785     
4786     @{
4787         Block masterDesktopActionsMenuLanguageSelector = new Block
4788         {
4789             Id = "MasterDesktopActionsMenuLanguageSelector",
4790             SortId = 40,
4791             Template = RenderLanguageSelector()
4792         };
4793     
4794         BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector);
4795     }
4796     
4797     @helper RenderLanguageSelector()
4798     {
4799         string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4800         string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
4801         string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
4802         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() : "";
4803     
4804         if (Model.Languages.Count > 1)
4805         {
4806             <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod">
4807                 <div class="@menuLinkClass dw-mod" title="@Translate("Language")">
4808                     <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i>
4809                 </div>
4810                 <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell">
4811                     @foreach (var lang in Model.Languages)
4812                     {
4813                         string widthClass = "menu__item--fixed-width";
4814                         string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name;
4815                         string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty);
4816                         cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1);
4817     
4818                         if (languageViewType == "flag-culture")
4819                         {
4820                             langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span> " + cultureName;
4821                         }
4822     
4823                         if (languageViewType == "flag")
4824                         {
4825                             langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span>";
4826                             widthClass = "";
4827                         }
4828     
4829                         if (languageViewType == "name")
4830                         {
4831                             langInfo = lang.Name;
4832                         }
4833     
4834                         if (languageViewType == "culture")
4835                         {
4836                             langInfo = cultureName;
4837                             widthClass = "";
4838                         }
4839     
4840                         <div class="menu__item dw-mod @widthClass">
4841                             <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__link dw-mod">@langInfo</a>
4842                         </div>
4843                     }
4844                 </div>
4845             </li>
4846         }
4847     }
4848     @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4849     
4850     @using System
4851     @using System.Web
4852     @using Dynamicweb.Rapido.Blocks.Extensibility
4853     @using Dynamicweb.Rapido.Blocks
4854     
4855     @{
4856         Block masterDesktopActionsMenuSignIn = new Block
4857         {
4858             Id = "MasterDesktopActionsMenuSignIn",
4859             SortId = 20,
4860             Template = RenderSignIn()
4861         };
4862     
4863         BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuSignIn);
4864     }
4865     
4866     @helper RenderSignIn()
4867     {
4868         bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn");
4869         string userInitials = "";
4870         int pageId = Model.TopPage.ID;
4871         int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");
4872         int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard");
4873         int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");
4874         int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders");
4875         int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");
4876         int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards");
4877         int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4878         bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");
4879         bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile");
4880         bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders");
4881         bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards");
4882         bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites");
4883         bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink");
4884     
4885         string linkStart = "/Default.aspx?ID=";
4886         if (Model.CurrentUser.ID <= 0)
4887         {
4888             linkStart += signInProfilePageId + "&RedirectPageId=";
4889         }
4890     
4891         string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery";
4892         string myProfilePageLink = linkStart + myProfilePageId;
4893         string myOrdersPageLink = linkStart + myOrdersPageId;
4894         string myFavoritesPageLink = linkStart + myFavoritesPageId;
4895         string mySavedCardsPageLink = linkStart + mySavedCardsPageId;
4896     
4897         string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user";
4898         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";
4899     
4900         if (Model.CurrentUser.ID != 0)
4901         {
4902             userInitials = Dynamicweb.Rapido.Services.User.GetInitials(Model.CurrentUser.Name, Model.CurrentUser.FirstName, Model.CurrentUser.LastName, Model.CurrentUser.Email, Model.CurrentUser.UserName);
4903         }
4904     
4905         if (!navigationItemsHideSignIn)
4906         {
4907             string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4908             string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean";
4909             string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
4910     
4911             <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod">
4912                 <div class="@menuLinkClass dw-mod">
4913                     @if (Model.CurrentUser.ID <= 0)
4914                     {
4915                         <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x" title="@Translate("Sign in")"></i>
4916                     }
4917                     else
4918                     {
4919                         <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit" title="@Translate("Customer center")"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a>
4920                     }
4921                 </div>
4922                 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod">
4923                     <ul class="list list--clean dw-mod">
4924                         @if (Model.CurrentUser.ID <= 0)
4925                         {
4926                             <li>
4927                                 <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>
4928                             </li>
4929     
4930                             if (!hideCreateAccountLink)
4931                             {
4932                                 @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account"));
4933                             }
4934                             if (!hideForgotPasswordLink)
4935                             {
4936                                 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?"))
4937                             }
4938                             if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink)
4939                             {
4940                                 @RenderSeparator()
4941                             }
4942                         }
4943                         @if (!hideMyProfileLink)
4944                         {
4945                             @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon)
4946                         }
4947                         @if (!hideMyOrdersLink)
4948                         {
4949                             @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list")
4950                         }
4951                         @if (!hideMyFavoritesLink)
4952                         {
4953                             @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon)
4954                         }
4955                         @if (!hideMySavedCardsLink)
4956                         {
4957                             @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card")
4958                         }
4959                         @if (Model.CurrentUser.ID > 0)
4960                         {
4961                             if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink)
4962                             {
4963                                 @RenderSeparator()
4964                             }
4965     
4966                             @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out"))
4967                         }
4968                     </ul>
4969                 </div>
4970             </li>
4971         }
4972     }
4973     
4974     @helper RenderListItem(string link, string text, string icon = null) {
4975         <li>
4976             <a href="@link" class="list__link dw-mod">
4977                 @if (!string.IsNullOrEmpty(icon)){<i class="@icon u-margin-right"></i>}@text
4978             </a>
4979         </li>
4980     }
4981     
4982     @helper RenderSeparator() 
4983     {
4984         <li class="list__seperator dw-mod"></li>
4985     }
4986     @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4987     
4988     @using System
4989     @using System.Web
4990     @using Dynamicweb.Rapido.Blocks.Extensibility
4991     @using Dynamicweb.Rapido.Blocks
4992     
4993     @{
4994         bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites");
4995     
4996         Block masterDesktopActionsMenuFavorites = new Block
4997         {
4998             Id = "MasterDesktopActionsMenuFavorites",
4999             SortId = 30,
5000             Template = RenderFavorites()
5001         };
5002     
5003         if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0)
5004         {
5005             BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites);
5006         }
5007     }
5008     
5009     @helper RenderFavorites()
5010     {
5011         int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");
5012         string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId;
5013     
5014         string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5015         string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
5016         string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5017     
5018         <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod">
5019             <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod" title="@Translate("Favorites")">
5020                 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i>
5021             </a>
5022         </li>
5023     }
5024     @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5025     
5026     @using System
5027     @using System.Web
5028     @using Dynamicweb.Rapido.Blocks.Extensibility
5029     @using Dynamicweb.Rapido.Blocks
5030     @using Dynamicweb.Rapido.Services
5031     
5032     @{
5033         bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart");
5034         string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown";
5035     
5036         if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !hideCart)
5037         {
5038             Block masterDesktopActionsMenuMiniCart = new Block
5039             {
5040                 Id = "MasterDesktopActionsMenuMiniCart",
5041                 SortId = 50,
5042                 Template = RenderMiniCart(miniCartLayout == "dropdown"),
5043                 SkipRenderBlocksList = true,
5044                 BlocksList = new List<Block>()
5045             };
5046     
5047             Block miniCartCounterScriptTemplate = new Block
5048             {
5049                 Id = "MiniCartCounterScriptTemplate",
5050                 Template = RenderMiniCartCounterContent()
5051             };
5052     
5053             //dropdown layout is default
5054             RazorEngine.Templating.TemplateWriter layoutTemplate;
5055             RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate;
5056     
5057             switch (miniCartLayout)
5058             {
5059                 case "dropdown":
5060                     layoutTemplate = RenderMiniCartDropdownLayout();
5061                     miniCartTriggerTemplate = RenderMiniCartTriggerLink();
5062                     break;
5063                 case "panel":
5064                     layoutTemplate = RenderMiniCartPanelLayout();
5065                     miniCartTriggerTemplate = RenderMiniCartTriggerLabel();
5066                     break;
5067                 case "modal":
5068                     layoutTemplate = RenderMiniCartModalLayout();
5069                     miniCartTriggerTemplate = RenderMiniCartTriggerLabel();
5070                     break;
5071                 case "none":
5072                 default:
5073                     layoutTemplate = RenderNoLayoutMiniCart();
5074                     miniCartTriggerTemplate = RenderMiniCartTriggerLink();
5075                     break;
5076             }
5077     
5078             masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block
5079             {
5080                 Id = "MiniCartTrigger",
5081                 Template = miniCartTriggerTemplate
5082             });
5083     
5084             if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
5085             {
5086                 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block
5087                 {
5088                     Id = "MiniCartLayout",
5089                     Template = layoutTemplate
5090                 });
5091             }
5092     
5093             BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuMiniCart);
5094             BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate);
5095         }
5096     
5097         if (hideCart && Dynamicweb.Rapido.Services.User.IsBuyingAllowed())
5098         {
5099             BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block {
5100                 Id = "CartInitialization",
5101                 Template = RenderNoLayoutMiniCart()
5102             });
5103         }
5104     }
5105     
5106     @helper RenderMiniCart(bool hasMouseEnterEvent)
5107     {
5108         List<Block> subBlocks = this.masterPage.GetBlockListById("MasterDesktopActionsMenuMiniCart").OrderBy(item => item.SortId).ToList();
5109         string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5110         string liClasses = topLayout != "normal" ? "menu__item--top-level" : "menu--clean";
5111         int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5112         string mouseEvent = "";
5113         string id = "MiniCart";
5114         if (hasMouseEnterEvent) 
5115         {
5116             mouseEvent = "onmouseenter=\"Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=" + miniCartFeedPageId + "&feedType=MiniCart')\"";
5117             id = "miniCartTrigger";
5118         }
5119         <li class="menu__item menu__item--horizontal menu__item--icon @liClasses dw-mod" id="@id" @mouseEvent>
5120             @RenderBlockList(subBlocks)
5121         </li>
5122     }
5123     
5124     @helper RenderNoLayoutMiniCart()
5125     {
5126         int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5127         <script>
5128             window.cartId = "@miniCartFeedPageId";
5129         </script>
5130     }
5131     
5132     @helper RenderMiniCartTriggerLabel()
5133     {
5134         int cartPageId = GetPageIdByNavigationTag("CartPage");
5135         string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart";
5136         string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5137         string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5138         int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5139         
5140         <div class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')">
5141             <div class="u-inline u-position-relative" title="@Translate("Cart")">
5142                 <i class="@cartIcon fa-1_5x"></i>
5143                 @RenderMiniCartCounter()
5144             </div>
5145         </div>
5146     }
5147     
5148     @helper RenderMiniCartTriggerLink()
5149     {
5150         int cartPageId = GetPageIdByNavigationTag("CartPage");
5151         string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart";
5152         string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5153         string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5154         
5155         <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button">
5156             <div class="u-inline u-position-relative" title="@Translate("Cart")">
5157                 <i class="@cartIcon fa-1_5x"></i>
5158                 @RenderMiniCartCounter()
5159             </div>
5160         </a>
5161     }
5162     
5163     @helper RenderMiniCartCounter()
5164     {
5165     int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5166     string cartProductsCount = Model.Cart.TotalProductsCount.ToString();
5167     string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";
5168     bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice");
5169     string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : "";
5170     cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : "";
5171     var totalCartWeight = Model.Cart != null && Dynamicweb.Ecommerce.Orders.Order.GetOrderById(Model.Cart.ID)?.OrderFieldValues.GetOrderFieldValue("OrderTotalWeight") != null && Dynamicweb.Ecommerce.Orders.Order.GetOrderById(Model.Cart.ID)?.OrderFieldValues.GetOrderFieldValue("OrderTotalWeight").Value != "" ? Dynamicweb.Ecommerce.Orders.Order.GetOrderById(Model.Cart.ID).OrderFieldValues.GetOrderFieldValue("OrderTotalWeight").Value + " KG": "0 KG";
5172     
5173     if (showPrice && counterPosition == "right")
5174     {
5175         cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")";
5176     }
5177     
5178         <div class="mini-cart__counter @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod">
5179             <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">
5180                 <div class="js-mini-cart-counter-content" data-count="@totalCartWeight">
5181                     @totalCartWeight
5182                 </div>
5183             </div>
5184         </div>
5185     }
5186     
5187     @helper RenderMiniCartCounterContent()
5188     {
5189         bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice");
5190         string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";
5191         bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice;
5192     
5193         <script id="MiniCartCounterContent" type="text/x-template">
5194             {{#.}}
5195                 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}">
5196                     @if (showPriceInMiniCartCounter)
5197                     {
5198                         @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text>
5199                     }
5200                     else
5201                     {
5202                         <text>{{numberofproducts}}</text>
5203                     }
5204                 </div>
5205             {{/.}}
5206         </script>
5207     }
5208     
5209     @helper RenderMiniCartDropdownLayout()
5210     {
5211         int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5212         string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");
5213         
5214         <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">
5215             <div class="mini-cart-dropdown__inner dw-mod">
5216                 <h3 class="u-ta-center dw-mod">@Translate("Shopping cart")</h3>
5217                 <div class="mini-cart-dropdown__body u-flex dw-mod">
5218                     <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>
5219                 </div>
5220             </div>
5221         </div>
5222     }
5223     
5224     @helper RenderMiniCartPanelLayout()
5225     {
5226         int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5227         string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");
5228     
5229         <div class="mini-cart grid__cell dw-mod">
5230             <input type="checkbox" id="miniCartTrigger" class="panel-trigger" />
5231             <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">
5232                 <label for="miniCartTrigger" class="panel__close-btn" title="@Translate("Close panel")"><i class="fas fa-times"></i></label>
5233                 <div class="panel__content u-full-width dw-mod">
5234                     <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3>
5235                     <div class="panel__content-body panel__content-body--cart dw-mod">
5236                         <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>
5237                     </div>
5238                 </div>
5239             </div>
5240         </div>
5241     }
5242     
5243     @helper RenderMiniCartModalLayout()
5244     {
5245         int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5246         string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");
5247     
5248         <div class="mini-cart grid__cell dw-mod">
5249             <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" />
5250             <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink">
5251                 <label for="miniCartTrigger" class="modal-overlay"></label>
5252                 <div class="modal modal--md modal--top-right dw-mod">
5253                     <div class="modal__body u-flex grid--direction-column dw-mod">
5254                         <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3>
5255                         <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>
5256                     </div>
5257                     <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label>
5258                 </div>
5259             </div>
5260         </div>
5261     }
5262     @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5263     
5264     @using System
5265     @using System.Web
5266     @using Dynamicweb.Rapido.Blocks.Extensibility
5267     @using Dynamicweb.Rapido.Blocks
5268     
5269     @{
5270         bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart");
5271     
5272         Block masterDesktopActionsMenuDownloadCart = new Block
5273         {
5274             Id = "MasterDesktopActionsMenuDownloadCart",
5275             SortId = 35,
5276             Template = RenderDownloadCart()
5277         };
5278     
5279         if (showDownloadCartLink && Model.CurrentUser.ID > 0)
5280         {
5281             BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuDownloadCart);
5282         }
5283     }
5284     
5285     @helper RenderDownloadCart()
5286     {
5287         int downloadCartPageId = GetPageIdByNavigationTag("DownloadCart");
5288         string downloadCartPageLink = "/Default.aspx?ID=" + downloadCartPageId;
5289     
5290         string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5291         string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
5292         string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5293     
5294         <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod">
5295             <a href="@downloadCartPageLink" class="@menuLinkClass dw-mod" title="@Translate("Download cart")">
5296                 <i class="fas fa-cart-arrow-down fa-1_5x"></i>
5297             </a>
5298         </li>
5299     }
5300     @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5301     
5302     @using System
5303     @using System.Web
5304     @using Dynamicweb.Rapido.Blocks.Extensibility
5305     @using Dynamicweb.Rapido.Blocks
5306     
5307     @functions {
5308         public class SearchConfiguration
5309         {
5310             public string searchFeedId { get; set; }
5311             public string searchSecondFeedId { get; set; }
5312             public int groupsFeedId { get; set; }
5313             public string resultPageLink { get; set; }
5314             public string searchPlaceholder { get; set; }
5315             public string searchType { get; set; }
5316             public string searchTemplate { get; set; }
5317             public string searchContentTemplate { get; set; }
5318             public string searchValue { get; set; }
5319             public bool showGroups { get; set; }
5320     
5321             public SearchConfiguration()
5322             {
5323                 searchFeedId = "";
5324                 searchSecondFeedId = "";
5325                 searchType = "product-search";
5326                 searchContentTemplate = "";
5327                 showGroups = true;
5328             }
5329         }
5330     }
5331     @{
5332         Block masterSearchBar = new Block
5333         {
5334             Id = "MasterSearchBar",
5335             SortId = 40,
5336             Template = RenderSearch("bar"),
5337             Design = new Design
5338             {
5339                 Size = "auto",
5340                 HidePadding = true,
5341                 RenderType = RenderType.Column
5342             }
5343         };
5344     
5345         Block masterSearchAction = new Block
5346         {
5347             Id = "MasterDesktopActionsMenuSearch",
5348             SortId = 10,
5349             Template = RenderSearch()
5350         };
5351     
5352         BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar);
5353         BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction);
5354     }
5355     
5356     @helper RenderSearch(string type = "mini-search")
5357     {
5358         string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage"));
5359         string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;
5360         string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch";
5361     
5362         SearchConfiguration searchConfiguration = null;
5363     
5364         switch (searchType) {
5365             case "contentSearch":
5366                 searchConfiguration = new SearchConfiguration() {
5367                     searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true",
5368                     resultPageLink = contentSearchPageLink,
5369                     searchPlaceholder = Translate("Search page"),
5370                     groupsFeedId = 0,
5371                     searchType = "content-search",
5372                     searchTemplate = "SearchPagesTemplate",
5373                     showGroups = false
5374                 };
5375                 break;
5376             case "combinedSearch":
5377                 searchConfiguration = new SearchConfiguration() {
5378                     searchFeedId = productsPageId + "&feed=true",
5379                     searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true",
5380                     resultPageLink = Converter.ToString(productsPageId),
5381                     searchPlaceholder = Translate("Search products or pages"),
5382                     groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"),
5383                     searchType = "combined-search",
5384                     searchTemplate = "SearchProductsTemplateWrap",
5385                     searchContentTemplate = "SearchPagesTemplateWrap",
5386                     showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector")
5387                 };
5388                 break;
5389             default: //productSearch
5390                 searchConfiguration = new SearchConfiguration() {
5391                     resultPageLink = Converter.ToString(productsPageId),
5392                     searchFeedId = productsPageId + "&feed=true",
5393                     groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"),
5394                     searchPlaceholder = Translate("Search products"),
5395                     searchTemplate = "SearchProductsTemplate",
5396                     searchType = "product-search",
5397                     showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector")
5398                 };
5399                 break;
5400         }
5401         searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? "";
5402     
5403         if (type == "mini-search") {
5404             @RenderMiniSearch(searchConfiguration)
5405         } else {
5406             @RenderSearchBar(searchConfiguration)
5407         }
5408     }
5409     
5410     @helper RenderSearchBar(SearchConfiguration options)
5411     {
5412         <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar"
5413              data-page-size="7" 
5414              data-search-feed-id="@options.searchFeedId" 
5415              data-search-second-feed-id="@options.searchSecondFeedId" 
5416              data-result-page-id="@options.resultPageLink" 
5417              data-groups-page-id="@options.groupsFeedId" 
5418              data-search-type="@options.searchType">
5419             @if (options.showGroups)
5420             {
5421                 <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>
5422                 <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>
5423             }
5424             <div class="typeahead-search-field">
5425                 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue">
5426                 @if (string.IsNullOrEmpty(options.searchSecondFeedId))
5427                 {
5428                     <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>
5429                 }
5430                 else
5431                 {
5432                     <div class="dropdown dropdown--absolute-position dropdown--combined grid">
5433                         <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>
5434                         <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>
5435                     </div>
5436                 }
5437             </div>
5438             <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>
5439         </div>
5440     }
5441     
5442     @helper RenderMiniSearch(SearchConfiguration options)
5443     {
5444         <li class="menu__item menu__item--horizontal menu__item--top-level menu__item--icon u-hidden-xxs is-dropdown is-dropdown--no-icon dw-mod" id="miniSearch">
5445             <div class="menu__link menu__link--icon dw-mod" title="@Translate("Search")">
5446                 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i>
5447             </div>
5448             <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod">
5449                 <div class="typeahead js-typeahead" id="ProductSearchBar" 
5450                      data-page-size="7" 
5451                      data-search-feed-id="@options.searchFeedId" 
5452                      data-search-second-feed-id="@options.searchSecondFeedId" 
5453                      data-result-page-id="@options.resultPageLink" 
5454                      data-search-type="@options.searchType">
5455                     <div class="typeahead-search-field">
5456                         <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue">
5457                         @if (string.IsNullOrEmpty(options.searchSecondFeedId))
5458                         {
5459                             <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>
5460                         }
5461                         else
5462                         {
5463                             <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned">
5464                                 <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>
5465                                 <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>
5466                             </div>
5467                         }
5468                     </div>
5469                 </div>
5470             </div>
5471         </li>
5472     }
5473     @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5474     
5475     @using System
5476     @using System.Web
5477     @using Dynamicweb.Rapido.Blocks.Extensibility
5478     @using Dynamicweb.Rapido.Blocks
5479     
5480     @{
5481         string headerConfigurationTopLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5482         bool headerConfigurationHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");
5483     
5484         BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master");
5485     
5486         Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo");
5487         headerConfigurationPage.RemoveBlock(configDesktopLogo);
5488     
5489         Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu");
5490         headerConfigurationPage.RemoveBlock(configDesktopMenu);
5491     
5492         Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar");
5493         headerConfigurationPage.RemoveBlock(configSearchBar);
5494     
5495         Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch");
5496         headerConfigurationPage.RemoveBlock(configSearchAction);
5497     
5498         Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu");
5499         headerConfigurationPage.RemoveBlock(configDesktopActionsMenu);
5500     
5501         Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra");
5502     
5503         switch (headerConfigurationTopLayout)
5504         {
5505             case "condensed": //2
5506                 configDesktopLogo.Design.Size = "auto-width";
5507                 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
5508     
5509                 configDesktopMenu.SortId = 20;
5510                 configDesktopMenu.Design.Size = "auto";
5511                 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
5512     
5513                 configDesktopActionsMenu.SortId = 30;
5514                 configDesktopActionsMenu.Design.Size = "auto-width";
5515                 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
5516     
5517                 if (!headerConfigurationHideSearch)
5518                 {
5519                     configSearchBar.SortId = 40;
5520                     configSearchBar.Design.Size = "12";
5521                     configDesktopExtra.SortId = 50;
5522                     headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);
5523                 }
5524                 break;
5525             case "splitted": //3
5526                 configDesktopLogo.Design.Size = "auto";
5527                 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
5528     
5529                 if (!headerConfigurationHideSearch)
5530                 {
5531                     configSearchBar.SortId = 20;
5532                     configSearchBar.Design.Size = "auto";
5533                     headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);
5534                 }
5535     
5536                 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
5537     
5538                 configDesktopActionsMenu.SortId = 20;
5539                 configDesktopActionsMenu.Design.Size = "auto-width";
5540                 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
5541                 break;
5542             case "minimal": //4
5543                 configDesktopLogo.Design.Size = "auto-width";
5544                 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
5545     
5546                 configDesktopMenu.Design.Size = "auto";
5547                 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
5548     
5549                 configDesktopActionsMenu.SortId = 20;
5550                 configDesktopActionsMenu.Design.Size = "auto-width";
5551                 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
5552     
5553                 if (!headerConfigurationHideSearch)
5554                 {
5555                     headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
5556                 }
5557                 break;
5558             case "minimal-right": //5
5559                 configDesktopLogo.Design.Size = "auto-width";
5560                 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
5561     
5562                 configDesktopMenu.Design.Size = "auto";
5563                 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
5564     
5565                 configDesktopActionsMenu.SortId = 20;
5566                 configDesktopActionsMenu.Design.Size = "auto-width";
5567                 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
5568     
5569                 if (!headerConfigurationHideSearch)
5570                 {
5571                     headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
5572                 }
5573                 break;
5574             case "two-lines": //6
5575                 configDesktopLogo.Design.Size = "auto";
5576                 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
5577     
5578                 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
5579     
5580                 configDesktopActionsMenu.SortId = 20;
5581                 configDesktopActionsMenu.Design.Size = "auto-width";
5582                 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
5583     
5584                 if (!headerConfigurationHideSearch)
5585                 {
5586                     headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
5587                 }
5588                 break;
5589             case "two-lines-centered": //7
5590                 configDesktopLogo.Design.Size = "auto";
5591                 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
5592     
5593                 configDesktopMenu.Design.Size = "auto-width";
5594                 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
5595     
5596                 configDesktopActionsMenu.SortId = 20;
5597                 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
5598     
5599                 if (!headerConfigurationHideSearch)
5600                 {
5601                     headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
5602                 }
5603                 break;
5604             case "normal": //1
5605             default:
5606                 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
5607     
5608                 if (!headerConfigurationHideSearch)
5609                 {
5610                     configSearchBar.SortId = 20;
5611                     headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);
5612                 }
5613     
5614                 configDesktopActionsMenu.SortId = 30;
5615                 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu);
5616     
5617                 configDesktopActionsMenu.Design.Size = "auto-width";
5618                 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
5619                 break;
5620         }
5621     }
5622     @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5623     
5624     @using System
5625     @using System.Web
5626     @using Dynamicweb.Rapido.Blocks.Extensibility
5627     @using Dynamicweb.Rapido.Blocks
5628     @using System.Text.RegularExpressions
5629     
5630     @{
5631         var blocksList = BlocksPage.GetBlockPage("Master");
5632         var customMasterSearchBar = blocksList.GetBlockById("MasterSearchBar");
5633         var customMasterDesktopActionsMenuSearch = blocksList.GetBlockById("MasterDesktopActionsMenuSearch");
5634     
5635     
5636         // Add text to language selector icon
5637     
5638         var CustomMasterDesktopActionsMenuLanguageSelector = blocksList.GetBlockById("MasterDesktopActionsMenuLanguageSelector");
5639     
5640         if (CustomMasterDesktopActionsMenuLanguageSelector != null)
5641         {
5642             CustomMasterDesktopActionsMenuLanguageSelector.Template = CustomRenderLanguageSelector();
5643         }
5644     
5645     
5646         // Add text to Sign in icon
5647     
5648         var CustomMasterDesktopActionsMenuSignIn = blocksList.GetBlockById("MasterDesktopActionsMenuSignIn");
5649     
5650         if (CustomMasterDesktopActionsMenuSignIn != null)
5651         {
5652             CustomMasterDesktopActionsMenuSignIn.Template = CustomRenderSignIn();
5653         }
5654     
5655     
5656     
5657     
5658         if (customMasterSearchBar != null)
5659         {
5660             customMasterSearchBar.Template = RenderSearchCustom("bar");
5661         }
5662     
5663         if (customMasterDesktopActionsMenuSearch != null)
5664         {
5665             customMasterDesktopActionsMenuSearch.Template = RenderSearchCustom();
5666         }
5667         
5668        @*Block productsGroupsNavigation = new Block
5669         {
5670             Id = "ProductsGroupsNavigation",
5671             SortId = 21,
5672             Template = RenderProductsGroupsNavigation(),
5673             Design = new Design
5674             {
5675                 Size = "auto",
5676                 HidePadding = true,
5677                 RenderType = RenderType.Row
5678             }
5679         };
5680     
5681         if ((Dynamicweb.Frontend.PageView.Current().Page.ID == GetPageIdByNavigationTag("ProductsPage") || Dynamicweb.Frontend.PageView.Current().Page.ID == GetPageIdByNavigationTag("ProductsCategoryPage")) && Dynamicweb.Frontend.PageView.Current().Device.ToString() != "Mobile" && Dynamicweb.Frontend.PageView.Current().Device.ToString() != "Tablet")
5682         {
5683             BlocksPage.GetBlockPage("Master").Add("MasterHeader", productsGroupsNavigation);
5684         }*@
5685         var minicartTrigger = blocksList.GetBlockById("MiniCartTrigger");
5686         if (minicartTrigger != null)
5687         {
5688     //minicartTrigger.Template = RenderMiniCartTriggerLabelCustom();
5689         }
5690     }
5691     
5692     
5693     
5694     
5695     @helper CustomRenderSignIn()
5696     {
5697         bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn");
5698         string userInitials = "";
5699         int pageId = Model.TopPage.ID;
5700         int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");
5701         int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard");
5702         int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");
5703         int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders");
5704         int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");
5705         int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards");
5706         int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
5707         bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");
5708         bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile");
5709         bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders");
5710         bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards");
5711         bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites");
5712         bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink");
5713     
5714         string linkStart = "/Default.aspx?ID=";
5715         if (Model.CurrentUser.ID <= 0)
5716         {
5717             linkStart += signInProfilePageId + "&RedirectPageId=";
5718         }
5719     
5720         string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery";
5721         string myProfilePageLink = linkStart + myProfilePageId;
5722         string myOrdersPageLink = linkStart + myOrdersPageId;
5723         string myFavoritesPageLink = linkStart + myFavoritesPageId;
5724         string mySavedCardsPageLink = linkStart + mySavedCardsPageId;
5725     
5726         string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user";
5727         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";
5728     
5729         if (Model.CurrentUser.ID != 0)
5730         {
5731             userInitials = Dynamicweb.Rapido.Services.User.GetInitials(Model.CurrentUser.Name, Model.CurrentUser.FirstName, Model.CurrentUser.LastName, Model.CurrentUser.Email, Model.CurrentUser.UserName);
5732         }
5733     
5734         if (!navigationItemsHideSignIn)
5735         {
5736             string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5737             string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean";
5738             string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5739     
5740             <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod">
5741                 <div class="@menuLinkClass dw-mod">
5742                     @if (Model.CurrentUser.ID <= 0)
5743                     {
5744                         <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x" title="@Translate("Sign in")"></i>
5745                         <div>@Translate("Sign in")</div>
5746                     }
5747                     else
5748                     {
5749                         <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit" title="@Translate("Customer center")"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a>
5750                     }
5751                 </div>
5752                 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod">
5753                     <ul class="list list--clean dw-mod">
5754                         @if (Model.CurrentUser.ID <= 0)
5755                         {
5756                             <li>
5757                                 <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>
5758                             </li>
5759     
5760                             if (!hideCreateAccountLink)
5761                             {
5762                                 @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account"));
5763                             }
5764                             if (!hideForgotPasswordLink)
5765                             {
5766                                 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?"))
5767                             }
5768                             if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink)
5769                             {
5770                                 @RenderSeparator()
5771                             }
5772                         }
5773                         @if (!hideMyProfileLink)
5774                         {
5775                             @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon)
5776                         }
5777                         @if (!hideMyOrdersLink)
5778                         {
5779                             @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list")
5780                         }
5781                         @if (!hideMyFavoritesLink)
5782                         {
5783                             @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon)
5784                         }
5785                         @if (!hideMySavedCardsLink)
5786                         {
5787                             @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card")
5788                         }
5789                         @if (Model.CurrentUser.ID > 0)
5790                         {
5791                             if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink)
5792                             {
5793                                 @RenderSeparator()
5794                             }
5795     
5796                             @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out"))
5797                         }
5798                     </ul>
5799                 </div>
5800             </li>
5801         }
5802     }
5803     
5804     
5805     @helper CustomRenderLanguageSelector()
5806     {
5807         string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5808         string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
5809         string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5810         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() : "";
5811     
5812         if (Model.Languages.Count > 1)
5813         {
5814             <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod">
5815                 <div class="@menuLinkClass dw-mod" title="@Translate("Language")">
5816                     <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i>
5817                     <div>@Translate("Languages")</div>
5818                 </div>
5819                 <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell">
5820                     @foreach (var lang in Model.Languages)
5821                     {
5822                         string widthClass = "menu__item--fixed-width";
5823                         string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name;
5824                         string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty);
5825                         cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1);
5826     
5827                         if (languageViewType == "flag-culture")
5828                         {
5829                             langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span> " + cultureName;
5830                         }
5831     
5832                         if (languageViewType == "flag")
5833                         {
5834                             langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span>";
5835                             widthClass = "";
5836                         }
5837     
5838                         if (languageViewType == "name")
5839                         {
5840                             langInfo = lang.Name;
5841                         }
5842     
5843                         if (languageViewType == "culture")
5844                         {
5845                             langInfo = cultureName;
5846                             widthClass = "";
5847                         }
5848     
5849                         <div class="menu__item dw-mod @widthClass">
5850                             <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__link dw-mod">@langInfo</a>
5851                         </div>
5852                     }
5853                 </div>
5854             </li>
5855         }
5856     }
5857     
5858     
5859     @helper RenderMiniCartTriggerLabelCustom()
5860     {
5861         int cartPageId = GetPageIdByNavigationTag("CartPage");
5862         string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart";
5863         string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5864         string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5865         int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5866     
5867         <div class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')">
5868             <div class="u-inline u-position-relative" title="@Translate("Cart")">
5869                 <i class="@cartIcon fa-1_5x"></i>
5870                 @RenderMiniCartCounterCustom()
5871             </div>
5872         </div>
5873     }
5874     
5875     @helper RenderMiniCartCounterCustom()
5876     {
5877         int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5878         string cartProductsCount = Model.Cart.TotalProductsCount.ToString();
5879         string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";
5880         bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice");
5881         string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : "";
5882         cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : "";
5883         var cart = Dynamicweb.Ecommerce.Common.Context.Cart;
5884         var totalWeight = "";
5885         if (cart != null)
5886         {
5887             totalWeight = cart.OrderFieldValues.GetOrderFieldValue("OrderTotalWeight").Value.ToString();
5888         }
5889         else
5890         {
5891             totalWeight = "0";
5892         }
5893         if (showPrice && counterPosition == "right")
5894         {
5895             cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")";
5896         }
5897     
5898         <div class="mini-cart__counter @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod">
5899             <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">
5900                 <div class="js-mini-cart-counter-content" data-count="@totalWeight">
5901                     @totalWeight
5902                 </div>
5903             </div>
5904         </div>
5905     }
5906     
5907     @helper RenderSearchCustom(string type = "mini-search")
5908     {
5909         string productsPageId = Converter.ToString(GetPageIdByNavigationTag("SearchInAllProducts"));
5910         string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;
5911         string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch";
5912     
5913         SearchConfiguration searchConfiguration = null;
5914     
5915         switch (searchType)
5916         {
5917             case "contentSearch":
5918                 searchConfiguration = new SearchConfiguration()
5919                 {
5920                     searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true",
5921                     resultPageLink = contentSearchPageLink,
5922                     searchPlaceholder = Translate("Search page"),
5923                     groupsFeedId = 0,
5924                     searchType = "content-search",
5925                     searchTemplate = "SearchPagesTemplate",
5926                     showGroups = false
5927                 };
5928                 break;
5929             case "combinedSearch":
5930                 searchConfiguration = new SearchConfiguration()
5931                 {
5932                     searchFeedId = productsPageId + "&feed=true",
5933                     searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true",
5934                     resultPageLink = Converter.ToString(productsPageId),
5935                     searchPlaceholder = Translate("Search products or pages"),
5936                     groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"),
5937                     searchType = "combined-search",
5938                     searchTemplate = "SearchProductsTemplateWrap",
5939                     searchContentTemplate = "SearchPagesTemplateWrap",
5940                     showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector")
5941                 };
5942                 break;
5943             default: //productSearch
5944                 searchConfiguration = new SearchConfiguration()
5945                 {
5946                     resultPageLink = Converter.ToString(productsPageId),
5947                     searchFeedId = productsPageId + "&feed=true",
5948                     groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"),
5949                     searchPlaceholder = Translate("Search products"),
5950                     searchTemplate = "SearchProductsTemplate",
5951                     searchType = "product-search",
5952                     showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector")
5953                 };
5954                 break;
5955         }
5956         searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? "";
5957     
5958         if (type == "mini-search")
5959         {
5960             @RenderMiniSearch(searchConfiguration)
5961         }
5962         else
5963         {
5964             @RenderSearchBarCustom(searchConfiguration)
5965         }
5966     }
5967     
5968     @helper RenderSearchBarCustom(SearchConfiguration options)
5969     {
5970         var user = Pageview.User;
5971     
5972         if (user != null && user.ID > 0)
5973         {
5974             var salesRep = user.CustomFieldValues.FirstOrDefault(cf => cf.CustomField.SystemName == "AccessUser_SalesRepCustomerNumber")?.Value?.ToString();
5975     
5976             if (user.CustomFieldValues.FirstOrDefault(cf => cf.CustomField.SystemName == "AccessUser_ShowCustomerNumberInHeaderOnLogin").Value.ToString() == "True")
5977             {
5978                 <input type="hidden" id="loggedUserCustomerNumber" value="@user.CustomerNumber" />
5979                 <input type="hidden" id="AccessUser_SalesRepCustomerNumber" value="@salesRep" />
5980     
5981     			//user.CustomFieldValues.FirstOrDefault(cf => cf.CustomField.SystemName == "AccessUser_ShowCustomerNumberInHeaderOnLogin").Value = "False";
5982     			//user.Save();
5983     
5984             }
5985         }
5986     
5987         <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar"
5988              data-page-size="7"
5989              data-search-feed-id="@options.searchFeedId"
5990              data-search-second-feed-id="@options.searchSecondFeedId"
5991              data-result-page-id="@options.resultPageLink"
5992              data-groups-page-id="@options.groupsFeedId"
5993              data-search-type="@options.searchType">
5994             @if (options.showGroups)
5995             {
5996                 <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>
5997                 <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>
5998             }
5999             <div class="typeahead-search-field">
6000                 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue">
6001                 @if (string.IsNullOrEmpty(options.searchSecondFeedId))
6002                 {
6003                     <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>
6004                 }
6005                 else
6006                 {
6007                     <div class="dropdown dropdown--absolute-position dropdown--combined grid">
6008                         <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>
6009                         <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>
6010                     </div>
6011                 }
6012             </div>
6013             <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>
6014         </div>
6015     }
6016     
6017     @helper RenderProductsGroupsNavigation()
6018     {
6019     
6020         
6021         bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");
6022         bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders");
6023         int startLevel = renderPagesInToolBar ? 1 : 0;
6024     
6025         string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink");
6026         
6027         <div class="grid__cell u-flex products-navigation">
6028             
6029             
6030     
6031              @{ 
6032             var navigationSettings = new Dynamicweb.Frontend.Navigation.NavigationSettings() {
6033                 RootAreaId = 1,
6034                 StartLevel = 1,
6035                 StopLevel = 5,
6036                 ExpandMode = Dynamicweb.Frontend.Navigation.ExpandMode.All
6037             };
6038     
6039             var navigationTemplate = "Navigation/Default.cshtml";
6040             
6041         }
6042     
6043      <div class="center-container top-container__center-container grid dw-mod">@Navigation.RenderNavigation(navigationTemplate, navigationSettings)</div>
6044         
6045     
6046     
6047     
6048     
6049         </div>
6050     }
6051     
6052     
6053     @helper RenderDesktopTools()
6054     {
6055         List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList();
6056     
6057         <div class="tools-navigation dw-mod">
6058             <div class="center-container grid top-container__center-container dw-mod">
6059                 @RenderBlockList(subBlocks)
6060             </div>
6061         </div>
6062     }
6063     
6064     @helper RenderDesktopToolsText()
6065     {
6066         string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText");
6067         if (!string.IsNullOrEmpty(toolsText))
6068         {
6069             <div class="u-margin-top u-margin-bottom">@toolsText</div>
6070         }
6071     }
6072     
6073     @helper RenderDesktopToolsNavigation()
6074     {
6075         bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");
6076     
6077         if (renderPagesInToolBar)
6078         {
6079            @RenderNavigation(new
6080            {
6081                id = "topToolsNavigation",
6082                cssclass = "menu menu-tools dw-mod dwnavigation",
6083                template = "TopMenu.xslt"
6084            })
6085         } 
6086     }
6087     
6088     @helper RenderDesktopNavigation()
6089     {
6090         List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList();
6091         string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";    
6092         string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : "";
6093         <nav class="main-navigation dw-mod">
6094             <div class="center-container top-container__center-container grid  @alignClass dw-mod">
6095                 @RenderBlockList(subBlocks)
6096             </div>
6097         </nav>
6098     }
6099     
6100     @helper RenderDesktopExtra()
6101     {
6102         List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList();
6103     
6104         if (subBlocks.Count > 0)
6105         {
6106             <div class="header header-top dw-mod">
6107                 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod">
6108                     @RenderBlockList(subBlocks)
6109                 </div>
6110             </div>
6111         }
6112     }</text>
6113     }
6114     
6115     @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
6116     
6117     @using System
6118     @using System.Web
6119     @using Dynamicweb.Rapido.Blocks.Extensibility
6120     @using Dynamicweb.Rapido.Blocks
6121     @using Dynamicweb.Rapido.Blocks.Components.General
6122     @using Dynamicweb.Frontend
6123     
6124     @functions {
6125         int impersonationPageId;
6126         string impersonationLayout;
6127         int impersonationFeed;
6128         Block impersonationBar;
6129     
6130         string getUserNameFromParams(string firstName, string middleName, string lastName, string name, string email, string userName)
6131         {
6132             string username = "";
6133     
6134             if (!string.IsNullOrEmpty(firstName) && !string.IsNullOrEmpty(lastName))
6135             {
6136                 username = firstName + " " + (!string.IsNullOrEmpty(middleName) ? middleName + " " : "") + lastName;
6137             }
6138             else if (!string.IsNullOrEmpty(name))
6139             {
6140                 username = name;
6141             }
6142             else if (!string.IsNullOrEmpty(email))
6143             {
6144                 username = email;
6145             }
6146             else
6147             {
6148                 username = userName;
6149             }
6150             return username;
6151         }
6152     
6153         string getUserName(UserViewModel user)
6154         {
6155             return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName);
6156         }
6157     
6158         string getUserName(Dynamicweb.Security.UserManagement.User user)
6159         {
6160             return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName);
6161         }
6162     }
6163     
6164     @{
6165         impersonationPageId = GetPageIdByNavigationTag("Impersonation");
6166         impersonationLayout = Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout") != null ? Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout").SelectedValue : "bar";
6167         impersonationFeed = GetPageIdByNavigationTag("UsersFeed");
6168         
6169     	// SNNS5-204 Bad preformance logging in.
6170         var isloggedIn = Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn();
6171         var secUsers = this.Pageview.User?.GetUsersICanSetAsSecondary().Any() ?? false;
6172         var secondaryUserId = this.Pageview.User?.CurrentSecondaryUser?.ID ?? 0;
6173         if (!secUsers) {
6174             if (secondaryUserId > 0 && this.Pageview.User.ID != secondaryUserId) {
6175                 secUsers = true;
6176             }
6177         }
6178     
6179     
6180         //if (isloggedIn && Model.Curre	ntUser.ID > 0 && Model.SecondaryUsers.Count > 0)
6181         if (isloggedIn && secUsers)
6182         {
6183             impersonationBar = new Block
6184             {
6185                 Id = "ImpersonationBar",
6186                 SortId = 50,
6187                 Template = RenderImpersonation(),
6188                 SkipRenderBlocksList = true,
6189                 Design = new Design
6190                 {
6191                     Size = "auto-width",
6192                     HidePadding = true,
6193                     RenderType = RenderType.Column
6194                 }
6195             };
6196     
6197             Block impersonationContent = new Block
6198             {
6199                 Id = "ImpersonationContent",
6200                 SortId = 10
6201             };
6202     
6203             // if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0)
6204             if (this.Pageview.User?.CurrentSecondaryUser?.ID > 0)
6205             {
6206                 //Render stop impersonation view
6207                 impersonationContent.Template = RenderStopImpersonationView();
6208             }
6209             else
6210             {
6211                 //Render main view
6212                 switch (impersonationLayout)
6213                 {
6214                     case "right-lower-box":
6215                         impersonationContent.BlocksList.Add(
6216                             new Block {
6217                                 Id = "RightLowerBoxHeader",
6218                                 SortId = 10,
6219                                 Component = new Heading {
6220                                     Level = 5,
6221                                     Title = Translate("View the list of users you can impersonate"),
6222                                     CssClass = "impersonation-text"
6223                                 }
6224                             }
6225                         );
6226                         impersonationContent.BlocksList.Add(
6227                             new Block {
6228                                 Id = "RightLowerBoxContent",
6229                                 SortId = 20,
6230                                 Template = RenderImpersonationControls()
6231                             }
6232                         );
6233                         break;
6234                     case "right-lower-bar":
6235                         impersonationContent.BlocksList.Add(
6236                             new Block {
6237                                 Id = "RightLowerBarContent",
6238                                 SortId = 10,
6239                                 Template = RenderImpersonationControls()
6240                             }
6241                         );
6242                         break;
6243                     case "bar":
6244                     default:
6245                         impersonationContent.BlocksList.Add(
6246                             new Block {
6247                                 Id = "ViewListLink",
6248                                 SortId = 20,
6249                                 Template = RenderViewListLink()
6250                             }
6251                         );
6252                         impersonationContent.BlocksList.Add(
6253                             new Block {
6254                                 Id = "BarTypeaheadSearch",
6255                                 SortId = 30,
6256                                 Template = RenderTypeaheadSearch()
6257                             }
6258                         );
6259                         break;
6260                 }
6261             }
6262             impersonationBar.BlocksList.Add(impersonationContent);
6263     
6264             impersonationBar.BlocksList.Add(
6265                 new Block
6266                 {
6267                     Id = "ImpersonationSearchTemplates",
6268                     SortId = 20,
6269                     Template = RenderSearchResultTemplate()
6270                 }
6271             );
6272             if (impersonationLayout != "bar")
6273             {
6274                 impersonationBar.BlocksList.Add(
6275                     new Block
6276                     {
6277                         Id = "ImpersonationSearchScripts",
6278                         SortId = 30,
6279                         Template = RenderSearchScripts()
6280                     }
6281                 );
6282             }
6283             BlocksPage.GetBlockPage("Master").Add("MasterHeader", impersonationBar);
6284         }
6285     }
6286     
6287     @helper RenderImpersonation()
6288     {
6289         List<Block> subBlocks = impersonationBar.BlocksList.OrderBy(item => item.SortId).ToList();
6290         <input type="checkbox" class="impersonation-trigger js-remember-state" id="ImpersonationMinimizeTrigger" />
6291         <div class="impersonation impersonation--@(impersonationLayout)-layout dw-mod" id="Impersonation">
6292             @if (impersonationLayout == "right-lower-box")
6293             {
6294                 @RenderRightLowerBoxHeader()
6295             }
6296             <div class="center-container top-container__center-container u-padding--lg impersonation__container @(impersonationLayout != "bar" ? "impersonation__container--box" : "") dw-mod"> 
6297                 @*Impersonation*@
6298                 @RenderBlockList(subBlocks)
6299             </div>
6300         </div>
6301     }
6302     
6303     @helper RenderRightLowerBoxHeader()
6304     {
6305         <div class="impersonation__header dw-mod">
6306             <div class="impersonation__title">@Translate("Impersonation")</div>
6307             <label for="ImpersonationMinimizeTrigger" class="btn btn--impersonation impersonation__minimize-btn dw-mod" onclick="this.blur();">
6308                 @Render(new Icon
6309                 {
6310                     Prefix = "fas",
6311                     Name = "fa-window-minimize"
6312                 })
6313             </label>
6314         </div>
6315     }
6316     
6317     @helper RenderStopImpersonationView()
6318     {        
6319         string secondaryUserName = getUserName(Model.CurrentSecondaryUser);
6320         string userName = getUserName(Pageview.User);
6321         string impersonationText = "<b>" + userName + "</b> " + Translate("is impersonating") + " <b>" + secondaryUserName + "</b>";
6322         impersonationText = Dynamicweb.Security.UserManagement.User.ImpersonationMode == Dynamicweb.Security.UserManagement.UserImpersonation.Full ? "<b>" + secondaryUserName + "</b> " + Translate("is impersonating") + " <b>" + userName + "</b>" : impersonationText;
6323     
6324         if (impersonationLayout == "right-lower-box")
6325         {
6326             <div class="u-margin-bottom--lg u-ta-center">
6327                 @impersonationText
6328             </div>
6329             @RenderStopImpersonationForm()
6330         }
6331         else
6332         {
6333             <div class="grid grid--align-center grid--justify-space-between impersonation__stop-wrap">
6334                 <div class="u-margin-right--lg impersonation__stop-text">
6335                     <i class="fas fa-user-secret"></i>
6336                     @impersonationText
6337                 </div>
6338                 @RenderStopImpersonationForm()
6339             </div>
6340         }
6341     }
6342     
6343     @helper RenderStopImpersonationForm()
6344     {
6345         <form method="post" class="u-no-margin">
6346             @Render(new Button
6347             {
6348                 ButtonType = ButtonType.Submit,
6349                 ButtonLayout = ButtonLayout.None,
6350                 Title = Translate("Stop impersonation"),
6351                 Href = "/Default.aspx?ID=" + impersonationPageId,
6352                 CssClass = "impersonation__button btn btn--impersonation",
6353                 Name = "DwExtranetRemoveSecondaryUser"
6354             })
6355         </form>
6356     }
6357     
6358     @helper RenderImpersonationControls()
6359     {
6360         <div class="impersonation__controls">
6361             @RenderViewListLink()
6362             @RenderSearchBox()
6363         </div>
6364         @RenderResultsList()
6365     }
6366     
6367     @helper RenderViewListLink()
6368     {
6369         string title = impersonationLayout == "right-lower-box" ? Translate("View the list") : Translate("View the list of users you can impersonate");
6370         string buttonClasses = impersonationLayout == "right-lower-box" ? "impersonation__button btn btn--impersonation" : "impersonation__link impersonation__link";
6371     
6372         @Render(new Link {
6373             ButtonLayout = ButtonLayout.None,
6374             Title = title,
6375             Href = "/Default.aspx?ID=" + impersonationPageId,
6376             CssClass = buttonClasses
6377         })
6378     }
6379     
6380     @helper RenderSearchBox()
6381     {
6382         <div class="impersonation__search-wrap">
6383             <input placeholder="@Translate("Search users")" type="text" class="impersonation__search-field dw-mod" onkeyup="searchKeyUpHandler(event)" id="ImpersonationBoxSearchField">
6384             <div id="ImpersonationBoxSearchFind" class="impersonation__search-icon dw-mod" onclick="updateResults(document.getElementById('ImpersonationBoxSearchField').value)">
6385                 <i class="fal fa-search"></i>
6386             </div>
6387             <div id="ImpersonationBoxSearchClear" class="impersonation__search-icon u-hidden dw-mod" onclick="clearResults();">
6388                 <i class="fal fa-times"></i>
6389             </div>
6390         </div>
6391     }
6392     
6393     @helper RenderTypeaheadSearch()
6394     {
6395         <div class="typeahead u-ta-right impersonation__typeahead js-typeahead dw-mod" id="ImpersonationSearchBar"
6396              data-page-size="5"
6397              data-search-feed-id="@impersonationFeed"
6398              data-result-page-id="@impersonationPageId"
6399              data-search-type="user-search"
6400              data-search-parameter-name="q">
6401     
6402             <div class="typeahead-search-field">
6403                 <input type="text" class="u-no-margin js-typeahead-search-field" placeholder="@Translate("Search users")">
6404                 <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>
6405             </div>
6406         </div>
6407     }
6408     
6409     @helper RenderResultsList()
6410     {
6411         <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>
6412     }
6413     
6414     @helper RenderSearchResultTemplate()
6415     {
6416         <script id="ImpersonationSearchResult" type="text/x-template">
6417             {{#.}}
6418                 {{#Users}}
6419                     <li class="impersonation__search-results-item impersonation-user">
6420                         <form method="post" class="impersonation-user__form" name="account{{id}}">
6421                             <input type="hidden" id="DWExtranetSecondaryUserSelector" name="DWExtranetSecondaryUserSelector" value="{{id}}">
6422                             <div class="impersonation-user__info">
6423                                 <div class="impersonation-user__name">{{userName}}</div>
6424                                 <div class="impersonation-user__number">{{customerNumber}}</div>
6425                             </div>
6426                             @Render(new Button
6427                                {
6428                                    ButtonType = ButtonType.Submit,
6429                                    ButtonLayout = ButtonLayout.Secondary,
6430                                    Title = Translate("Sign in as"),
6431                                    CssClass = "impersonation-user__sign-in-btn" + (impersonationLayout != "bar" ? " btn--impersonation" : "")
6432                                })
6433                         </form>
6434                     </li>
6435                 {{/Users}}
6436                 {{#unless Users}}
6437                     <li class="impersonation__search-results-item impersonation__search-results-item--not-found">
6438                         @Translate("Your search gave 0 results")
6439                     </li>
6440                 {{/unless}}
6441             {{/.}}
6442         </script>
6443     }
6444     
6445     @helper RenderSearchScripts()
6446     {
6447         <script>
6448             let inputDelayTimer;
6449             function searchKeyUpHandler(e) {
6450                 clearTimeout(inputDelayTimer);
6451                 let value = e.target.value;
6452                 if (value != "") {
6453                     inputDelayTimer = setTimeout(function () {
6454                         updateResults(value);
6455                     }, 500);
6456                 } else {
6457                     clearResults();
6458                 }
6459             };
6460     
6461             function updateResults(value) {
6462                 if (value == "") {
6463                     return null;
6464                 }
6465                 HandlebarsBolt.UpdateContent("ImpersonationBoxSearchResults", "/Default.aspx?ID=@impersonationFeed&q=" + value);
6466                 document.getElementById("ImpersonationBoxSearchFind").classList.add("u-hidden");
6467                 document.getElementById("ImpersonationBoxSearchClear").classList.remove("u-hidden");
6468             }
6469     
6470             function clearResults() {
6471                 document.getElementById("ImpersonationBoxSearchField").value = "";
6472                 HandlebarsBolt.CleanContainer("ImpersonationBoxSearchResults");
6473                 document.getElementById("ImpersonationBoxSearchFind").classList.remove("u-hidden");
6474                 document.getElementById("ImpersonationBoxSearchClear").classList.add("u-hidden");
6475             }
6476         </script>
6477     }
6478     @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
6479     
6480     @using System
6481     @using System.Web
6482     @using System.Collections.Generic
6483     @using Dynamicweb.Rapido.Blocks.Extensibility
6484     @using Dynamicweb.Rapido.Blocks
6485     
6486     @{
6487         BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master");
6488         string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table";
6489     
6490         Block orderLines = new Block
6491         {
6492             Id = "MiniCartOrderLines",
6493             SkipRenderBlocksList = true,
6494             BlocksList = new List<Block>
6495             {
6496                 new Block {
6497                     Id = "MiniCartOrderLinesList",
6498                     SortId = 20,
6499                     Template = RenderMiniCartOrderLinesList()
6500                 }
6501             }
6502         };
6503     
6504         Block orderlinesScriptTemplates = new Block
6505         {
6506             Id = "OrderlinesScriptTemplates"
6507         };
6508     
6509         if (orderlinesView == "table")
6510         {
6511             orderLines.Template = RenderMiniCartOrderLinesTable();
6512             orderLines.BlocksList.Add(
6513                 new Block
6514                 {
6515                     Id = "MiniCartOrderlinesTableHeader",
6516                     SortId = 10,
6517                     Template = RenderMiniCartOrderLinesHeader()
6518                 }
6519             );
6520     
6521             orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates();
6522         }
6523         else
6524         {
6525             orderLines.Template = RenderMiniCartOrderLinesBlocks();
6526             orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates();
6527         }
6528     
6529         miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates);
6530     
6531         Block miniCartScriptTemplates = new Block()
6532         {
6533             Id = "MasterMiniCartTemplates",
6534             SortId = 1,
6535             Template = RenderMiniCartScriptTemplates(),
6536             SkipRenderBlocksList = true,
6537             BlocksList = new List<Block>
6538             {
6539                 orderLines,
6540                 new Block {
6541                     Id = "MiniCartFooter",
6542                     Template = RenderMiniCartFooter(),
6543                     SortId = 50,
6544                     SkipRenderBlocksList = true,
6545                     BlocksList = new List<Block>
6546                     {
6547                         new Block {
6548                             Id = "MiniCartSubTotal",
6549                             Template = RenderMiniCartSubTotal(),
6550                             SortId = 30
6551                         },
6552                         new Block {
6553                             Id = "MiniCartFees",
6554                             Template = RenderMiniCartFees(),
6555                             SortId = 40
6556                         },
6557                         new Block {
6558                             Id = "MiniCartPoints",
6559                             Template = RenderMiniCartPoints(),
6560                             SortId = 50
6561                         },
6562                         new Block {
6563                             Id = "MiniCartTotal",
6564                             Template = RenderMiniCartTotal(),
6565                             SortId = 60
6566                         },
6567                         new Block {
6568                             Id = "MiniCartDisclaimer",
6569                             Template = RenderMiniCartDisclaimer(),
6570                             SortId = 70
6571                         },
6572                         new Block {
6573                             Id = "MiniCartActions",
6574                             Template = RenderMiniCartActions(),
6575                             SortId = 80
6576                         }
6577                     }
6578                 }
6579             }
6580         };
6581     
6582         miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates);
6583     }
6584     
6585     @helper RenderMiniCartScriptsTableTemplates()
6586     {
6587         <script id="MiniCartOrderline" type="text/x-template">
6588             {{#unless isEmpty}}
6589                 <tr>
6590                     <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>
6591                     <td class="u-va-middle">
6592                         <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a>
6593                         {{#if variantname}}
6594                             <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a>
6595                         {{/if}}
6596                         {{#if unitname}}
6597                             <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div>
6598                         {{/if}}
6599                     </td>
6600                     <td class="u-ta-right u-va-middle">{{quantity}}</td>
6601                     <td class="u-ta-right u-va-middle">
6602                         {{#if pointsTotal}}
6603                             <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points")
6604                         {{else}}
6605                             {{totalprice}}
6606                         {{/if}}
6607                     </td>
6608                 </tr>
6609             {{/unless}}
6610         </script>
6611     
6612         <script id="MiniCartOrderlineDiscount" type="text/x-template">
6613             {{#unless isEmpty}}
6614                 <tr class="table__row--no-border">
6615                     <td class="u-w60px"> </td>
6616                     <td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td>
6617                     <td class="u-ta-right"> </td>
6618                     <td class="u-ta-right">{{totalprice}}</td>
6619                 </tr>
6620             {{/unless}}
6621         </script>
6622     }
6623     
6624     @helper RenderMiniCartScriptsListTemplates()
6625     {
6626         int cartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
6627     
6628         <script id="MiniCartOrderline" type="text/x-template">
6629             {{#unless isEmpty}}
6630                 <div class="mini-cart-orderline grid dw-mod">
6631                     <div class="grid__col-4">
6632                         <a href="{{link}}" class="{{hideimage}}">
6633                             <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}}">
6634                         </a>
6635                     </div>
6636                     <div class="grid__col-8">
6637                         <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>
6638                         {{#if variantname}}
6639                             <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div>
6640                         {{/if}}
6641                         {{#if unitname}}
6642                             <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div>
6643                         {{/if}}
6644                         <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div>
6645     
6646                         <div class="grid__cell-footer">
6647                             <div class="grid__cell">
6648                                 <div class="u-pull--left mini-cart-orderline__price dw-mod">
6649                                     {{#if pointsTotal}}
6650                                         <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points")
6651                                     {{else}}
6652                                         {{totalprice}}
6653                                     {{/if}}
6654                                 </div>
6655                                 <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>
6656                             </div>
6657                         </div>
6658                     </div>
6659                 </div>
6660             {{/unless}}
6661         </script>
6662     
6663         <script id="MiniCartOrderlineDiscount" type="text/x-template">
6664             {{#unless isEmpty}}
6665                 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod">
6666                     <div class="grid__col-4">
6667                         <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div>
6668                     </div>
6669                     <div class="grid__col-8">{{totalprice}}</div>
6670                 </div>
6671             {{/unless}}
6672         </script>
6673     }
6674     
6675     @helper RenderMiniCartScriptTemplates()
6676     {
6677         List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList();
6678         bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));
6679         string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage"));
6680     
6681         <script id="MiniCartContent" type="text/x-template">
6682             {{#.}}
6683                 {{#unless isEmpty}}
6684                     @RenderBlockList(subBlocks)
6685                 {{/unless}}
6686             {{/.}}
6687         </script>
6688     }
6689     
6690     @helper RenderMiniCartOrderLinesTable()
6691     {
6692         List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList();
6693     
6694         <div class="u-overflow-auto">
6695             <table class="table mini-cart-table dw-mod">
6696                 @RenderBlockList(subBlocks)
6697             </table>
6698         </div>
6699     }
6700     
6701     @helper RenderMiniCartOrderLinesBlocks()
6702     {
6703         List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList();
6704     
6705         <div class="u-overflow-auto">
6706             @RenderBlockList(subBlocks)
6707         </div>
6708     }
6709     
6710     @helper RenderMiniCartOrderLinesHeader()
6711     {
6712         <thead>
6713             <tr>
6714                 <td> </td>
6715                 <td>@Translate("Product")</td>
6716                 <td class="u-ta-right">@Translate("Qty")</td>
6717                 <td class="u-ta-right" width="120">@Translate("Price")</td>
6718             </tr>
6719         </thead>
6720     }
6721     
6722     @helper RenderMiniCartOrderLinesList()
6723     {
6724         <text>
6725             {{#OrderLines}}
6726                 {{#ifCond template "===" "CartOrderline"}}
6727                     {{>MiniCartOrderline}}
6728                 {{/ifCond}}
6729                 {{#ifCond template "===" "CartOrderlineMobile"}}
6730                     {{>MiniCartOrderline}}
6731                 {{/ifCond}}
6732                 {{#ifCond template "===" "CartOrderlineDiscount"}}
6733                     {{>MiniCartOrderlineDiscount}}
6734                 {{/ifCond}}
6735             {{/OrderLines}}
6736         </text>
6737     }
6738     
6739     @helper RenderMiniCartFees()
6740     {
6741         bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
6742         if (!pointShop)
6743         {
6744             <text>
6745                 {{#unless hidePaymentfee}}
6746                     <div class="grid">
6747                         <div class="grid__col-6 grid__col--bleed-y">
6748                             {{paymentmethod}}
6749                         </div>
6750                         <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{paymentfee}}</div>
6751                     </div>
6752                 {{/unless}}
6753             </text>
6754         }
6755         <text>
6756             {{#unless hideShippingfee}}
6757                 <div class="grid">
6758                     <div class="grid__col-6 grid__col--bleed-y">
6759                         {{shippingmethod}}
6760                     </div>
6761                     <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{shippingfee}}</div>
6762                 </div>
6763             {{/unless}}
6764         </text>
6765         <text>
6766             {{#if hasTaxSettings}}
6767                 <div class="grid">
6768                     <div class="grid__col-6 grid__col--bleed-y">@Translate("Sales Tax")</div>
6769                     <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{totaltaxes}}</div>
6770                 </div>
6771             {{/if}}
6772         </text>
6773     }
6774     
6775     @helper RenderMiniCartFooter()
6776     {
6777         List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList();
6778     
6779         <div class="mini-cart__footer u-border-top u-padding-top dw-mod">
6780             @RenderBlockList(subBlocks)
6781         </div>
6782     }
6783     
6784     @helper RenderMiniCartActions()
6785     {
6786         int cartPageId = GetPageIdByNavigationTag("CartPage");
6787     
6788         <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>
6789         <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>
6790     }
6791     
6792     @helper RenderMiniCartPoints()
6793     {
6794         <text>
6795             {{#if earnings}}
6796                 <div class="grid">
6797                     <div class="grid__col-6 grid__col--bleed-y">@Translate("Earnings")</div>
6798                     <div class="grid__col-6 grid__col--bleed-y grid--align-end">
6799                         <div>
6800                             <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points")
6801                         </div>
6802                     </div>
6803                 </div>
6804             {{/if}}
6805         </text>
6806     }
6807     
6808     @helper RenderMiniCartSubTotal()
6809     {
6810         bool hasTaxSettings = Dynamicweb.Rapido.Services.Countries.HasTaxSettings(Model.Cart.ID);
6811         bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
6812         if (!pointShop)
6813         {
6814             <text>
6815                 {{#unless hideSubTotal}}
6816                     <div class="grid dw-mod u-bold">
6817                         <div class="grid__col-6 grid__col--bleed-y">@Translate("Subtotal")</div>
6818                         <div class="grid__col-6 grid__col--bleed-y grid--align-end">
6819                             @if (hasTaxSettings)
6820                             {
6821                                 <text>{{subtotalpricewithouttaxes}}</text>
6822                             }
6823                             else
6824                             {
6825                                 <text>{{subtotalprice}}</text>
6826                             }
6827                         </div>
6828                     </div>
6829                 {{/unless}}
6830             </text>
6831         }
6832     }
6833     
6834     @helper RenderMiniCartTotal()
6835     {
6836         bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
6837     
6838         <div class="mini-cart-totals grid u-border-top u-margin-top dw-mod">
6839             <div class="grid__col-6">@Translate("Total")</div>
6840             <div class="grid__col-6 grid--align-end">
6841                 <div>
6842                     @if (pointShop)
6843                     {
6844                         <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points")
6845                     }
6846                     else
6847                     {
6848                         <text>{{totalprice}}</text>
6849                     }
6850                 </div>
6851             </div>
6852         </div>
6853     }
6854     
6855     @helper RenderMiniCartDisclaimer()
6856     {
6857         <text>
6858             {{#if showCheckoutDisclaimer}}
6859                 <div class="grid u-margin-bottom u-ta-right">
6860                     <small class="grid__col-12">{{checkoutDisclaimer}}</small>
6861                 </div>
6862             {{/if}}
6863         </text>
6864     }
6865     @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
6866     
6867     @using Dynamicweb.Rapido.Blocks.Extensibility
6868     @using Dynamicweb.Rapido.Blocks
6869     @using Dynamicweb.Rapido.Blocks.Components.General
6870     @using Dynamicweb.Rapido.Blocks.Components
6871     @using Dynamicweb.Rapido.Services
6872     
6873     @{
6874         string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : "";
6875         string addToCartNotificationMiniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown";
6876         bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart");
6877     
6878         if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !string.IsNullOrEmpty(addToCartNotificationType))
6879         {
6880             if (addToCartNotificationType == "modal")
6881             {
6882                 Block addToCartNotificationModal = new Block
6883                 {
6884                     Id = "AddToCartNotificationModal",
6885                     Template = RenderAddToCartNotificationModal()
6886                 };
6887     
6888                 Block addToCartNotificationScript = new Block
6889                 {
6890                     Id = "AddToCartNotificationScript",
6891                     Template = RenderAddToCartNotificationModalScript()
6892                 };
6893                 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal);
6894                 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript);
6895             }
6896             else if (addToCartNotificationType == "toggle" && addToCartNotificationMiniCartLayout != "none" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
6897             {
6898                 Block addToCartNotificationScript = new Block
6899                 {
6900                     Id = "AddToCartNotificationScript",
6901                     Template = RenderAddToCartNotificationToggleScript()
6902                 };
6903                 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript);
6904             }
6905         }
6906     }
6907     
6908     @helper RenderAddToCartNotificationModal()
6909     {
6910         <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div>
6911     }
6912     
6913     @helper RenderAddToCartNotificationModalScript()
6914     {
6915         int cartPageId = GetPageIdByNavigationTag("CartPage");
6916     
6917         <script id="LastAddedProductTemplate" type="text/x-template">
6918             @{
6919     
6920                 Modal lastAddedProduct = new Modal
6921                 {
6922                     Id = "LastAddedProduct",
6923                     Heading = new Heading
6924                     {
6925                         Level = 2,
6926                         Title = Translate("Product is added to the cart")
6927                     },
6928                     Width = ModalWidth.Md,
6929                     BodyTemplate = RenderModalContent()
6930                 };
6931     
6932                 lastAddedProduct.AddActions(
6933                     new Button
6934                     {
6935                         ButtonType = ButtonType.Button,
6936                         ButtonLayout = ButtonLayout.Secondary,
6937                         Title = Translate("Continue shopping"),
6938                         CssClass = "u-pull--left u-no-margin btn--sm",
6939                         OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false"
6940                     },
6941                     new Link
6942                     {
6943                         Href = "/Default.aspx?ID=" + cartPageId,
6944                         ButtonLayout = ButtonLayout.Secondary,
6945                         CssClass = "u-pull--right u-no-margin btn--sm",
6946                         Title = Translate("Proceed to checkout")
6947                     }
6948                 );
6949     
6950                 @Render(lastAddedProduct)
6951             }
6952         </script>
6953         <script>
6954             document.addEventListener('addToCart', function (event) {
6955                 Cart.ShowLastAddedProductModal(event.detail);
6956             });
6957         </script>
6958     }
6959     
6960     @helper RenderModalContent()
6961     {
6962         <div class="grid">
6963             <div class="grid__col-2">
6964                 @Render(new Image { Path = "{{ productInfo.image }}", Link = "{{ productInfo.link }}", Title = "{{ productInfo.name }}", DisableImageEngine = true })
6965             </div>
6966             <div class="u-padding grid--align-self-center">
6967                 <span>{{quantity}}</span> x
6968             </div>
6969             <div class="grid__col-auto grid--align-self-center">
6970                 <div>{{productInfo.name}}</div>
6971                 {{#if productInfo.variantName}}
6972                 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small>
6973                 {{/if}}
6974                 {{#if productInfo.unitName}}
6975                 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small>
6976                 {{/if}}
6977             </div>
6978         </div>
6979     }
6980     
6981     @helper RenderAddToCartNotificationToggleScript()
6982     {
6983         int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
6984     
6985         <script>
6986             document.addEventListener('addToCart', function () {
6987                 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId');
6988             });
6989         </script>
6990     }
6991     @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
6992     
6993     @using System
6994     @using System.Web
6995     @using System.Collections.Generic
6996     @using Dynamicweb.Rapido.Blocks.Extensibility
6997     @using Dynamicweb.Rapido.Blocks
6998     @using Dynamicweb.Rapido.Blocks.Components.General
6999     
7000     @functions {
7001         BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master");
7002     }
7003     
7004     @{
7005         string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content");
7006         string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content");
7007         string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content");
7008         string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header");
7009         string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header");
7010         string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header");
7011     
7012         Block masterFooterContent = new Block()
7013         {
7014             Id = "MasterFooterContent",
7015             SortId = 10,
7016             Template = RenderFooter(),
7017             SkipRenderBlocksList = true
7018         };
7019         footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent);
7020     
7021         if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader))
7022         {
7023             Block masterFooterColumnOne = new Block
7024             {
7025                 Id = "MasterFooterColumnOne",
7026                 SortId = 10,
7027                 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent),
7028                 Design = new Design
7029                 {
7030                     Size = "auto",
7031                     RenderType = RenderType.Column
7032                 }
7033             };
7034             footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne);
7035         }
7036     
7037         if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader))
7038         {
7039             Block masterFooterColumnTwo = new Block
7040             {
7041                 Id = "MasterFooterColumnTwo",
7042                 SortId = 20,
7043                 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent),
7044                 Design = new Design
7045                 {
7046                     Size = "auto",
7047                     RenderType = RenderType.Column
7048                 }
7049             };
7050             footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo);
7051         }
7052     
7053         if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader))
7054         {
7055             Block masterFooterColumnThree = new Block
7056             {
7057                 Id = "MasterFooterColumnThree",
7058                 SortId = 30,
7059                 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent),
7060                 Design = new Design
7061                 {
7062                     Size = "auto",
7063                     RenderType = RenderType.Column
7064                 }
7065             };
7066             footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree);
7067         }
7068     
7069         if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp"))
7070         {
7071             Block masterFooterNewsletterSignUp = new Block
7072             {
7073                 Id = "MasterFooterNewsletterSignUp",
7074                 SortId = 40,
7075                 Template = RenderFooterNewsletterSignUp(),
7076                 Design = new Design
7077                 {
7078                     Size = "auto",
7079                     RenderType = RenderType.Column
7080                 }
7081             };
7082             footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp);
7083         }
7084     
7085         if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0)
7086         {
7087             Block masterFooterSocialLinks = new Block
7088             {
7089                 Id = "MasterFooterSocialLinks",
7090                 SortId = 50,
7091                 Template = RenderFooterSocialLinks(),
7092                 Design = new Design
7093                 {
7094                     Size = "auto",
7095                     RenderType = RenderType.Column
7096                 }
7097             };
7098             footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks);
7099         }
7100     
7101         if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0)
7102         {
7103             Block masterFooterPayments = new Block
7104             {
7105                 Id = "MasterFooterPayments",
7106                 SortId = 60,
7107                 Template = RenderFooterPayments(),
7108                 Design = new Design
7109                 {
7110                     Size = "12",
7111                     RenderType = RenderType.Column
7112                 }
7113             };
7114             footerBlocksPage.Add("MasterFooterContent", masterFooterPayments);
7115         }
7116     
7117         Block masterFooterCopyright = new Block
7118         {
7119             Id = "MasterFooterCopyright",
7120             SortId = 70,
7121             Template = RenderFooterCopyright(),
7122             Design = new Design
7123             {
7124                 Size = "12",
7125                 RenderType = RenderType.Column
7126             }
7127         };
7128         footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright);
7129     }
7130     
7131     @helper RenderFooter()
7132     {
7133         List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList();
7134     
7135         <footer class="footer dw-mod">
7136             <div class="center-container top-container__center-container dw-mod">
7137                 <div class="grid grid--external-bleed-x">
7138                     @RenderBlockList(subBlocks)
7139                 </div>
7140             </div>
7141         </footer>
7142     }
7143     
7144     @helper RenderFooterColumn(string header, string content)
7145     {
7146         <h3 class="footer__heading dw-mod">@header</h3>
7147         <div class="footer__content dw-mod">
7148             @content
7149         </div>
7150     }
7151     
7152     @helper RenderFooterNewsletterSignUp()
7153     {
7154         string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString();
7155         Form form = new Form { Action = "/Default.aspx", Method = FormMethod.Get, Enctype = FormEnctype.multipart };
7156     
7157         form.Add(new HiddenField { Name = "ID", Value = newsletterSignUpPageId });
7158         form.Add(new Text { Content = "<p>" + Translate("Sign up if you would like to receive occasional treats from us") + "</p>" });
7159         form.Add(new TextField {
7160             Id = "NewsletterEmail", Name = "NewsletterEmail", Placeholder = Translate("Your email address"),
7161             Type = TextFieldType.Email,
7162             ActionButton = new Button {
7163                 ButtonType = ButtonType.Submit, Id="Submitter", Title = Translate("Go"), OnClick = "Buttons.LockButton(event)", CssClass = "btn--condensed"
7164             }
7165         });
7166     
7167         <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3>
7168         <div class="footer__content dw-mod">
7169             @Render(form)
7170         </div>
7171     }
7172     
7173     @helper RenderFooterSocialLinks()
7174     {
7175         <h3 class="footer__heading dw-mod">@Translate("Social links")</h3>
7176         <div class="footer__content dw-mod">
7177             <div class="collection dw-mod">
7178                 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks"))
7179                 {
7180                     var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel;
7181                     string socialIconClass = socialIcon.SelectedValue;
7182                     string socialIconTitle = socialIcon.SelectedName;
7183                     string socialLink = socialitem.GetString("Link");
7184     
7185                     <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a>
7186                 }
7187             </div>
7188         </div>
7189     }
7190     
7191     @helper RenderFooterPayments()
7192     {
7193         <div class="footer__content dw-mod">
7194             <div class="collection dw-mod">
7195                 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments"))
7196                 {
7197                     var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel;
7198                     string paymentImage = null;
7199                     string paymentTitle = paymentItem.SelectedName;
7200                     ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault();
7201                     if (selected != null)
7202                     {
7203                         paymentImage = selected.Icon;
7204                     }
7205     
7206                     <div class="footer__card-type">
7207                         <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" />
7208                     </div>
7209                 }
7210             </div>
7211         </div>
7212     }
7213     
7214     @helper RenderFooterCopyright()
7215     {
7216         <div class="grid__col-12 footer__copyright dw-mod">
7217             <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p>
7218         </div>
7219     }
7220     @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
7221     
7222     @using System
7223     @using System.Web
7224     @using System.Collections.Generic
7225     @using Dynamicweb.Rapido.Blocks.Extensibility
7226     @using Dynamicweb.Rapido.Blocks
7227     @using Dynamicweb.Ecommerce.Common
7228     
7229     @{ 
7230         BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master");
7231     
7232         Block masterScriptReferences = new Block()
7233         {
7234             Id = "MasterScriptReferences",
7235             SortId = 1,
7236             Template = RenderMasterScriptReferences()
7237         };
7238         referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences);
7239     }
7240     
7241     @helper RenderMasterScriptReferences() {
7242         <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script>
7243         <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script>
7244     
7245         if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript"))
7246         {
7247             <script src="/Files/Templates/Designs/Rapido/js/custom.min.js"></script>
7248             PushPromise("/Files/Templates/Designs/Rapido/js/custom.min.js");
7249         }
7250     
7251         PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js");
7252         PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js");
7253     }
7254     @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
7255     
7256     @using System
7257     @using System.Web
7258     @using System.Collections.Generic
7259     @using Dynamicweb.Rapido.Blocks.Extensibility
7260     @using Dynamicweb.Rapido.Blocks
7261     @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
7262     @using Dynamicweb.Rapido.Services
7263     
7264     @{
7265         BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master");
7266         bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");
7267         bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID"));
7268     
7269         if (!navigationItemsHideSearch || isFavoriteList)
7270         {
7271             Block masterSearchScriptTemplates = new Block()
7272             {
7273                 Id = "MasterSearchScriptTemplates",
7274                 SortId = 1,
7275                 Template = RenderSearchScriptTemplates()
7276             };
7277     
7278             searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates);
7279         }
7280     }
7281     
7282     @helper RenderSearchScriptTemplates()
7283     {
7284         int productsPageId = GetPageIdByNavigationTag("ProductsPage");
7285         string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;
7286         bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID"));
7287         bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID"));
7288         bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults");
7289         bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton");
7290         bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton");
7291         bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton");
7292         bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
7293         
7294         <script id="SearchGroupsTemplate" type="text/x-template">
7295             {{#.}}
7296                 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li>
7297             {{/.}}
7298         </script>
7299     
7300         <script id="SearchProductsTemplate" type="text/x-template">
7301             {{#each .}}
7302                 {{#Product}}
7303                     {{#ifCond template "!==" "SearchMore"}}
7304                         <li class="dropdown__item dropdown__item--seperator dw-mod">
7305                             @if (useFacebookPixel)
7306                             {
7307                                 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text>
7308                             }
7309                             @if (useGoogleTagManager)
7310                             {
7311                                 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text>
7312                             }
7313                             <div>
7314                                 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}{{#if variantName}}, {{variantName}}{{/if}}">
7315                                     <div class="u-margin-right u-pull--left {{noimage}} u-hidden-xs u-hidden-xxs"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=45&height=36&crop=5&FillCanvas=True&Compression=75&image={{image}}" alt="{{name}}{{#if variantName}}, {{variantName}}{{/if}}"></div>
7316                                     <div class="u-pull--left">
7317                                         <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}{{#if variantName}}, {{variantName}}{{/if}}</div>
7318                                         @if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed())
7319                                         {
7320                                             if (pointShopOnly)
7321                                             {
7322                                                 <text>
7323                                                     {{#if havePointPrice}}
7324                                                         <div>
7325                                                             <span class="u-color--loyalty-points">{{points}}</span> @Translate("points")
7326                                                         </div>
7327                                                     {{else}}
7328                                                         <small class="help-text u-no-margin">@Translate("Not available")</small>
7329                                                     {{/if}}
7330                                                     {{#unless canBePurchasedWithPoints}}
7331                                                         {{#if havePointPrice}}
7332                                                             <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small>
7333                                                         {{/if}}
7334                                                     {{/unless}}
7335                                                 </text>
7336                                             }
7337                                             else
7338                                             {
7339                                                 <div>{{price}}</div>
7340                                             }
7341                                         }
7342                                     </div>
7343                                 </a>
7344                                 <div class="u-margin-left u-pull--right">
7345                                     @{
7346                                         var viewBtn = new Link
7347                                         {
7348                                             Href = "{{link}}",
7349                                             OnClick = "{{googleImpressionClick}}",
7350                                             ButtonLayout = ButtonLayout.Secondary,
7351                                             CssClass = "btn--condensed u-no-margin u-w80px js-ignore-click-outside",
7352                                             Title = Translate("View")
7353                                         };
7354                                     }
7355                                     @if (showAddToCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed())
7356                                     {
7357                                         <text>{{#if hideAddToCartButton}}</text>
7358                                             @Render(viewBtn)
7359                                         <text>{{else}}</text>
7360                                             @Render(new AddToCartButton 
7361                                             {
7362                                                 HideTitle = true,
7363                                                 ProductId = "{{productId}}",
7364                                                 ProductInfo = "{{productInfo}}",
7365                                                 BuyForPoints = pointShopOnly,
7366                                                 OnClick = "{{facebookPixelAction}}",
7367                                                 CssClass = "u-w80px js-ignore-click-outside",
7368                                                 Icon = new Icon {
7369                                                     CssClass = "js-ignore-click-outside"
7370                                                 },
7371                                                 ExtraAttributes = new Dictionary<string, string> 
7372                                                 {
7373                                                     { "{{disabledBuyButton}}", "" }
7374                                                 }
7375                                             })
7376                                         <text>{{/if}}</text>
7377                                     }
7378                                     else if (showViewButton)
7379                                     {
7380                                         @Render(viewBtn)
7381                                     }
7382                                     @if (showAddToDownloadButton)
7383                                     {
7384                                         <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}}">
7385                                             <i class="fas fa-plus js-button-icon"></i>
7386                                         </button>
7387                                     }
7388                                 </div>
7389                             </div>
7390                         </li>
7391                     {{/ifCond}}
7392                     {{#ifCond template "===" "SearchMore"}}
7393                         {{>SearchMoreProducts}}
7394                     {{/ifCond}}
7395                 {{/Product}}
7396             {{else}}
7397                 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod">
7398                     @Translate("Your search gave 0 results")
7399                 </li>
7400             {{/each}}
7401         </script>
7402     
7403         <script id="SearchMoreProducts" type="text/x-template">
7404             <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod">
7405                 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link">
7406                     @Translate("View all")
7407                 </a>
7408             </li>
7409         </script>
7410     
7411         <script id="SearchMorePages" type="text/x-template">
7412             <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod">
7413                 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link">
7414                     @Translate("View all")
7415                 </a>
7416             </li>
7417         </script>
7418     
7419         <script id="SearchPagesTemplate" type="text/x-template">
7420             {{#each .}}
7421                 {{#ifCond template "!==" "SearchMore"}}
7422                     <li class="dropdown__item dropdown__item--seperator dw-mod">
7423                         <div>
7424                             <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit">
7425                                 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div>
7426                                 <div class="u-pull--left">
7427                                     <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div>
7428                                 </div>
7429                             </a>
7430                         </div>
7431                     </li>
7432                     {{/ifCond}}
7433                 {{#ifCond template "===" "SearchMore"}}
7434                     {{>SearchMorePages}}
7435                 {{/ifCond}}
7436             {{else}}
7437                 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod">
7438                     @Translate("Your search gave 0 results")
7439                 </li>
7440             {{/each}}
7441         </script>
7442     
7443         <script id="SearchPagesTemplateWrap" type="text/x-template">
7444             <div class="dropdown__column-header">@Translate("Pages")</div>
7445             <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod">
7446                 {{>SearchPagesTemplate}}
7447             </ul>
7448         </script>
7449     
7450         <script id="SearchProductsTemplateWrap" type="text/x-template">
7451             <div class="dropdown__column-header">@Translate("Products")</div>
7452             <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod">
7453                 {{>SearchProductsTemplate}}
7454             </ul>
7455         </script>
7456     }
7457     
7458     @using Dynamicweb.Rapido.Blocks.Components
7459     @using Dynamicweb.Rapido.Blocks.Components.General
7460     @using Dynamicweb.Rapido.Blocks
7461     @using System.IO
7462     
7463     
7464     @using Dynamicweb.Rapido.Blocks.Components.General
7465     @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
7466     
7467     
7468     @* Component *@
7469     
7470     @helper RenderVariantMatrix(VariantMatrix settings) {
7471         if (settings != null)
7472         {
7473             int productLoopCounter = 0;
7474             int groupCount = 0;
7475             List<VariantOption> firstDimension = new List<VariantOption>();
7476             List<VariantOption> secondDimension = new List<VariantOption>();
7477             List<VariantOption> thirdDimension = new List<VariantOption>();
7478     
7479             foreach (VariantGroup variantGroup in settings.GetVariantGroups())
7480             {
7481                 foreach (VariantOption variantOptions in variantGroup.GetVariantOptions())
7482                 {
7483                     if (groupCount == 0) {
7484                         firstDimension.Add(variantOptions);
7485                     }
7486                     if (groupCount == 1)
7487                     {
7488                         secondDimension.Add(variantOptions);
7489                     }
7490                     if (groupCount == 2)
7491                     {
7492                         thirdDimension.Add(variantOptions);
7493                     }
7494                 }
7495                 groupCount++;
7496             }
7497     
7498             int rowCount = 0;
7499             int columnCount = 0;
7500     
7501             <script>
7502                 var variantsCollection = [];
7503             </script>
7504     
7505             <table class="table table--compact js-variants-matrix dw-mod" id="VariantMatrixTable_@settings.ProductId">
7506                 @if (groupCount == 1)
7507                 {
7508                     <tbody>
7509                         @foreach (VariantOption firstVariantOption in firstDimension)
7510                         {
7511                             var variantId = firstVariantOption.Id;
7512                             <tr>
7513                                 <td class="u-bold">
7514                                     @firstVariantOption.Name
7515                                 </td>
7516                                 <td>
7517                                     @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount)
7518                                 </td>
7519                             </tr>
7520                             productLoopCounter++;
7521                         }
7522     
7523                         <tr>
7524                             <td> </td>
7525                             <td>
7526                                 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div>
7527                             </td>
7528                         </tr>
7529                     </tbody>
7530                 }
7531                 @if (groupCount == 2)
7532                 {
7533                     <thead>
7534                         <tr>
7535                             <td> </td>
7536                             @foreach (VariantOption variant in secondDimension)
7537                             {
7538                                 <td>@variant.Name</td>
7539                             }
7540                         </tr>
7541                     </thead>
7542                     <tbody>
7543                         @foreach (VariantOption firstVariantOption in firstDimension)
7544                         {
7545                             string variantId = "";
7546                             columnCount = 0;
7547     
7548                             <tr>
7549                                 <td class="u-min-w120px">@firstVariantOption.Name</td>
7550     
7551                                 @foreach (VariantOption secondVariantOption in secondDimension)
7552                                 {
7553                                     variantId = firstVariantOption.Id + "." + secondVariantOption.Id;
7554                                     <td>
7555                                         @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount)
7556                                     </td>
7557     
7558                                     columnCount++;
7559     
7560                                     productLoopCounter++;
7561                                 }
7562     
7563                                 <td>
7564                                     <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div>
7565                                 </td>
7566                             </tr>
7567     
7568                             rowCount++;
7569                         }
7570     
7571                         @{
7572                             columnCount = 0;
7573                         }
7574     
7575                         <tr>
7576                             <td> </td>
7577                             @foreach (VariantOption secondVariantOption in secondDimension)
7578                             {
7579                                 <td>
7580                                     <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div>
7581                                 </td>
7582     
7583                                 columnCount++;
7584                             }
7585                             <td> </td>
7586                         </tr>
7587                     </tbody>
7588                 }
7589                 @if (groupCount == 3)
7590                 {
7591                     <thead>
7592                         <tr>
7593                             <td> </td>
7594                             @foreach (VariantOption thirdVariantOption in thirdDimension)
7595                             {
7596                                 <td>@thirdVariantOption.Name</td>
7597                             }
7598                         </tr>
7599                     </thead>
7600                     <tbody>
7601                         @foreach (VariantOption firstVariantOption in firstDimension)
7602                         {
7603                             int colspan = (thirdDimension.Count + 1);
7604     
7605                             <tr>
7606                                 <td colspan="@colspan" class="u-color-light-gray--bg u-bold">@firstVariantOption.Name</td>
7607                             </tr>
7608     
7609                             foreach (VariantOption secondVariantOption in secondDimension)
7610                             {
7611                                 string variantId = "";
7612                                 columnCount = 0;
7613     
7614                                 <tr>
7615                                     <td class="u-min-w120px">@secondVariantOption.Name</td>
7616     
7617                                     @foreach (VariantOption thirdVariantOption in thirdDimension)
7618                                     {
7619                                         variantId = firstVariantOption.Id + "." + secondVariantOption.Id + "." + thirdVariantOption.Id;
7620     
7621                                         <td>
7622                                             @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount)
7623                                         </td>
7624     
7625                                         columnCount++;
7626                                         productLoopCounter++;
7627                                     }
7628     
7629                                     <td>
7630                                         <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div>
7631                                     </td>
7632                                 </tr>
7633                                 rowCount++;
7634                             }
7635                         }
7636     
7637                         @{
7638                             columnCount = 0;
7639                         }
7640     
7641                         <tr>
7642                             <td> </td>
7643                             @foreach (VariantOption thirdVariantOption in thirdDimension)
7644                             {
7645                                 <td>
7646                                     <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div>
7647                                 </td>
7648     
7649                                 columnCount++;
7650                             }
7651                             <td> </td>
7652                         </tr>
7653                     </tbody>
7654                 }
7655             </table>
7656     
7657             <script>
7658                 document.addEventListener("DOMContentLoaded", function (event) {
7659                     MatrixUpdateQuantity("@settings.ProductId");
7660                 });
7661     
7662                 MatrixUpdateQuantity = function (productId) {
7663                     var currentMatrix = document.getElementById("VariantMatrixTable_" + productId);
7664                     var allQtyFields = currentMatrix.getElementsByClassName("js-qty");
7665     
7666                     var qtyRowArr = [];
7667                     var qtyColumnArr = [];
7668     
7669                     var totalQty = 0;
7670     
7671                     for (var i = 0; i < allQtyFields.length; i++) {
7672                         qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] = 0;
7673                         qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] = 0;
7674                     }
7675     
7676                     for (var i = 0; i < allQtyFields.length; i++) {
7677                         qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] += parseFloat(allQtyFields[i].value);
7678                         qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] += parseFloat(allQtyFields[i].value);
7679                         totalQty += parseFloat(allQtyFields[i].value);
7680                     }
7681     
7682                     //Update row counters
7683                     for (var i = 0; i < qtyRowArr.length; i++) {
7684                         var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0];
7685     
7686                         if (qtyRowArr[i] != undefined && qtyCounter != null) {
7687                             var currentCount = qtyCounter.innerHTML;
7688                             qtyCounter.innerHTML = qtyRowArr[i];
7689     
7690                             if (currentCount != qtyCounter.innerHTML) {
7691                                 qtyCounter.classList.add("qty-field--active");
7692                             }
7693                         }
7694             
7695                     }
7696     
7697                     //Update column counters
7698                     for (var i = 0; i < qtyColumnArr.length; i++) {
7699                         var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0];
7700     
7701                         if (qtyColumnArr[i] != undefined && qtyCounter != null) {
7702                             var currentCount = qtyCounter.innerHTML;
7703                             qtyCounter.innerHTML = qtyColumnArr[i];
7704     
7705                             if (currentCount != qtyCounter.innerHTML) {
7706                                 qtyCounter.classList.add("qty-field--active");
7707                             }
7708                         }
7709                     }
7710     
7711                     if (document.getElementById("TotalQtyCount_" + productId)) {
7712                         document.getElementById("TotalQtyCount_" + productId).innerHTML = totalQty;
7713                     }
7714     
7715                     //Clean up animations
7716                     setTimeout(function () {
7717                         for (var i = 0; i < qtyRowArr.length; i++) {
7718                             var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0];
7719                             if (qtyCounter != null) {
7720                                 qtyCounter.classList.remove("qty-field--active");
7721                             }
7722                         }
7723                         for (var i = 0; i < qtyColumnArr.length; i++) {
7724                             var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0];
7725                             if (qtyCounter != null) {
7726                                 qtyCounter.classList.remove("qty-field--active");
7727                             }
7728                         }
7729                     }, 1000);
7730                 }
7731             </script>
7732         }
7733     }
7734     
7735     @helper RenderVariantMatrixQuantityField(string variantId, VariantMatrix settings, int productLoopCounter, int rowCount, int columnCount)
7736     {
7737         string loopCount = productLoopCounter.ToString();
7738     
7739         bool combinationFound = false;
7740         double stock = 0;
7741         double quantityValue = 0;
7742         string note = "";
7743     
7744         VariantProduct variantProduct = null;
7745     
7746         if (settings.GetVariantProducts().TryGetValue(variantId, out variantProduct))
7747         {
7748             stock = variantProduct.Stock;
7749             quantityValue = variantProduct.Quantity;
7750             combinationFound = true;
7751         }
7752     
7753         if (combinationFound)
7754         {
7755             <input type="hidden" name="ProductLoopCounter@(loopCount)" value="@loopCount" />
7756             <input type="hidden" name="ProductID@(loopCount)" value="@settings.ProductId" />
7757             <input type="hidden" name="VariantID@(loopCount)" value="@variantId" />
7758             <input type="hidden" name="CurrentNote@(loopCount)" id="CurrentNote_@(settings.ProductId)_@variantId" value="@note" />
7759             <input type="number" name="Quantity@(loopCount)" id="Quantity_@(settings.ProductId)_@variantId" value="@quantityValue" min="0" class="js-qty u-no-margin u-full-max-width" style="width: 100%; max-width: 100%" onkeyup="MatrixUpdateQuantity('@settings.ProductId')" onmouseup="MatrixUpdateQuantity('@settings.ProductId')" data-qty-row-group="@rowCount" data-qty-column-group="@columnCount">
7760     
7761             if (stock != 0)
7762             {
7763                 <small>@Translate("Stock") @stock</small>
7764             }
7765     
7766             <script>
7767                 var variants = '{ "ProductId" :' + '"@settings.ProductId"' + ', "VariantId": ' + '"@variantId"' +'}';
7768                 variantsCollection.push(variants);
7769                 document.getElementById("Quantity_@(settings.ProductId)_@variantId").closest(".js-variants-matrix").setAttribute("data-variants-collection", "[" + variantsCollection + "]" );
7770             </script>
7771         }
7772         else
7773         {
7774             <div class="use-btn-height" style="background-color: #a8a8a8"></div>
7775         }
7776     }
7777     @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
7778     
7779     @* Component *@
7780     
7781     @helper RenderAddToCart(AddToCart settings)
7782     {
7783         //set Id for quantity selector to get it's value from button
7784         if (settings.QuantitySelector != null) 
7785         {
7786             if (string.IsNullOrEmpty(settings.QuantitySelector.Id)) 
7787             {
7788                 settings.QuantitySelector.Id = Guid.NewGuid().ToString("N");
7789             }
7790     
7791             settings.AddButton.QuantitySelectorId = settings.QuantitySelector.Id;
7792             
7793             if (settings.Disabled) 
7794             {
7795                 settings.QuantitySelector.Disabled = true;
7796             }
7797     
7798             if (string.IsNullOrEmpty(settings.QuantitySelector.Name)) 
7799             {
7800                 settings.QuantitySelector.Name = settings.QuantitySelector.Id;
7801             }
7802         }
7803     
7804         if (settings.Disabled) 
7805         {
7806             settings.AddButton.Disabled = true;
7807         }
7808         
7809         settings.AddButton.CssClass += " btn--condensed";
7810     
7811         //unitsSelector
7812         if (settings.UnitSelector != null)
7813         {
7814             if (settings.Disabled) 
7815             {
7816                 settings.QuantitySelector.Disabled = true;
7817             }
7818         }
7819     
7820         <div class="buttons-collection @settings.WrapperCssClass" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>        
7821             @if (settings.UnitSelector != null)
7822             {
7823                 @Render(settings.UnitSelector)
7824             }
7825             @if (settings.QuantitySelector != null)
7826             {
7827                 @Render(settings.QuantitySelector)
7828             }
7829             @Render(settings.AddButton)
7830         </div>
7831     }
7832     @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
7833     
7834     @* Component *@
7835     
7836     @helper RenderAddToCartButton(AddToCartButton settings)
7837     {
7838         if (!settings.HideTitle)
7839         {
7840             if (string.IsNullOrEmpty(settings.Title))
7841             {
7842                 if (settings.BuyForPoints)
7843                 {
7844                     settings.Title = Translate("Buy with points");
7845                 }
7846                 else
7847                 {
7848                     settings.Title = Translate("Add to cart");
7849                 }
7850             }
7851         }
7852         else
7853         {
7854             settings.Title = "";
7855         }
7856     
7857         if (settings.Icon == null)
7858         {
7859             settings.Icon = new Icon();
7860             settings.Icon.LabelPosition = Dynamicweb.Rapido.Blocks.Components.General.IconLabelPosition.After;
7861         }
7862     
7863         if (string.IsNullOrEmpty(settings.Icon.Name))
7864         {
7865             settings.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue;
7866         }
7867     
7868         settings.OnClick = "Cart.AddToCart(event, { " +
7869             "id: '" + settings.ProductId + "'," +
7870             (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") +
7871             (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") +
7872             (settings.BuyForPoints ? "buyForPoints: true," : "") +
7873             (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") +
7874             "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value)") +
7875         "});" + settings.OnClick;
7876         
7877         @RenderButton(settings)
7878     }
7879     @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
7880     
7881     @* Component *@
7882     
7883     @helper RenderUnitSelector(UnitSelector settings)
7884     {
7885         var id = settings.Id;
7886         var disabledClass = settings.Disabled ? "disabled" : "";
7887     
7888         <input type="checkbox" id="@id" class="dropdown-trigger" />
7889         <div class="dropdown unit-selector @settings.CssClass @disabledClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
7890             <label class="dropdown__header dropdown__btn dropdown__btn--unit-selector dw-mod" for="@id">@settings.SelectedOption</label>
7891             <div class="dropdown__content dw-mod">
7892                 @settings.OptionsContent
7893             </div>
7894             <label class="dropdown-trigger-off" for="@id"></label>
7895         </div>
7896     }
7897     @using System.Reflection
7898     @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
7899     
7900     @* Component *@
7901     
7902     @helper RenderQuantitySelector(QuantitySelector settings)
7903     {
7904         var attributes = new Dictionary<string, string>();
7905     
7906         /*base settings*/
7907         if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
7908         if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
7909         if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
7910         if (settings.Disabled) { attributes.Add("disabled", "true"); }
7911         if (settings.Required) { attributes.Add("required", "true"); }
7912         if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
7913         /*end*/
7914     
7915         if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
7916         if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
7917         if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
7918         if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
7919         if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); }
7920         if (settings.Min == null) { settings.Min = 1; }
7921         attributes.Add("min", settings.Min.ToString());
7922         if (settings.Step != null && !string.IsNullOrEmpty(settings.Step.ToString())) { attributes.Add("step", settings.Step.ToString()); }
7923         if (settings.Value == null) { settings.Value = 1; }
7924         attributes.Add("value", settings.Value.ToString());
7925         attributes.Add("type", "number");
7926     
7927         var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
7928     
7929         <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
7930     }
7931     @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
7932     
7933     @using System
7934     @using System.Web
7935     @using System.Collections.Generic
7936     @using Dynamicweb.Rapido.Blocks.Extensibility
7937     @using Dynamicweb.Rapido.Blocks
7938     
7939     @{ 
7940         BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master");
7941     
7942         Block primaryBottomSnippets = new Block()
7943         {
7944             Id = "MasterJavascriptInitializers",
7945             SortId = 100,
7946             Template = RenderPrimaryBottomSnippets()
7947         };
7948         bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets);
7949     }
7950     
7951     @helper RenderPrimaryBottomSnippets() {
7952         bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode");
7953         bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));
7954     
7955         if (isWireframeMode)
7956         {
7957             <script>
7958                 Wireframe.Init(true);
7959             </script>
7960         }
7961     
7962     
7963         if (useGoogleTagManager)
7964         {
7965             <script>
7966                 document.addEventListener('addToCart', function(event) {
7967                     var googleImpression = event.detail.productInfo.googleImpression;
7968                     dataLayer.push({
7969                         'event': 'addToCart',
7970                         'ecommerce': {
7971                             'currencyCode': '@Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency().Code',
7972                             'add': {
7973                                 'products': [{
7974                                     'name': googleImpression.name,
7975                                     'id': googleImpression.id,
7976                                     'price': googleImpression.price,
7977                                     'brand': googleImpression.brand,
7978                                     'category': googleImpression.category,
7979                                     'variant': googleImpression.variant,
7980                                     'quantity': event.detail.quantity
7981                                 }]
7982                             }
7983                         }
7984                     });
7985                 });
7986             </script>
7987     }
7988     
7989         //if digitalwarehouse
7990         if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart")) 
7991         {
7992             string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]);
7993     
7994             if (string.IsNullOrEmpty(cartContextId)) {
7995                 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2");
7996                 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps);
7997                 cartContextId = cartSettings.OrderContextID;
7998                 HttpContext.Current.Application["DownloadCartContext"] = cartContextId;
7999             }
8000             
8001             <script>
8002                 let downloadCart = new DownloadCart({
8003                     cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"),
8004                     contextId: "@cartContextId",
8005                     addButtonText: "@Translate("Add")",
8006                     removeButtonText: "@Translate("Remove")"
8007                 });
8008             </script>
8009         }
8010     
8011         <!--$$Javascripts-->
8012     }
8013     @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
8014     
8015     @using System
8016     @using System.Web
8017     @using System.Linq
8018     @using System.Collections.Generic
8019     @using Dynamicweb.Rapido.Blocks
8020     @using Dynamicweb.Frontend
8021     
8022     @{
8023         BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master");
8024     
8025     
8026         Block FixCookieScript = new Block()
8027         {
8028             Id = "FixCookieScript",
8029             SortId = 60,
8030             Template = RenderFixCookieScript()
8031         };
8032     
8033         masterCustomBlocksPage.Add("MasterBottomSnippets", FixCookieScript);
8034     
8035     
8036         Block UpdateBrowser = new Block()
8037         {
8038             Id = "UpdateBrowser",
8039             SortId = 70,
8040             Template = RenderUpdateBrowser()
8041         };
8042     
8043     
8044         bool enableUpdateBrowser = Model.Area.Item.GetItem("Custom").GetBoolean("UBEnable");
8045       
8046         
8047     
8048     
8049         if (enableUpdateBrowser){
8050     
8051             masterCustomBlocksPage.Add("MasterBottomSnippets", UpdateBrowser);
8052     
8053         }
8054     
8055         Block LeftoversOrderlines = new Block()
8056         {
8057             Id = "LeftoversOrderlines",
8058             SortId = 80,
8059             Template = RenderLeftoversOrderlines()
8060         };
8061     
8062         masterCustomBlocksPage.Add("MasterBottomSnippets", LeftoversOrderlines);
8063     
8064     
8065     
8066     
8067         @helper RenderFixCookieScript()
8068         {
8069              <div id="purecookiebanner"></div>  
8070         }
8071     
8072     
8073     
8074         var referencesBlock = masterCustomBlocksPage.GetBlockById("MasterScriptReferences");
8075         if (referencesBlock != null)
8076         {
8077             referencesBlock.Template = RenderMasterScriptReferencesCustom();
8078         }
8079     
8080         var headCssBlock = masterCustomBlocksPage.GetBlockById("HeadCss");
8081         if (headCssBlock != null)
8082         {
8083             headCssBlock.Template = RenderMasterCssCustom();
8084         }
8085     
8086         masterCustomBlocksPage.GetBlockById("MasterFooterColumnOne").Template = RenderFooterColumnAboutUs(footerColumnOneHeader, footerColumnOneContent);
8087         masterCustomBlocksPage.GetBlockById("MasterFooterColumnTwo").Template = RenderFooterColumnContactInfo(footerColumnTwoHeader, footerColumnTwoContent);
8088     
8089         if (masterCustomBlocksPage.GetBlockById("ImpersonationSearchTemplates") != null)
8090         {
8091             masterCustomBlocksPage.GetBlockById("ImpersonationSearchTemplates").Template = RenderSearchResultTemplateCustom();
8092         }
8093     
8094         //Minicart
8095         masterCustomBlocksPage.GetBlockById("MiniCartOrderlinesTableHeader").Template = RenderMiniCartOrderLinesHeaderCustom();
8096         masterCustomBlocksPage.GetBlockById("OrderlinesScriptTemplates").Template = RenderMiniCartScriptsTableTemplatesCustom();
8097     
8098         Block vueJs = new Block()
8099         {
8100             Id = "VueJs",
8101             SortId = 1,
8102             Template = RenderVueJs()
8103         };
8104         masterCustomBlocksPage.Add(MasterBlockId.MasterReferences, vueJs);
8105     
8106         if (masterCustomBlocksPage.GetBlockById("MasterSearchScriptTemplates") != null)
8107         {
8108             masterCustomBlocksPage.GetBlockById("MasterSearchScriptTemplates").Template = RenderSearchScriptTemplatesCustom();
8109         }
8110     
8111         var minicartActionButtons = masterCustomBlocksPage.GetBlockById("MiniCartActions");
8112         if (minicartActionButtons != null)
8113         {
8114             minicartActionButtons.Template = RenderMiniCartActionsCustom();
8115         }
8116     
8117         masterCustomBlocksPage.GetBlockById("MasterMiniCartTemplates").Add(new Block
8118         {
8119             Id = "EmptyCartConfirmationModal",
8120             Template = RenderEmptyCartConfirmationModal(),
8121             SortId = 30
8122         });
8123     
8124         masterCustomBlocksPage.GetBlockById("MasterBottomSnippets").Add(new Block
8125         {
8126             Id = "LeftoversModal",
8127             Template = RenderLeftoversModal(),
8128             SortId = 45
8129         });
8130     
8131         masterCustomBlocksPage.GetBlockById("MiniCartFooter").Add(new Block
8132         {
8133             Id = "MiniCartTotalWeight",
8134             Template = RenderMiniCartTotalWeight(),
8135             SortId = 45
8136         });
8137     
8138         var mobileMiniCart = masterCustomBlocksPage.GetBlockById("MobileHeaderMiniCart");
8139         if (mobileMiniCart != null)
8140         {
8141             mobileMiniCart.Template = RenderMobileTopMiniCartCustom();
8142         }
8143     }
8144     
8145     @helper RenderMobileTopMiniCartCustom()
8146     {
8147         int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
8148         int cartPageId = GetPageIdByNavigationTag("CartPage");
8149         double cartProductsCount = Model.Cart.TotalProductsCount;
8150         var cart = Dynamicweb.Ecommerce.Common.Context.Cart;
8151         var totalWeight = "";
8152         if (cart != null)
8153         {
8154             totalWeight = cart.OrderFieldValues.GetOrderFieldValue("OrderTotalWeight").Value.ToString();
8155         }
8156         else
8157         {
8158             totalWeight = "0";
8159         }
8160     
8161         <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper">
8162             <div class="mini-cart dw-mod">
8163                 <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">
8164                     <div class="u-inline u-position-relative">
8165                         <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue  fa-1_5x"></i>
8166                         <div class="mini-cart__counter dw-mod">
8167                             <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">
8168                                 <div class="js-mini-cart-counter-content" data-count="@totalWeight">
8169                                     @totalWeight
8170                                 </div>
8171                             </div>
8172                         </div>
8173                     </div>
8174                 </a>
8175             </div>
8176         </li>
8177     }
8178     
8179     @helper RenderSearchScriptTemplatesCustom()
8180     {
8181         int productsPageId = GetPageIdByNavigationTag("SearchInAllProducts");
8182         string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;
8183         bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID"));
8184         bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID"));
8185         bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults");
8186         bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton");
8187         bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton");
8188         bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton");
8189         bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
8190     
8191         <script id="SearchGroupsTemplate" type="text/x-template">
8192             {{#.}}
8193             <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li>
8194             {{/.}}
8195         </script>
8196     
8197         <script id="SearchProductsTemplate" type="text/x-template">
8198             {{#each .}}
8199             {{#Product}}
8200             {{#ifCond template "!==" "SearchMore"}}
8201             <li class="dropdown__item dropdown__item--seperator dw-mod">
8202                 @if (useFacebookPixel)
8203                 {
8204                     <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text>
8205                 }
8206                 @if (useGoogleTagManager)
8207                 {
8208                     <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text>
8209                 }
8210                 <div>
8211                     <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}{{#if variantName}}, {{variantName}}{{/if}}">
8212                         <div class="u-margin-right u-pull--left {{noimage}} u-hidden-xs u-hidden-xxs"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=45&height=36&crop=5&FillCanvas=True&Compression=75&image={{image}}" alt="{{name}}{{#if variantName}}, {{variantName}}{{/if}}"></div>
8213                         <div class="u-pull--left">
8214                             <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}{{#if variantName}}, {{variantName}}{{/if}}</div>
8215                             @if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed() && Pageview.User != null)
8216                             {
8217                                 if (pointShopOnly)
8218                                 {
8219                                     <text>
8220                                         {{#if havePointPrice}}
8221                                         <div>
8222                                             <span class="u-color--loyalty-points">{{points}}</span> @Translate("points")
8223                                         </div>
8224                                         {{else}}
8225                                         <small class="help-text u-no-margin">@Translate("Not available")</small>
8226                                         {{/if}}
8227                                         {{#unless canBePurchasedWithPoints}}
8228                                         {{#if havePointPrice}}
8229                                         <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small>
8230                                         {{/if}}
8231                                         {{/unless}}
8232                                     </text>
8233                                 }
8234                                 else
8235                                 {
8236                                     <div>{{price}}</div>
8237                                 }
8238                             }
8239                         </div>
8240                     </a>
8241                     <div class="u-margin-left u-pull--right">
8242                         @{
8243                             var viewBtn = new Link
8244                             {
8245                                 Href = "{{link}}",
8246                                 OnClick = "{{googleImpressionClick}}",
8247                                 ButtonLayout = ButtonLayout.Secondary,
8248                                 CssClass = "btn--condensed u-no-margin u-w80px js-ignore-click-outside",
8249                                 Title = Translate("View")
8250                             };
8251                         }
8252                         @if (showAddToCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed())
8253                         {
8254                             <text>{{#if hideAddToCartButton}}</text>
8255                             @Render(viewBtn)
8256                             <text>{{else}}</text>
8257                             @Render(new AddToCartButton
8258                             {
8259                                 HideTitle = true,
8260                                 ProductId = "{{productId}}",
8261                                 ProductInfo = "{{productInfo}}",
8262                                 BuyForPoints = pointShopOnly,
8263                                 OnClick = "{{facebookPixelAction}}",
8264                                 CssClass = "u-w80px js-ignore-click-outside",
8265                                 Icon = new Icon
8266                                 {
8267                                     CssClass = "js-ignore-click-outside"
8268                                 },
8269                                 ExtraAttributes = new Dictionary<string, string>
8270                                 {
8271                                     { "{{disabledBuyButton}}", "" }
8272                                 }
8273                             })
8274                             <text>{{/if}}</text>
8275                         }
8276                         else if (showViewButton)
8277                         {
8278                             @Render(viewBtn)
8279                         }
8280                         @if (showAddToDownloadButton)
8281                         {
8282                             <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}}">
8283                                 <i class="fas fa-plus js-button-icon"></i>
8284                             </button>
8285                         }
8286                     </div>
8287                 </div>
8288             </li>
8289             {{/ifCond}}
8290             {{#ifCond template "===" "SearchMore"}}
8291             {{>SearchMoreProducts}}
8292             {{/ifCond}}
8293             {{/Product}}
8294             {{else}}
8295             <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod">
8296                 @Translate("Your search gave 0 results")
8297             </li>
8298             {{/each}}
8299         </script>
8300     
8301         <script id="SearchMoreProducts" type="text/x-template">
8302             <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod">
8303                 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link">
8304                     @Translate("View all")
8305                 </a>
8306             </li>
8307         </script>
8308     
8309         <script id="SearchMorePages" type="text/x-template">
8310             <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod">
8311                 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link">
8312                     @Translate("View all")
8313                 </a>
8314             </li>
8315         </script>
8316     
8317         <script id="SearchPagesTemplate" type="text/x-template">
8318             {{#each .}}
8319             {{#ifCond template "!==" "SearchMore"}}
8320             <li class="dropdown__item dropdown__item--seperator dw-mod">
8321                 <div>
8322                     <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit">
8323                         <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div>
8324                         <div class="u-pull--left">
8325                             <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div>
8326                         </div>
8327                     </a>
8328                 </div>
8329             </li>
8330             {{/ifCond}}
8331             {{#ifCond template "===" "SearchMore"}}
8332             {{>SearchMorePages}}
8333             {{/ifCond}}
8334             {{else}}
8335             <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod">
8336                 @Translate("Your search gave 0 results")
8337             </li>
8338             {{/each}}
8339         </script>
8340     
8341         <script id="SearchPagesTemplateWrap" type="text/x-template">
8342             <div class="dropdown__column-header">@Translate("Pages")</div>
8343             <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod">
8344                 {{>SearchPagesTemplate}}
8345             </ul>
8346         </script>
8347     
8348         <script id="SearchProductsTemplateWrap" type="text/x-template">
8349             <div class="dropdown__column-header">@Translate("Products")</div>
8350             <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod">
8351                 {{>SearchProductsTemplate}}
8352             </ul>
8353         </script>
8354     }
8355     
8356     @helper RenderTypeaheadSearchCustom()
8357     {
8358         <div class="typeahead u-ta-right impersonation__typeahead js-typeahead dw-mod" id="ImpersonationSearchBar"
8359              data-page-size="5"
8360              data-search-feed-id="@impersonationFeed"
8361              data-result-page-id="@impersonationPageId"
8362              data-search-type="user-search"
8363              data-search-parameter-name="q">
8364     
8365             <div class="typeahead-search-field">
8366                 <input type="text" class="u-no-margin js-typeahead-search-field" placeholder="@Translate("Search users")">
8367                 <ul class="dropdown dropdown--absolute-position 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>
8368             </div>
8369         </div>
8370     }
8371     
8372     @helper RenderSearchResultTemplateCustom()
8373     {
8374         <script id="ImpersonationSearchResult" type="text/x-template">
8375             {{#.}}
8376             {{#Users}}
8377             <li class="impersonation__search-results-item impersonation-user">
8378                 <form method="post" class="impersonation-user__form" name="account{{id}}">
8379                     <input type="hidden" id="DWExtranetSecondaryUserSelector" name="DWExtranetSecondaryUserSelector" value="{{id}}">
8380                     <div class="impersonation-user__info">
8381                         <div class="impersonation-user__name">{{userName}}</div>
8382                         <div class="impersonation-user__number">{{company}}</div>
8383                     </div>
8384                     @Render(new Button
8385                        {
8386                            ButtonType = ButtonType.Submit,
8387                            ButtonLayout = ButtonLayout.Secondary,
8388                            Title = Translate("Sign in as"),
8389                            CssClass = "impersonation-user__sign-in-btn" + (impersonationLayout != "bar" ? " btn--impersonation" : "")
8390                        })
8391                 </form>
8392             </li>
8393             {{/Users}}
8394             {{#unless Users}}
8395             <li class="impersonation__search-results-item impersonation__search-results-item--not-found">
8396                 @Translate("Your search gave 0 results")
8397             </li>
8398             {{/unless}}
8399             {{/.}}
8400         </script>
8401     }
8402     
8403     @helper RenderFooterColumnAboutUs(string header, string content)
8404     {
8405         var startLevel = 0;
8406         <h3 class="footer__heading dw-mod">@header</h3>
8407         <div class="footer__content dw-mod">
8408             @RenderNavigation(new
8409            {
8410                 id = "footerMenuNavigation",
8411                 cssclass = "menu menu-tools dw-mod",
8412                 startLevel = startLevel,
8413                 ecomStartLevel = startLevel + 1,
8414                 endlevel = 5,
8415                 expandmode = "all",
8416                 template = "FooterMenu.xslt"
8417            })
8418         </div>
8419     }
8420     
8421     @helper RenderFooterColumnContactInfo(string header, string content)
8422     {
8423         if (header.ToLower().Contains("contact") || header.ToLower().Contains("kontakt"))
8424         {
8425             var salesRepCustomerNumber = "";
8426     
8427             if (Pageview.User != null)
8428             {
8429                 salesRepCustomerNumber = !string.IsNullOrEmpty(Pageview.User.CustomFieldValues.Where(cf => cf.CustomField.SystemName == "AccessUser_SalesRepCustomerNumber").FirstOrDefault().Value.ToString()) ? Pageview.User.CustomFieldValues.Where(cf => cf.CustomField.SystemName == "AccessUser_SalesRepCustomerNumber").FirstOrDefault().Value.ToString() : "";
8430                 if (!string.IsNullOrEmpty(salesRepCustomerNumber))
8431                 {
8432                     var user = Dynamicweb.Security.UserManagement.User.GetUserBySql($"SELECT top 1 * FROM accessuser where ACCESSUSERCUSTOMERNUMBER = '{salesRepCustomerNumber}'");
8433                     if (user != null)
8434                     {
8435                         List<string> userData = new List<string>();
8436                         userData.Add(user.Address);
8437                         userData.Add(user.HouseNumber);
8438                         userData.Add(user.City);
8439                         userData.Add(user.Country);
8440                         userData = userData.Where(s => !string.IsNullOrWhiteSpace(s)).Distinct().ToList();
8441     
8442     
8443                         string skype = user.CustomFieldValues.Where(cf => cf.CustomField.SystemName == "AccessUser_Skype").FirstOrDefault().Value.ToString();
8444     
8445                         <h3 class="footer__heading dw-mod">@header</h3>
8446                         <div class="footer__content dw-mod">
8447                             @if (!string.IsNullOrEmpty(user.Image))
8448                             {
8449                                 <img src="@user.Image" alt="@user.Name" />
8450                             }
8451                             <p class="u-no-margin">@user.Name</p>
8452                             <p class="u-no-margin"><span class="u-margin-right fas fa-fw fa-mobile-alt fa-lg"></span>@Translate("Phone number"): <a href="tel:@user.Phone">@user.Phone</a></p>
8453                             <p class="u-no-margin"><span class="u-margin-right fas fa-fw fa-envelope fa-lg"></span>@Translate("E-mail"): <a href="mailto:@user.Email">@user.Email</a></p>
8454                             <p class="u-no-margin"><span class="u-margin-right fas fa-fw fa-users fa-lg"></span><a target="_blank" href="https://teams.microsoft.com/l/chat/0/0?users=@user.Email">Microsoft Teams</a></p>
8455                             <p class="u-no-margin">@String.Join(", ", userData)</p>
8456                         </div>
8457                     }
8458                 }
8459                 else
8460                 {
8461                     @RenderDefaultColumn(header, content)
8462                 }
8463     
8464             }
8465             else
8466             {
8467                 @RenderDefaultColumn(header, content)
8468             }
8469         }
8470         else
8471         {
8472             @RenderDefaultColumn(header, content)
8473         }
8474     }
8475     
8476     @helper RenderDefaultColumn(string header, string content)
8477     {
8478         <h3 class="footer__heading dw-mod">@header</h3>
8479         <div class="footer__content dw-mod">
8480             @content
8481         </div>
8482     }
8483     
8484     @helper RenderVueJs()
8485     {
8486         <script src="https://cdn.jsdelivr.net/npm/vue@2.6.11"></script>
8487     }
8488     
8489     @helper RenderMiniCartScriptsTableTemplatesCustom()
8490     {
8491         <script id="MiniCartOrderline" type="text/x-template">
8492             {{#unless isEmpty}}
8493             <tr id="Orderline{{id}}">
8494                 <td colspan="100%" class="u-no-padding">
8495                     <table class="table u-no-margin--bottom">
8496                         <tr>
8497                             <td width="50%" class="u-va-middle u-line-height--normal">
8498                                 <a href="{{link}}" class="mini-cart-orderline__name u-font-size--sm" title="{{name}}">{{name}}</a>
8499                                 {{#if variantname}}<small class="u-font-size--xs u-line-height--normal">{{variantname}}</small>{{/if}}
8500                             </td>
8501                             <td width="25%" class="u-va-middle"><div class="u-ta-right u-bold u-font-size--xs">{{quantity}} <small class="unit-in-cart u-line-height--normal">{{unitname}}</small></div></td>
8502                             <td width="25%" class="u-va-middle">
8503                                 <div class="u-ta-right u-font-size--xs u-bold">{{totalprice}}</div>
8504                             </td>
8505                         </tr>
8506                     </table>
8507     
8508                     {{#if treatments}}
8509                     {{#treatments}}
8510                     <table class="table u-margin-bottom-5px">
8511                         <tr>
8512                             <td width="50%" class="u-no-border u-va-middle u-no-padding-y"><div class="u-uppercase u-font-size--xs" style="line-height: 1;">{{name}}</div></td>
8513                             <td width="25%" class="u-no-border u-va-middle u-no-padding-y"><div class=" u-font-size--xs u-ta-right">{{quantity}} <small class="unit-in-cart u-line-height--normal">{{unitname}}</small></div></td>
8514                             <td width="25%" class="u-no-border u-va-middle u-no-padding-y"><div class="u-ta-right u-font-size--xs">{{totalprice}}</div></td>
8515                         </tr>
8516                     </table>
8517                     {{/treatments}}
8518                     {{/if}}
8519                 </td>
8520             </tr>
8521             {{/unless}}
8522     
8523         </script>
8524     
8525         <script id="MiniCartOrderlineDiscount" type="text/x-template">
8526             {{#unless isEmpty}}
8527             <tr class="table__row--no-border">
8528                 <td class="u-w60px"> </td>
8529                 <td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td>
8530                 <td class="u-ta-right"> </td>
8531                 <td class="u-ta-right">{{totalprice}}</td>
8532             </tr>
8533             {{/unless}}
8534         </script>
8535     }
8536     
8537     @helper RenderMiniCartOrderLinesHeaderCustom()
8538     {
8539         <thead>
8540             <tr>
8541                 <td width="50%">@Translate("Product")</td>
8542                 <td width="25%" class="u-ta-right">@Translate("Amount")</td>
8543                 <td width="25%" class="u-ta-right">@Translate("Total Price")</td>
8544             </tr>
8545         </thead>
8546     }
8547     
8548     @helper RenderMiniCartActionsCustom()
8549     {
8550         int cartPageId = GetPageIdByNavigationTag("CartPage");
8551         <button type="button" title="@Translate("Empty cart")" class="btn btn--secondary u-full-width dw-mod u-no-margin u-margin-bottom" onclick="SolteqApi.showConfirmationModal();">@Translate("Empty cart")</button>
8552         <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>
8553     }
8554     
8555     @helper RenderEmptyCartConfirmationModal()
8556     {
8557         <input type="checkbox" id="EmptyCartConfirmation" class="modal-trigger" />
8558         <div class="modal-container modal-overlay">
8559             <label for="EmptyCartConfirmation" id="EmptyCartConfirmationModalOverlay" class="" onclick="event.preventDefault();"></label>
8560             <div class="modal" id="EmptyCartConfirmationModal">
8561                 <div class="modal__header u-ta-center">
8562                     <h4>@Translate("Are you sure you would like to empty cart?")</h4>
8563                 </div>
8564                 <div class="modal__body u-ta-center u-no-padding u-margin-top">
8565                     <div class="btn btn-danger" onclick="SolteqApi.confirmEmptyCart();">@Translate("YES")</div>
8566                     <div class="btn btn--primary btn--active" onclick="SolteqApi.closeModal();">@Translate("NO")</div>
8567                 </div>
8568             </div>
8569         </div>
8570     }
8571     
8572     @helper RenderMiniCartTotalWeight()
8573     {
8574         <div class="grid grid--direction-row dw-mod u-border-top u-padding">
8575             <small class="grid__col-6 grid__col--bleed-y u-no-padding">@Translate("Total weight"):</small>
8576             <small class="grid__col-6 grid__col--bleed-y u-no-padding grid--align-end">
8577                 <span><span class="normal-text">{{totalWeight}}</span> KG</span>
8578             </small>
8579         </div>
8580     }
8581     
8582     @helper RenderMasterScriptReferencesCustom()
8583     {
8584         <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script>
8585         <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script>
8586         <script src="/Files/Templates/Designs/Rapido/js/purecookie.js"></script>
8587     
8588         if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript"))
8589         {
8590             <script src="/Files/Templates/Designs/Rapido/js/custom.min.js?v=@DateTime.Now.Ticks"></script>
8591             PushPromise("/Files/Templates/Designs/Rapido/js/custom.min.js");
8592         }
8593     
8594         PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js");
8595         PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js");
8596         PushPromise("/Files/Templates/Designs/Rapido/js/purecookie.js");
8597     }
8598     
8599     @helper RenderMasterCssCustom()
8600     {
8601         var fonts = new string[] {
8602         getFontFamily("Layout", "HeaderFont"),
8603         getFontFamily("Layout", "SubheaderFont"),
8604         getFontFamily("Layout", "TertiaryHeaderFont"),
8605         getFontFamily("Layout", "BodyText"),
8606         getFontFamily("Layout", "Header", "ToolsFont"),
8607         getFontFamily("Layout", "Header", "NavigationFont"),
8608         getFontFamily("Layout", "MobileNavigation", "Font"),
8609         getFontFamily("ProductList", "Facets", "HeaderFont"),
8610         getFontFamily("ProductPage", "PriceFontDesign"),
8611         getFontFamily("Ecommerce", "SaleSticker", "Font"),
8612         getFontFamily("Ecommerce", "NewSticker", "Font"),
8613         getFontFamily("Ecommerce", "CustomSticker", "Font")
8614         };
8615     
8616         string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks;
8617         string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png";
8618         bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro");
8619         string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css";
8620         if (useFontAwesomePro)
8621         {
8622             fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css";
8623         }
8624     
8625         //Favicon
8626         <link href="@favicon" rel="icon" type="image/png">
8627     
8628         //Base (Default, wireframe) styles
8629         <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css">
8630     
8631         //Rapido Css from Website Settings
8632         <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css">
8633     
8634         //Ignite Css (Custom site specific styles)
8635         <link rel="stylesheet" id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css?v=@DateTime.Now.Ticks">
8636     
8637         //PureCookie Css
8638         <link rel="stylesheet" id="pureCookieCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/purecookie/purecookie.css">
8639     
8640         //Font awesome
8641         <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css">
8642     
8643         //Flag icon
8644         <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css">
8645     
8646         //Google fonts
8647         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)));
8648     
8649           //Custom Css
8650         <link rel="stylesheet" id="customCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/custom.css?ver=1.02">
8651     
8652         <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet">
8653     
8654         PushPromise(favicon);
8655         PushPromise(fontAwesomeCssLink);
8656         PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css");
8657         PushPromise(autoCssLink);
8658         PushPromise("/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css");
8659         PushPromise("/Files/Templates/Designs/Rapido/css/purecookie/purecookie.css");
8660         PushPromise("/Files/Images/placeholder.gif");
8661         PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css");
8662     }
8663     
8664     
8665     
8666     @helper RenderUpdateBrowser(){
8667     
8668         
8669         
8670       
8671         if (!HttpContext.Current.Request.Cookies.AllKeys.Contains("browserupdatecheck"))
8672         {
8673     
8674             bool enableUpdateBrowser = Model.Area.Item.GetItem("Custom").GetBoolean("UBEnable");
8675             string UBFirefox = Model.Area.Item.GetItem("Custom").GetString("UBFirefox");
8676             string UBOpera = Model.Area.Item.GetItem("Custom").GetString("UBOpera");
8677             string UBChrome = Model.Area.Item.GetItem("Custom").GetString("UBChrome");
8678             string UBEdge_IE = Model.Area.Item.GetItem("Custom").GetString("UBEdge_IE");
8679             string UBSafari = Model.Area.Item.GetItem("Custom").GetString("UBSafari");
8680             string UBPageLink = Model.Area.Item.GetItem("Custom").GetString("UpdateBrowserPage");
8681     
8682             <script> 
8683                 var $buoop = {required:{e:@(UBEdge_IE),f:@(UBFirefox),o:@(UBOpera),s:@(UBSafari),c:@(UBChrome)},mobile:false,api:2021.02,redirectLink:"@UBPageLink" }; 
8684                 function $buo_f(){ 
8685                 var e = document.createElement("script"); 
8686                 e.src = "https://www.norskstaal.no/Files/Templates/Designs/Rapido/js/update.min.js"; 
8687                 document.body.appendChild(e);
8688                 };
8689                 try {document.addEventListener("DOMContentLoaded", $buo_f,false)}
8690                 catch(e){window.attachEvent("onload", $buo_f)}
8691             </script>
8692         }
8693     
8694     }
8695     
8696     
8697     @helper RenderLeftoversModal()
8698     {
8699     
8700         <input type="checkbox" id="LeftoversModal" class="modal-trigger" />
8701         <div class="modal-container modal-overlay">
8702             <label for="LeftoversModal" id="LeftoversModalModalOverlay" class="" onclick="event.preventDefault();"></label>
8703             <div class="modal" id="LeftoversModalModal">
8704                 <div class="modal__header u-ta-center">
8705                     <div class="stage-1">
8706                         <h4>@Translate("Leftover product added to cart")</h4>
8707                         <h5>@Translate("Product reserved for 2 hours")</h5>
8708                     </div>
8709                 </div>
8710                 <div class="modal__body u-ta-center u-no-padding u-margin-top">
8711                     <div class="btn btn-danger" onclick='document.getElementById("LeftoversModal").checked = false'>@Translate("OK")</div>
8712                 </div>
8713             
8714                 
8715             </div>
8716         </div>
8717     
8718     
8719         <script> 
8720     
8721                 function $checkLeftovers(){ 
8722                     var theCookies = document.cookie.split(';');
8723                     var cookieElements = '';
8724     
8725                     for (var i = 1 ; i <= theCookies.length; i++) {
8726                   
8727     
8728                         if (theCookies[i-1].includes("LeftoverProduct_")){
8729                            
8730                            cookieElements = theCookies[i-1].split("=", 2);
8731                             
8732                             if (cookieElements[1] == 2){
8733                                 document.getElementById("LeftoversModal").checked = true;
8734     
8735                                 var expiryTime = new Date();
8736                                 expiryTime.setTime(expiryTime.getTime() + (2 * 3600 * 1000));
8737                                 document.cookie = cookieElements[0] + " = 1; path=/; expires=" + expiryTime;
8738                                 
8739                             }
8740     
8741                         }   
8742                     }
8743         
8744                 };
8745                 try {document.addEventListener("DOMContentLoaded", $checkLeftovers,false)}
8746                 catch(e){window.attachEvent("onload", $checkLeftovers)}
8747         </script>
8748     
8749         
8750     }
8751     
8752     
8753     
8754     
8755     @helper RenderLeftoversOrderlines()
8756     {
8757     
8758         var leftoversOrderlinesFeedPageId = GetPageIdByNavigationTag("LeftoversOrderlinesFeed");
8759        
8760         <div class="js-handlebars-root" id="LeftOversOrderlinesContent" data-template="LeftOversOrderlines" data-json-feed="/Default.aspx?ID=@leftoversOrderlinesFeedPageId" data-preloader="none"></div>
8761       
8762     
8763          <script id="LeftOversOrderlines" type="text/x-template">
8764             {{#.}}
8765                    {{#unless isEmpty}}
8766                    {{#if OrderLines.length}}
8767                 <input type="checkbox" checked id="LeftoversOrderlinesModal" class="modal-trigger" />
8768                 <div class="modal-container modal-overlay">
8769                     <label for="LeftoversOrderlinesModal" id="LeftoversOrderlinesModalModalOverlay" class="" onclick="event.preventDefault();"></label>
8770                     <div class="modal" id="LeftoversOrderlinesModalModal">
8771                         <div class="modal__header u-ta-center">
8772                         
8773                                 <div>
8774                                     <h4>@Translate("Leftover products removed from cart:")<h4>
8775                                         
8776                                          
8777                                        
8778                                         {{#OrderLines}}
8779                                             {{> (lookup . 'template') }}
8780                                         {{/OrderLines}}
8781                                     
8782                                     </h4>
8783                           
8784                           <div>
8785                         </div>
8786     
8787                         </div>
8788                         <div class="modal__body u-ta-center u-no-padding u-margin-top">
8789                             <div class="btn btn-danger" onclick='document.getElementById("LeftoversOrderlinesModal").checked = false'>@Translate("OK")</div>
8790                         </div>
8791                     
8792     
8793     
8794     
8795                         
8796                     </div>
8797                 </div>
8798     
8799                     {{/if}}
8800     
8801                      {{#if OrderLinesNotification.length}}
8802                           <input type="checkbox" checked id="LeftoversOrderlinesModal2" class="modal-trigger" />
8803                 <div class="modal-container modal-overlay">
8804                     <label for="LeftoversOrderlinesModal2" id="LeftoversOrderlinesModal2ModalOverlay" class="" onclick="event.preventDefault();"></label>
8805                     <div class="modal" id="LeftoversOrderlinesModal2Modal">
8806                         <div class="modal__header u-ta-center">
8807                         
8808                                 <div>
8809                                     <h3>@Translate("Some leftover products are still in your cart")<h3>
8810                                         
8811                                          
8812                                        
8813                                         {{#OrderLinesNotification}}
8814     
8815                                             <div><b>{{name}}</b> @Translate("is still reserved for") {{minutes}} @Translate("minutes") </div>
8816                                         {{/OrderLinesNotification}}
8817                                     
8818                                     </h4>
8819                           
8820                           <div>
8821                         </div>
8822     
8823                         </div>
8824                         <div class="modal__body u-ta-center u-no-padding u-margin-top">
8825                             <div class="btn btn-warning" onclick='document.getElementById("LeftoversOrderlinesModal2").checked = false'>@Translate("OK")</div>
8826                             <div class="btn btn-danger" onclick=' window.location = "/cart";'>@Translate("Go to cart")</div>
8827                         </div>
8828                     
8829     
8830     
8831     
8832                         
8833                     </div>
8834                 </div>
8835                      {{/if}}
8836     
8837                      {{/unless}}
8838     
8839                   
8840                 
8841             {{/.}}
8842         </script>
8843     
8844         <script id="LeftoverOrderline" type="text/x-template">
8845             {{#unless isEmpty}}
8846                 <div><h5>@Translate("Product"): {{name}}</h5> <a href="{{link}}"> @Translate("Go to product")</a></div>
8847                  
8848             {{/unless}}
8849         </script>
8850     }
8851     
8852     
8853     @functions { 
8854         public class ManifestIcon
8855         {
8856             public string src { get; set; }
8857             public string type { get; set; }
8858             public string sizes { get; set; }
8859         }
8860     
8861         public class Manifest
8862         {
8863             public string name { get; set; }
8864             public string short_name { get; set; }
8865             public string start_url { get; set; }
8866             public string display { get; set; }
8867             public string background_color { get; set; }
8868             public string theme_color { get; set; }
8869             public List<ManifestIcon> icons { get; set; }
8870         }
8871     }
8872     
8873     <!DOCTYPE html>
8874     
8875     <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName">
8876     
8877     
8878     
8879     @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@
8880     @RenderBlockList(masterPage.BlocksRoot.BlocksList)
8881     
8882     
8883     
8884     @helper RenderMasterHead() { 
8885         List<Block> subBlocks = this.masterPage.GetBlockListById("Head").OrderBy(item => item.SortId).ToList();
8886     
8887         <head>
8888            <!-- Rapido version 3.2 -->
8889     
8890            @RenderBlockList(subBlocks)
8891         </head>   
8892     }
8893     
8894     @helper RenderMasterMetadata() { 
8895         var swatches = new Dynamicweb.Content.Items.ColorSwatchService();
8896         var brandColors = swatches.GetColorSwatch(1);
8897         string brandColorOne = brandColors.Palette["BrandColor1"];
8898     
8899         if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) {
8900             Manifest manifest = new Manifest
8901             {
8902                 name = Model.Area.Item.GetItem("Settings").GetString("AppName"),
8903                 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"),
8904                 start_url = "/",
8905                 display = "standalone",
8906                 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"),
8907                 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor")
8908             };
8909     
8910             manifest.icons = new List<ManifestIcon> {
8911                 new ManifestIcon {
8912                     src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,
8913                     sizes = "192x192",
8914                     type = "image/png"
8915                 },
8916                 new ManifestIcon {
8917                     src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,
8918                     sizes = "512x512",
8919                     type = "image/png"
8920                 },
8921                 new ManifestIcon {
8922                     src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,
8923                     sizes = "1024x1024",
8924                     type = "image/png"
8925                 }
8926             };
8927     
8928             string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json");
8929             string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest);
8930             string currentManifest = File.ReadAllText(manifestFilePath);
8931     
8932             if (manifestJSON != currentManifest)
8933             {
8934                 File.WriteAllText(manifestFilePath, manifestJSON);
8935             }
8936         }
8937     
8938         <meta charset="utf-8" />
8939         <title>@Model.Title</title>
8940         <meta name="viewport" content="width=device-width, initial-scale=1.0">
8941         <meta name="robots" content="index, follow">
8942         <meta name="theme-color" content="@brandColorOne" />
8943     
8944         if (!Model.MetaTags.Contains("og:image")) {
8945             Pageview.Meta.AddTag("og:image", string.Format("{0}://{1}{2}", Dynamicweb.Context.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, Model.PropertyItem.GetFile("OpenGraphImage")));
8946         }
8947     
8948         if (!Model.MetaTags.Contains("og:description")) {
8949             Pageview.Meta.AddTag("og:description", Model.Description);
8950         }
8951         
8952         Pageview.Meta.AddTag("og:title", Model.Title);  
8953         Pageview.Meta.AddTag("og:site_name", Model.Name);
8954         Pageview.Meta.AddTag("og:url", HttpContext.Current.Request.Url.ToString());
8955         Pageview.Meta.AddTag("og:type", "Website");
8956         Pageview.Meta.AddTag("fb:page_id", Model.ID.ToString());
8957     
8958         @Model.MetaTags
8959     }
8960     
8961     @helper RenderMasterCss() { 
8962         var fonts = new string[] {
8963         getFontFamily("Layout", "HeaderFont"),
8964         getFontFamily("Layout", "SubheaderFont"),
8965         getFontFamily("Layout", "TertiaryHeaderFont"),
8966         getFontFamily("Layout", "BodyText"),
8967         getFontFamily("Layout", "Header", "ToolsFont"),
8968         getFontFamily("Layout", "Header", "NavigationFont"),
8969         getFontFamily("Layout", "MobileNavigation", "Font"),
8970         getFontFamily("ProductList", "Facets", "HeaderFont"),
8971         getFontFamily("ProductPage", "PriceFontDesign"),
8972         getFontFamily("Ecommerce", "SaleSticker", "Font"),
8973         getFontFamily("Ecommerce", "NewSticker", "Font"),
8974         getFontFamily("Ecommerce", "CustomSticker", "Font")
8975         };
8976     
8977         string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks;
8978         string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png";
8979         bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro");
8980         string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css";
8981         if (useFontAwesomePro)
8982         {
8983             fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css";
8984         }
8985     
8986         //Favicon
8987         <link href="@favicon" rel="icon" type="image/png">
8988     
8989         //Base (Default, wireframe) styles
8990         <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css">
8991     
8992         //Rapido Css from Website Settings
8993         <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css">
8994     
8995         //Ignite Css (Custom site specific styles) 
8996         <link rel="stylesheet" id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css">
8997     
8998         //Font awesome
8999         <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css">
9000     
9001         //Flag icon
9002         <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css">
9003     
9004         //Google fonts
9005         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)));
9006     
9007         <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet">
9008         
9009         PushPromise(favicon);
9010         PushPromise(fontAwesomeCssLink);
9011         PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css");
9012         PushPromise(autoCssLink);
9013         PushPromise("/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css");
9014         PushPromise("/Files/Images/placeholder.gif");
9015         PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css");
9016     }
9017     
9018     @helper RenderMasterManifest() { 
9019         if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")))
9020         {
9021             <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json">
9022             PushPromise("/Files/Templates/Designs/Rapido/manifest.json");
9023         } 
9024     }
9025     
9026     @helper RenderMasterBody() { 
9027         List<Block> subBlocks = this.masterPage.GetBlockListById("Body").OrderBy(item => item.SortId).ToList();
9028         string designLayout = Model.PropertyItem.GetItem("CustomSettings") != null ? Model.PropertyItem.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.PropertyItem.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : "";
9029         if (!String.IsNullOrEmpty(designLayout)) {
9030             designLayout = "class=\"" + designLayout + "\"";
9031         }
9032     
9033         <body @designLayout>
9034            @RenderBlockList(subBlocks)
9035         </body>   
9036     }
9037     
9038     @helper RenderMasterHeader()
9039     {
9040         List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList();
9041         bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop");
9042         string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : "";
9043     
9044         <header class="top-container @stickyTop dw-mod" id="Top">
9045             @RenderBlockList(subBlocks)
9046         </header>
9047     }
9048     
9049     @helper RenderMain()
9050     {
9051         List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList();
9052     
9053         <main class="site dw-mod">
9054             @RenderBlockList(subBlocks)
9055         </main>
9056     }
9057     
9058     @helper RenderPageContent()
9059     {
9060         bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop");
9061         string pagePos = isNavigationStickyMenu ? "js-page-pos" : "";
9062     
9063         <div id="Page" class="page @pagePos">
9064             <section class="center-container content-container dw-mod" id="content">
9065                
9066                 @RenderSnippet("Content")
9067             </section>
9068         </div>
9069     }
9070     
9071     @* Hack to support nested helpers *@
9072     @SnippetStart("Content")
9073     @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
9074     
9075     
9076     
9077     @using Dynamicweb.Rapido.Blocks.Components.General
9078     @using Dynamicweb.Rapido.Blocks
9079     
9080     @functions {
9081         BlocksPage page = BlocksPage.GetBlockPage("Page");
9082     }
9083     
9084     @{
9085         bool isProductPage = HttpContext.Current.Request.QueryString.Get("ProductID") != null;
9086         string backgroundColorClass = Model.PropertyItem.GetList("BackgroundColor") != null && !isProductPage ? "u-" + Model.PropertyItem.GetList("BackgroundColor").SelectedValue + "--bg" : "";
9087         string navigationMarkup = "";
9088     
9089         Block pageContainer = new Block
9090         {
9091             Id = "PageContainer",
9092             SortId = 10,
9093             BlocksList = new List<Block> {
9094                 new Block {
9095                     Id = "PageRow",
9096                     SortId = 20,
9097                     Design = new Design {
9098                         RenderType = RenderType.Row
9099                     }
9100                 }
9101             }
9102         };
9103         page.Add(pageContainer);
9104     
9105         if (Model.PropertyItem.GetList("ShowBreadcrumb") != null && Model.PropertyItem.GetList("ShowBreadcrumb").SelectedValue == "True")
9106         {
9107             Block breadcrumbNavigation = new Block
9108             {
9109                 Id = "PageBreadcrumbNavigation",
9110                 SortId = 10,
9111                 Component = new BreadcrumbNavigation { Id = "breadcrumb", Template = "Breadcrumb.xslt", SitemapMode = true }
9112             };
9113             page.Add("PageContainer", breadcrumbNavigation);
9114         }
9115     
9116         if (Model.PropertyItem.GetList("LeftMenu") != null && Model.PropertyItem.GetList("LeftMenu").SelectedValue == "True" && (Pageview.Page.NavigationSettings == null || !Pageview.Page.NavigationSettings.UseEcomGroups))
9117         {
9118             navigationMarkup = RenderNavigation(new
9119             {
9120                 id = "leftnav",
9121                 cssclass = "dwnavigation",
9122                 startLevel = 2,
9123                 expandmode = "all",
9124                 endlevel = 5,
9125                 template = "LeftNavigation.xslt"
9126             });
9127     
9128             if (!string.IsNullOrEmpty(navigationMarkup))
9129             {
9130                 Block leftNavigation = new Block
9131                 {
9132                     Id = "PageLeftNavigation",
9133                     SortId = 10,
9134                     Component = new LeftNavigation { Id = "leftnav", CssClass = "dwnavigation", StartLevel = 2, EndLevel = 5, Expandmode = "all", Template = "LeftNavigation.xslt" },
9135                     Design = new Design
9136                     {
9137                         RenderType = RenderType.Column,
9138                         Size = "3"
9139                     }
9140                 };
9141                 page.Add("PageRow", leftNavigation);
9142             }
9143         }
9144     
9145         string contentColumnSize = !string.IsNullOrEmpty(navigationMarkup) ? "9" : "12";
9146     
9147         Block pageContent = new Block
9148         {
9149             Id = "PageContent",
9150             SortId = 20,
9151             Design = new Design
9152             {
9153                 RenderType = RenderType.Column,
9154                 Size = contentColumnSize,
9155                 CssClass = "grid__col--bleed"
9156             },
9157             BlocksList = new List<Block> {
9158                 new Block {
9159                     Id = "PageContentRow",
9160                     SortId = 10,
9161                     Component = new Text { Content = @Model.Placeholder("dwcontent", "content", "default:true;sort:1") },
9162                     Design = new Design {
9163                         RenderType = RenderType.Row
9164                     }
9165                 }
9166             }
9167         };
9168         page.Add("PageRow", pageContent);
9169     }
9170     
9171     @using System
9172     @using System.Web
9173     @using System.Collections.Generic
9174     @using Dynamicweb.Rapido.Blocks
9175     
9176     @{ 
9177         BlocksPage pageCustomBlocksPage = BlocksPage.GetBlockPage("Page");
9178         if (pageCustomBlocksPage.GetBlockById("PageLeftNavigation") != null)
9179         {
9180         pageCustomBlocksPage.GetBlockById("PageLeftNavigation").Component = new LeftNavigation { Id = "leftnav", CssClass = "dwnavigation", StartLevel = 2, EndLevel = 5, Expandmode = "all", Template = "LeftNavigationCustom.xslt" };
9181         }
9182     
9183     }
9184     
9185     @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@
9186     @RenderBlockList(page.BlocksRoot.BlocksList)
9187     
9188     
9189     @* Very small hack to make it cleanly, and easily possible to change the background color on a single page *@
9190     @if (backgroundColorClass != "")
9191         {
9192         <script>
9193             document.getElementById("Page").classList.add("@backgroundColorClass");
9194         </script>
9195     } 
9196     @SnippetEnd("Content")
9197     
9198     </html>
9199     
9200