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