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