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