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