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