Error executing template "Designs/Rapido/_parsed/DynamicArticle.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at CompiledRazorTemplates.Dynamic.RazorEngine_c18e78e9d02f4a88ad54ce1314ea9fe0.Execute() in D:\dynamicweb.net\Solutions\FlexMedia\HDamKaergaard.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\DynamicArticle.parsed.cshtml:line 8304
at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
2 3 @using System.Web;
4 @using Dynamicweb.Frontend
5 @using Dynamicweb.Frontend.Devices
6 @using Dynamicweb.Extensibility
7 @using Dynamicweb.Content
8 @using Dynamicweb.Security
9 @using Dynamicweb.Core
10 @using System
11 @using System.Web
12 @using System.IO
13 @using Dynamicweb.Rapido.Blocks
14 @using System.Net
15 16 17 @functions {
18 BlocksPage masterPage = BlocksPage.GetBlockPage("Master");
19 20 string getFontFamily(params string[] items)
21 {
22 var itemParent = Pageview.AreaSettings;
23 foreach (var item in items)
24 {
25 itemParent = itemParent.GetItem(item);
26 if (itemParent == null)
27 {
28 return null;
29 }
30 }
31 32 var googleFont = itemParent.GetGoogleFont("FontFamily");
33 if (googleFont == null)
34 {
35 return null;
36 }
37 return googleFont.Family.Replace(" ", "+");
38 }
39 }
40 41 @{
42 Block root = new Block
43 {
44 Id = "Root",
45 SortId = 10,
46 BlocksList = new List<Block>
47 {
48 new Block {
49 Id = "Head",
50 SortId = 10,
51 SkipRenderBlocksList = true,
52 Template = RenderMasterHead(),
53 BlocksList = new List<Block>
54 {
55 new Block {
56 Id = "HeadMetadata",
57 SortId = 10,
58 Template = RenderMasterMetadata(),
59 },
60 new Block {
61 Id = "HeadCss",
62 SortId = 20,
63 Template = RenderMasterCss(),
64 },
65 new Block {
66 Id = "HeadManifest",
67 SortId = 30,
68 Template = RenderMasterManifest(),
69 }
70 }
71 },
72 new Block {
73 Id = "Body",
74 SortId = 20,
75 SkipRenderBlocksList = true,
76 Template = RenderMasterBody(),
77 BlocksList = new List<Block>
78 {
79 new Block()
80 {
81 Id = "Master",
82 SortId = 10,
83 BlocksList = new List<Block> {
84 new Block {
85 Id = "MasterTopSnippets",
86 SortId = 10
87 },
88 new Block {
89 Id = "MasterMain",
90 SortId = 20,
91 Template = RenderMain(),
92 SkipRenderBlocksList = true,
93 BlocksList = new List<Block> {
94 new Block {
95 Id = "MasterHeader",
96 SortId = 10,
97 Template = RenderMasterHeader(),
98 SkipRenderBlocksList = true
99 },
100 new Block {
101 Id = "MasterPageContent",
102 SortId = 20,
103 Template = RenderPageContent()
104 }
105 }
106 },
107 new Block {
108 Id = "MasterFooter",
109 SortId = 30
110 },
111 new Block {
112 Id = "MasterReferences",
113 SortId = 40
114 },
115 new Block {
116 Id = "MasterBottomSnippets",
117 SortId = 50,
118 BlocksList = new List<Block> {
119 new Block {
120 Id = "iOsTabletFix",
121 SortId = 10,
122 Template = RenderIosTabletFix()
123 }
124 }
125 }
126 }
127 }
128 }
129 }
130 }
131 };
132133 masterPage.Add(root);
134 }
135136 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@
137 @using System.Text.RegularExpressions
138 @using System.Collections.Generic
139 @using System.Reflection
140 @using System.Web
141 @using System.Web.UI.HtmlControls
142 @using Dynamicweb.Rapido.Blocks.Components
143 @using Dynamicweb.Rapido.Blocks.Components.Articles
144 @using Dynamicweb.Rapido.Blocks.Components.Documentation
145 @using Dynamicweb.Rapido.Blocks
146147148 @*--- START: Base block renderers ---*@
149150 @helper RenderBlockList(List<Block> blocks)
151 {
152 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false;
153 blocks = blocks.OrderBy(item => item.SortId).ToList();
154155 foreach (Block item in blocks)
156 {
157 if (debug) {
158 <!-- Block START: @item.Id -->
159 }
160161 if (item.Design == null)
162 {
163 @RenderBlock(item)
164 }
165 else if (item.Design.RenderType == RenderType.None) {
166 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : "";
167168 <div class="@cssClass dw-mod">
169 @RenderBlock(item)
170 </div>
171 }
172 else if (item.Design.RenderType != RenderType.Hide)
173 {
174 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : "";
175176 if (!item.SkipRenderBlocksList) {
177 if (item.Design.RenderType == RenderType.Row)
178 {
179 <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id">
180 @RenderBlock(item)
181 </div>
182 }
183184 if (item.Design.RenderType == RenderType.Column)
185 {
186 string hidePadding = item.Design.HidePadding ? "u-no-padding" : "";
187 string size = item.Design.Size ?? "12";
188 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size;
189190 <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">
191 @RenderBlock(item)
192 </div>
193 }
194195 if (item.Design.RenderType == RenderType.Table)
196 {
197 <table class="table @cssClass dw-mod" id="Block__@item.Id">
198 @RenderBlock(item)
199 </table>
200 }
201202 if (item.Design.RenderType == RenderType.TableRow)
203 {
204 <tr class="@cssClass dw-mod" id="Block__@item.Id">
205 @RenderBlock(item)
206 </tr>
207 }
208209 if (item.Design.RenderType == RenderType.TableColumn)
210 {
211 <td class="@cssClass dw-mod" id="Block__@item.Id">
212 @RenderBlock(item)
213 </td>
214 }
215216 if (item.Design.RenderType == RenderType.CardHeader)
217 {
218 <div class="card-header @cssClass dw-mod">
219 @RenderBlock(item)
220 </div>
221 }
222223 if (item.Design.RenderType == RenderType.CardBody)
224 {
225 <div class="card @cssClass dw-mod">
226 @RenderBlock(item)
227 </div>
228 }
229230 if (item.Design.RenderType == RenderType.CardFooter)
231 {
232 <div class="card-footer @cssClass dw-mod">
233 @RenderBlock(item)
234 </div>
235 }
236 }
237 else
238 {
239 @RenderBlock(item)
240 }
241 }
242243 if (debug) {
244 <!-- Block END: @item.Id -->
245 }
246 }
247 }
248249 @helper RenderBlock(Block item)
250 {
251 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false;
252253 if (item.Template != null)
254 {
255 @BlocksPage.RenderTemplate(item.Template)
256 }
257258 if (item.Component != null)
259 {
260 string customSufix = "Custom";
261 string methodName = item.Component.HelperName;
262263 ComponentBase[] methodParameters = new ComponentBase[1];
264 methodParameters[0] = item.Component;
265 Type methodType = this.GetType();
266267 MethodInfo customMethod = methodType.GetMethod(methodName + customSufix);
268 MethodInfo generalMethod = methodType.GetMethod(methodName);
269270 try {
271 if (debug) {
272 <!-- Component: @methodName.Replace("Render", "") -->
273 }
274 @customMethod.Invoke(this, methodParameters).ToString();
275 } catch {
276 try {
277 @generalMethod.Invoke(this, methodParameters).ToString();
278 } catch(Exception ex) {
279 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked", ex);
280 }
281 }
282 }
283284 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList)
285 {
286 @RenderBlockList(item.BlocksList)
287 }
288 }
289290 @*--- END: Base block renderers ---*@
291292293 @* Include the components *@
294 @using Dynamicweb.Rapido.Blocks.Components
295 @using Dynamicweb.Rapido.Blocks.Components.General
296 @using Dynamicweb.Rapido.Blocks
297 @using System.IO
298299 @* Required *@
300 @using Dynamicweb.Rapido.Blocks.Components
301 @using Dynamicweb.Rapido.Blocks.Components.General
302 @using Dynamicweb.Rapido.Blocks
303304305 @helper Render(ComponentBase component)
306 {
307 if (component != null)
308 {
309 @component.Render(this)
310 }
311 }
312313 @* Components *@
314 @using System.Reflection
315 @using Dynamicweb.Rapido.Blocks.Components.General
316317318 @* Component *@
319320 @helper RenderIcon(Icon settings)
321 {
322 if (settings != null)
323 {
324 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : "";
325326 if (settings.Name != null)
327 {
328 if (string.IsNullOrEmpty(settings.Label))
329 {
330 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i>
331 }
332 else
333 {
334 if (settings.LabelPosition == IconLabelPosition.Before)
335 {
336 <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>
337 }
338 else
339 {
340 <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>
341 }
342 }
343 }
344 else if (!string.IsNullOrEmpty(settings.Label))
345 {
346 @settings.Label
347 }
348 }
349 }
350 @using System.Reflection
351 @using Dynamicweb.Rapido.Blocks.Components.General
352 @using Dynamicweb.Rapido.Blocks.Components
353 @using Dynamicweb.Core
354355 @* Component *@
356357 @helper RenderButton(Button settings)
358 {
359 if (settings != null && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null))
360 {
361 Dictionary<string, string> attributes = new Dictionary<string, string>();
362 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>();
363 if (settings.Disabled) {
364 attributes.Add("disabled", "true");
365 classList.Add("disabled");
366 }
367368 if (!string.IsNullOrEmpty(settings.ConfirmText) || !string.IsNullOrEmpty(settings.ConfirmTitle))
369 {
370 settings.Id = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N");
371 @RenderConfirmDialog(settings);
372 settings.OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = true";
373 }
374375 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
376 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
377 if (!string.IsNullOrEmpty(settings.AltText))
378 {
379 attributes.Add("title", settings.AltText);
380 }
381 else if (!string.IsNullOrEmpty(settings.Title))
382 {
383 string cleanTitle = Regex.Replace(settings.Title, "<.*?>", String.Empty);
384 cleanTitle = cleanTitle.Replace(" ", " ");
385 attributes.Add("title", cleanTitle);
386 }
387388 var onClickEvents = new List<string>();
389 if (!string.IsNullOrEmpty(settings.OnClick))
390 {
391 onClickEvents.Add(settings.OnClick);
392 }
393 if (!string.IsNullOrEmpty(settings.Href))
394 {
395 onClickEvents.Add("location.href='" + settings.Href + "'");
396 }
397 if (onClickEvents.Count > 0)
398 {
399 attributes.Add("onClick", string.Join(";", onClickEvents));
400 }
401402 if (settings.ButtonLayout != ButtonLayout.None)
403 {
404 classList.Add("btn");
405 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower();
406 if (btnLayout == "linkclean")
407 {
408 btnLayout = "link-clean"; //fix
409 }
410 classList.Add("btn--" + btnLayout);
411 }
412413 if (settings.Icon == null)
414 {
415 settings.Icon = new Icon();
416 }
417418 settings.Icon.CssClass += Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower() != "linkclean" ? " u-flex--align-center" : "";
419 settings.Icon.Label = settings.Title;
420421 attributes.Add("type", Enum.GetName(typeof(ButtonType), settings.ButtonType).ToLower());
422423 <button class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</button>
424 }
425 }
426427 @helper RenderConfirmDialog(Button settings)
428 {
429 Modal confirmDialog = new Modal {
430 Id = settings.Id,
431 Width = ModalWidth.Sm,
432 Heading = new Heading
433 {
434 Level = 2,
435 Title = settings.ConfirmTitle
436 },
437 BodyText = settings.ConfirmText
438 };
439440 confirmDialog.AddAction(new Button { Title = Translate("Cancel"), ButtonLayout = ButtonLayout.Secondary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false"});
441 confirmDialog.AddAction(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false;" + settings.OnClick });
442443 @Render(confirmDialog)
444 }
445 @using Dynamicweb.Rapido.Blocks.Components.General
446 @using Dynamicweb.Rapido.Blocks.Components
447 @using Dynamicweb.Core
448449 @helper RenderDashboard(Dashboard settings)
450 {
451 var widgets = settings.GetWidgets();
452453 if (!string.IsNullOrEmpty(settings.WidgetsBaseBackgroundColor))
454 {
455 //set bg color for them
456457 System.Drawing.Color color = System.Drawing.ColorTranslator.FromHtml(settings.WidgetsBaseBackgroundColor);
458 int r = Convert.ToInt16(color.R);
459 int g = Convert.ToInt16(color.G);
460 int b = Convert.ToInt16(color.B);
461462 var count = widgets.Length;
463 var max = Math.Max(r, Math.Max(g, b));
464 double step = 255.0 / (max * count);
465 var i = 0;
466 foreach (var widget in widgets)
467 {
468 i++;
469470 var shade = "rgb(" + Converter.ToString(r * step * i).Replace(",", ".") + ", " + Converter.ToString(g * step * i).Replace(",", ".") + ", " + Converter.ToString(b * step * i).Replace(",", ".") + ")";
471 widget.BackgroundColor = shade;
472 }
473 }
474475 <div class="dashboard @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
476 @foreach (var widget in widgets)
477 {
478 <div class="dashboard__widget">
479 @Render(widget)
480 </div>
481 }
482 </div>
483 }
484 @using Dynamicweb.Rapido.Blocks.Components.General
485 @using Dynamicweb.Rapido.Blocks.Components
486487 @helper RenderDashboardWidgetLink(DashboardWidgetLink settings)
488 {
489 if (!string.IsNullOrEmpty(settings.Link))
490 {
491 var backgroundStyles = "";
492 if (!string.IsNullOrEmpty(settings.BackgroundColor))
493 {
494 backgroundStyles = "style=\"background-color:" + settings.BackgroundColor + "\"";
495 }
496497 <a href="@settings.Link" class="widget widget--link @settings.CssClass dw-mod" @backgroundStyles title="@settings.Title" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
498 <div class="u-center-middle u-color-light">
499 @if (settings.Icon != null)
500 {
501 settings.Icon.CssClass += "widget__icon";
502 @Render(settings.Icon)
503 }
504 <div class="widget__title">@settings.Title</div>
505 </div>
506 </a>
507 }
508 }
509 @using Dynamicweb.Rapido.Blocks.Components.General
510 @using Dynamicweb.Rapido.Blocks.Components
511512 @helper RenderDashboardWidgetCounter(DashboardWidgetCounter settings)
513 {
514 var backgroundStyles = "";
515 if (!string.IsNullOrEmpty(settings.BackgroundColor))
516 {
517 backgroundStyles = "style='background-color:" + settings.BackgroundColor + "'";
518 }
519520 <div class="widget @settings.CssClass dw-mod" @backgroundStyles @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
521 <div class="u-center-middle u-color-light">
522 @if (settings.Icon != null)
523 {
524 settings.Icon.CssClass += "widget__icon";
525 @Render(settings.Icon)
526 }
527 <div class="widget__counter">@settings.Count</div>
528 <div class="widget__title">@settings.Title</div>
529 </div>
530 </div>
531 }
532 @using System.Reflection
533 @using Dynamicweb.Rapido.Blocks.Components.General
534 @using Dynamicweb.Rapido.Blocks.Components
535 @using Dynamicweb.Core
536537 @* Component *@
538539 @helper RenderLink(Link settings)
540 {
541 if (settings != null && !string.IsNullOrEmpty(settings.Href) && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null))
542 {
543 Dictionary<string, string> attributes = new Dictionary<string, string>();
544 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>();
545 if (settings.Disabled)
546 {
547 attributes.Add("disabled", "true");
548 classList.Add("disabled");
549 }
550551 if (!string.IsNullOrEmpty(settings.AltText))
552 {
553 attributes.Add("title", settings.AltText);
554 }
555 else if (!string.IsNullOrEmpty(settings.Title))
556 {
557 attributes.Add("title", settings.Title);
558 }
559560 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
561 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
562 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onClick", settings.OnClick); }
563 attributes.Add("href", settings.Href);
564565 if (settings.ButtonLayout != ButtonLayout.None)
566 {
567 classList.Add("btn");
568 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower();
569 if (btnLayout == "linkclean")
570 {
571 btnLayout = "link-clean"; //fix
572 }
573 classList.Add("btn--" + btnLayout);
574 }
575576 if (settings.Icon == null)
577 {
578 settings.Icon = new Icon();
579 }
580 settings.Icon.Label = settings.Title;
581582 if (settings.Target == LinkTargetType.Blank && settings.Rel == LinkRelType.None)
583 {
584 settings.Rel = LinkRelType.Noopener;
585 }
586 if (settings.Target != LinkTargetType.None)
587 {
588 attributes.Add("target", "_" + Enum.GetName(typeof(LinkTargetType), settings.Target).ToLower());
589 }
590 if (settings.Download)
591 {
592 attributes.Add("download", "true");
593 }
594 if (settings.Rel != LinkRelType.None)
595 {
596 attributes.Add("rel", Enum.GetName(typeof(LinkRelType), settings.Rel).ToLower());
597 }
598599 <a class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</a>
600 }
601 }
602 @using System.Reflection
603 @using Dynamicweb.Rapido.Blocks.Components
604 @using Dynamicweb.Rapido.Blocks.Components.General
605 @using Dynamicweb.Rapido.Blocks
606607608 @* Component *@
609610 @helper RenderRating(Rating settings)
611 {
612 if (settings.Score > 0)
613 {
614 int rating = settings.Score;
615 string iconType = "fa-star";
616617 switch (settings.Type.ToString()) {
618 case "Stars":
619 iconType = "fa-star";
620 break;
621 case "Hearts":
622 iconType = "fa-heart";
623 break;
624 case "Lemons":
625 iconType = "fa-lemon";
626 break;
627 case "Bombs":
628 iconType = "fa-bomb";
629 break;
630 }
631632 <div class="u-ta-right">
633 @for (int i = 0; i < settings.OutOf; i++)
634 {
635 <i class="@(rating > i ? "fas" : "far") @iconType"></i>
636 }
637 </div>
638 }
639 }
640 @using System.Reflection
641 @using Dynamicweb.Rapido.Blocks.Components.General
642 @using Dynamicweb.Rapido.Blocks.Components
643644645 @* Component *@
646647 @helper RenderSelectFieldOption(SelectFieldOption settings)
648 {
649 Dictionary<string, string> attributes = new Dictionary<string, string>();
650 if (settings.Checked) { attributes.Add("selected", "true"); }
651 if (settings.Disabled) { attributes.Add("disabled", "true"); }
652 if (settings.Value != null) { attributes.Add("value", settings.Value); }
653 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
654655 <option @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Label</option>
656 }
657 @using System.Reflection
658 @using Dynamicweb.Rapido.Blocks.Components.General
659 @using Dynamicweb.Rapido.Blocks.Components
660661662 @* Component *@
663664 @helper RenderNavigation(Navigation settings) {
665 @RenderNavigation(new
666 {
667 id = settings.Id,
668 cssclass = settings.CssClass,
669 startLevel = settings.StartLevel,
670 endlevel = settings.EndLevel,
671 expandmode = settings.Expandmode,
672 sitemapmode = settings.SitemapMode,
673 template = settings.Template
674 })
675 }
676 @using Dynamicweb.Rapido.Blocks.Components.General
677 @using Dynamicweb.Rapido.Blocks.Components
678679680 @* Component *@
681682 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) {
683 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id;
684 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template;
685 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel;
686 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel;
687 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode;
688 settings.SitemapMode = false;
689690 @RenderNavigation(settings)
691 }
692 @using Dynamicweb.Rapido.Blocks.Components.General
693 @using Dynamicweb.Rapido.Blocks.Components
694695696 @* Component *@
697698 @helper RenderLeftNavigation(LeftNavigation settings) {
699 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id;
700 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template;
701 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel;
702 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel;
703 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode;
704705 <div class="grid__cell">
706 @RenderNavigation(settings)
707 </div>
708 }
709 @using System.Reflection
710 @using Dynamicweb.Rapido.Blocks.Components.General
711 @using Dynamicweb.Core
712713 @* Component *@
714715 @helper RenderHeading(Heading settings)
716 {
717 if (settings != null && !string.IsNullOrEmpty(settings.Title))
718 {
719 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : "";
720 string tagName = settings.Level != 0 ? "h" + settings.Level.ToString() : "div";
721722 @("<" + tagName + " class=\"" + settings.CssClass + " dw-mod\" " + color + ">")
723 if (!string.IsNullOrEmpty(settings.Link))
724 {
725 @Render(new Link { Href = settings.Link, Icon = settings.Icon, Title = settings.Title, ButtonLayout = ButtonLayout.None })
726 }
727 else
728 {
729 if (settings.Icon == null)
730 {
731 settings.Icon = new Icon();
732 }
733 settings.Icon.Label = settings.Title;
734 @Render(settings.Icon)
735 }
736 @("</" + tagName + ">");
737 }
738 }
739 @using Dynamicweb.Rapido.Blocks.Components
740 @using Dynamicweb.Rapido.Blocks.Components.General
741 @using Dynamicweb.Rapido.Blocks
742743744 @* Component *@
745746 @helper RenderImage(Image settings)
747 {
748 if (settings.FilterPrimary != ImageFilter.None || settings.FilterSecondary != ImageFilter.None)
749 {
750 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>();
751 if (!string.IsNullOrEmpty(settings.FilterColor)) { optionalAttributes.Add("style", "background-color: " + settings.FilterColor); }
752753 if (settings.Caption != null)
754 {
755 @:<div>
756 }
757758 var primaryFilterClass = settings.FilterPrimary.ToString().ToLower();
759 var secondaryFilterClass = settings.FilterSecondary.ToString().ToLower();
760761 <div class="image-filter image-filter--@primaryFilterClass u-position-relative dw-mod" @ComponentMethods.AddAttributes(optionalAttributes)>
762 <div class="image-filter image-filter--@secondaryFilterClass dw-mod">
763 @if (settings.Link != null)
764 {
765 <a href="@settings.Link">
766 @RenderTheImage(settings)
767 </a>
768 }
769 else
770 {
771 @RenderTheImage(settings)
772 }
773 </div>
774 </div>
775776 if (settings.Caption != null)
777 {
778 <span class="image-caption dw-mod">@settings.Caption</span>
779 @:</div>
780 }
781 }
782 else
783 {
784 if (settings.Caption != null)
785 {
786 @:<div>
787 }
788 if (!string.IsNullOrEmpty(settings.Link))
789 {
790 <a href="@settings.Link">
791 @RenderTheImage(settings)
792 </a>
793 }
794 else
795 {
796 @RenderTheImage(settings)
797 }
798799 if (settings.Caption != null)
800 {
801 <span class="image-caption dw-mod">@settings.Caption</span>
802 @:</div>
803 }
804 }
805 }
806807 @helper RenderTheImage(Image settings)
808 {
809 if (settings != null)
810 {
811 string alternativeImage = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("AlternativeImage")) ? Pageview.AreaSettings.GetItem("Settings").GetFile("AlternativeImage").PathUrlEncoded : "/Images/missing_image.jpg";
812 string placeholderImage = "/Files/Images/placeholder.gif";
813 string imageEngine = "/Admin/Public/GetImage.ashx?";
814815 string imageStyle = "";
816817 switch (settings.Style)
818 {
819 case ImageStyle.Ball:
820 imageStyle = "grid__cell-img--ball";
821 break;
822823 case ImageStyle.Triangle:
824 imageStyle = "grid__cell-img--triangle";
825 break;
826 }
827828 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle || settings.Style == ImageStyle.Triangle)
829 {
830 settings.ImageDefault.Crop = settings.ImageDefault.Crop == 5 ? settings.ImageDefault.Crop = 0 : settings.ImageDefault.Crop;
831832 if (settings.ImageDefault != null)
833 {
834 settings.ImageDefault.Height = settings.ImageDefault.Width;
835 }
836 if (settings.ImageMedium != null)
837 {
838 settings.ImageMedium.Height = settings.ImageMedium.Width;
839 }
840 if (settings.ImageSmall != null)
841 {
842 settings.ImageSmall.Height = settings.ImageSmall.Width;
843 }
844 }
845846 string defaultImage = imageEngine;
847 string imageSmall = "";
848 string imageMedium = "";
849850851 /* Stop changing svg images into jpg images */
852853854 string SVGimg = settings.Path.ToString();
855856 if(SVGimg.EndsWith(".svg")){
857 settings.DisableImageEngine = true;
858 imageStyle += " svg-image";
859 }
860861862 if (settings.DisableImageEngine)
863 {
864 defaultImage = settings.Path;
865 }
866 else
867 {
868 if (settings.ImageDefault != null)
869 {
870 defaultImage += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageDefault);
871872 if (settings.Path.GetType() != typeof(string))
873 {
874 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
875 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
876 }
877 else
878 {
879 defaultImage += settings.Path != null ? "Image=" + settings.Path : "";
880 }
881882 defaultImage += "&AlternativeImage=" + alternativeImage;
883 }
884885 if (settings.ImageSmall != null)
886 {
887 imageSmall = "data-src-small=\"" + imageEngine;
888 imageSmall += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageSmall);
889890 if (settings.Path.GetType() != typeof(string))
891 {
892 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
893 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
894 }
895 else
896 {
897 imageSmall += settings.Path != null ? "Image=" + settings.Path : "";
898 }
899900 imageSmall += "&alternativeImage=" + alternativeImage;
901902 imageSmall += "\"";
903 }
904905 if (settings.ImageMedium != null)
906 {
907 imageMedium = "data-src-medium=\"" + imageEngine;
908 imageMedium += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageMedium);
909910 if (settings.Path.GetType() != typeof(string))
911 {
912 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
913 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
914 }
915 else
916 {
917 imageMedium += settings.Path != null ? "Image=" + settings.Path : "";
918 }
919920 imageMedium += "&alternativeImage=" + alternativeImage;
921922 imageMedium += "\"";
923 }
924 }
925926 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>();
927 if (!string.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); }
928 if (!string.IsNullOrEmpty(settings.Title))
929 {
930 optionalAttributes.Add("alt", settings.Title);
931 optionalAttributes.Add("title", settings.Title);
932 }
933934 if (settings.DisableLazyLoad)
935 {
936 <img id="@settings.Id" class="@imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) />
937 }
938 else
939 {
940 <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) />
941 }
942 }
943 }
944 @using System.Reflection
945 @using Dynamicweb.Rapido.Blocks.Components.General
946 @using Dynamicweb.Rapido.Blocks.Components
947948 @* Component *@
949950 @helper RenderFileField(FileField settings)
951 {
952 var attributes = new Dictionary<string, string>();
953 if (string.IsNullOrEmpty(settings.Id))
954 {
955 settings.Id = Guid.NewGuid().ToString("N");
956 }
957958 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
959 if (settings.Disabled) { attributes.Add("disabled", "true"); }
960 if (settings.Required) { attributes.Add("required", "true"); }
961 if (settings.Multiple) { attributes.Add("multiple", "true"); }
962 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
963 if (string.IsNullOrEmpty(settings.ChooseFileText))
964 {
965 settings.ChooseFileText = Translate("Choose file");
966 }
967 if (string.IsNullOrEmpty(settings.NoFilesChosenText))
968 {
969 settings.NoFilesChosenText = Translate("No files chosen...");
970 }
971 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
972973 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
974975 string setValueToFakeInput = "FileUpload.setValueToFakeInput(this)";
976 attributes.Add("onchange", setValueToFakeInput + (!string.IsNullOrEmpty(settings.OnChange) ? settings.OnChange : ""));
977978 attributes.Add("type", "file");
979 if (settings.Value != null) { attributes.Add("value", settings.Value); }
980 settings.CssClass = "u-full-width " + settings.CssClass;
981982 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
983984 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod">
985 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
986 {
987 <div class="u-full-width">
988 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
989 @if (settings.Link != null) {
990 <div class="u-pull--right">
991 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
992 @Render(settings.Link)
993 </div>
994 }
995 </div>
996997 }
998999 @if (!string.IsNullOrEmpty(settings.HelpText))
1000 {
1001 <small class="form__help-text">@settings.HelpText</small>
1002 }
10031004 <div class="form__field-combi file-input u-no-margin dw-mod">
1005 <input @ComponentMethods.AddAttributes(resultAttributes) class="file-input__real-input" data-no-files-text="@settings.NoFilesChosenText" data-many-files-text="@Translate("files")" />
1006 <label for="@settings.Id" class="file-input__btn btn--secondary btn dw-mod">@settings.ChooseFileText</label>
1007 <label for="@settings.Id" class="@settings.CssClass file-input__fake-input js-fake-input dw-mod">@settings.NoFilesChosenText</label>
1008 @if (settings.UploadButton != null)
1009 {
1010 settings.UploadButton.CssClass += " btn--condensed u-no-margin";
1011 @Render(settings.UploadButton)
1012 }
1013 </div>
1014 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1015 </div>
1016 }
1017 @using System.Reflection
1018 @using Dynamicweb.Rapido.Blocks.Components.General
1019 @using Dynamicweb.Rapido.Blocks.Components
1020 @using Dynamicweb.Core
1021 @using System.Linq
10221023 @* Component *@
10241025 @helper RenderDateTimeField(DateTimeField settings)
1026 {
1027 if (string.IsNullOrEmpty(settings.Id))
1028 {
1029 settings.Id = Guid.NewGuid().ToString("N");
1030 }
10311032 var textField = new TextField {
1033 Name = settings.Name,
1034 Id = settings.Id,
1035 Label = settings.Label,
1036 HelpText = settings.HelpText,
1037 Value = settings.Value,
1038 Disabled = settings.Disabled,
1039 Required = settings.Required,
1040 ErrorMessage = settings.ErrorMessage,
1041 CssClass = settings.CssClass,
1042 WrapperCssClass = settings.WrapperCssClass,
1043 OnChange = settings.OnChange,
1044 OnClick = settings.OnClick,
1045 Link = settings.Link,
1046 ExtraAttributes = settings.ExtraAttributes,
1047 //
1048 Placeholder = settings.Placeholder
1049 };
10501051 @Render(textField)
10521053 List<string> jsAttributes = new List<string>();
10541055 jsAttributes.Add("mode: '" + Enum.GetName(typeof(DateTimeFieldMode), settings.Mode).ToLower() + "'");
10561057 if (!string.IsNullOrEmpty(settings.DateFormat))
1058 {
1059 jsAttributes.Add("dateFormat: '" + settings.DateFormat + "'");
1060 }
1061 if (!string.IsNullOrEmpty(settings.MinDate))
1062 {
1063 jsAttributes.Add("minDate: '" + settings.MinDate + "'");
1064 }
1065 if (!string.IsNullOrEmpty(settings.MaxDate))
1066 {
1067 jsAttributes.Add("maxDate: '" + settings.MaxDate + "'");
1068 }
1069 if (settings.IsInline)
1070 {
1071 jsAttributes.Add("inline: " + Converter.ToString(settings.IsInline).ToLower());
1072 }
1073 if (settings.EnableTime)
1074 {
1075 jsAttributes.Add("enableTime: " + Converter.ToString(settings.EnableTime).ToLower());
1076 }
1077 if (settings.EnableWeekNumbers)
1078 {
1079 jsAttributes.Add("weekNumbers: " + Converter.ToString(settings.EnableWeekNumbers).ToLower());
1080 }
10811082 jsAttributes.AddRange(settings.GetFlatPickrOptions().Select(x => x.Key + ": " + x.Value));
10831084 <script>
1085 document.addEventListener("DOMContentLoaded", function () {
1086 flatpickr("#@textField.Id", {
1087 @string.Join(",", jsAttributes)
1088 });
1089 });
1090 </script>
1091 }
1092 @using System.Reflection
1093 @using Dynamicweb.Rapido.Blocks.Components.General
1094 @using Dynamicweb.Rapido.Blocks.Components
10951096 @* Component *@
10971098 @helper RenderTextField(TextField settings)
1099 {
1100 var attributes = new Dictionary<string, string>();
1101 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1102 {
1103 settings.Id = Guid.NewGuid().ToString("N");
1104 }
11051106 /*base settings*/
1107 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1108 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1109 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1110 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1111 if (settings.Required) { attributes.Add("required", "true"); }
1112 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1113 /*end*/
11141115 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
1116 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
1117 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
1118 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
1119 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); }
1120 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); }
1121 attributes.Add("type", Enum.GetName(typeof(TextFieldType), settings.Type).ToLower());
1122 if (settings.Type == TextFieldType.Password) { attributes.Add("autocomplete", "off"); };
1123 if (settings.Value != null) { attributes.Add("value", settings.Value); }
11241125 settings.CssClass = "u-full-width " + settings.CssClass;
11261127 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
11281129 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
11301131 string noMargin = "u-no-margin";
1132 if (!settings.ReadOnly) {
1133 noMargin = "";
1134 }
11351136 <div class="form__field-group u-full-width @noMargin @settings.WrapperCssClass dw-mod">
1137 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1138 {
1139 <div class="u-full-width">
1140 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1141 @if (settings.Link != null) {
1142 settings.Link.ButtonLayout = ButtonLayout.LinkClean;
11431144 <div class="u-pull--right">
1145 @Render(settings.Link)
1146 </div>
1147 }
1148 </div>
11491150 }
11511152 @if (!string.IsNullOrEmpty(settings.HelpText))
1153 {
1154 <small class="form__help-text">@settings.HelpText</small>
1155 }
11561157 @if (settings.ActionButton != null)
1158 {
1159 settings.ActionButton.CssClass += " btn--condensed u-no-margin";
1160 <div class="form__field-combi u-no-margin dw-mod">
1161 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1162 @Render(settings.ActionButton)
1163 </div>
1164 }
1165 else
1166 {
1167 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1168 }
11691170 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1171 </div>
1172 }
1173 @using System.Reflection
1174 @using Dynamicweb.Rapido.Blocks.Components.General
1175 @using Dynamicweb.Rapido.Blocks.Components
11761177 @* Component *@
11781179 @helper RenderNumberField(NumberField settings)
1180 {
1181 var attributes = new Dictionary<string, string>();
1182 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1183 {
1184 settings.Id = Guid.NewGuid().ToString("N");
1185 }
11861187 /*base settings*/
1188 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1189 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1190 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1191 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1192 if (settings.Required) { attributes.Add("required", "true"); }
1193 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1194 /*end*/
11951196 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
1197 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
1198 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
1199 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
1200 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); }
1201 if (settings.Min != null) { attributes.Add("min", settings.Min.ToString()); }
1202 if (settings.Step != 0) { attributes.Add("step", settings.Step.ToString()); }
1203 if (settings.Value != null && !string.IsNullOrEmpty(settings.Value.ToString())) { attributes.Add("value", settings.Value.ToString()); }
1204 attributes.Add("type", "number");
12051206 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
12071208 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod">
1209 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1210 {
1211 <div class="u-full-width">
1212 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1213 @if (settings.Link != null) {
1214 <div class="u-pull--right">
1215 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1216 @Render(settings.Link)
1217 </div>
1218 }
1219 </div>
12201221 }
12221223 @if (!string.IsNullOrEmpty(settings.HelpText))
1224 {
1225 <small class="form__help-text">@settings.HelpText</small>
1226 }
12271228 @if (settings.ActionButton != null)
1229 {
1230 settings.ActionButton.CssClass += " btn--condensed u-no-margin";
1231 <div class="form__field-combi u-no-margin dw-mod">
1232 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1233 @Render(settings.ActionButton)
1234 </div>
1235 }
1236 else
1237 {
1238 <div class="form__field-combi u-no-margin dw-mod">
1239 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1240 </div>
1241 }
12421243 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1244 </div>
1245 }
1246 @using System.Reflection
1247 @using Dynamicweb.Rapido.Blocks.Components.General
1248 @using Dynamicweb.Rapido.Blocks.Components
124912501251 @* Component *@
12521253 @helper RenderTextareaField(TextareaField settings)
1254 {
1255 Dictionary<string, string> attributes = new Dictionary<string, string>();
1256 string id = settings.Id;
1257 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(id))
1258 {
1259 id = Guid.NewGuid().ToString("N");
1260 }
12611262 if (!string.IsNullOrEmpty(id)) { attributes.Add("id", id); }
1263 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1264 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
1265 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
1266 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
1267 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1268 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); }
1269 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1270 if (settings.Required) { attributes.Add("required", "true"); }
1271 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
1272 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); }
1273 if (settings.Rows != 0) { attributes.Add("rows", settings.Rows.ToString()); }
1274 attributes.Add("name", settings.Name);
12751276 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
12771278 <div class="form__field-group @settings.WrapperCssClass dw-mod">
1279 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1280 {
1281 <div class="u-full-width">
1282 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1283 @if (settings.Link != null) {
1284 <div class="u-pull--right">
1285 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1286 @Render(settings.Link)
1287 </div>
1288 }
1289 </div>
1290 }
12911292 @if (!string.IsNullOrEmpty(settings.HelpText))
1293 {
1294 <small class="form__help-text">@settings.HelpText</small>
1295 }
12961297 <textarea class="u-full-width @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Value</textarea>
12981299 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1300 </div>
1301 }
1302 @using System.Reflection
1303 @using Dynamicweb.Rapido.Blocks.Components.General
1304 @using Dynamicweb.Rapido.Blocks.Components
130513061307 @* Component *@
13081309 @helper RenderHiddenField(HiddenField settings) {
1310 var attributes = new Dictionary<string, string>();
1311 attributes.Add("type", "hidden");
1312 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1313 if (settings.Value != null) { attributes.Add("value", settings.Value); }
1314 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
13151316 <input @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)/>
1317 }
1318 @using System.Reflection
1319 @using Dynamicweb.Rapido.Blocks.Components.General
1320 @using Dynamicweb.Rapido.Blocks.Components
13211322 @* Component *@
13231324 @helper RenderCheckboxField(CheckboxField settings)
1325 {
1326 var attributes = new Dictionary<string, string>();
1327 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1328 {
1329 settings.Id = Guid.NewGuid().ToString("N");
1330 }
13311332 /*base settings*/
1333 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1334 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1335 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1336 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1337 if (settings.Required) { attributes.Add("required", "true"); }
1338 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1339 /*end*/
13401341 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
13421343 attributes.Add("type", "checkbox");
1344 if (settings.Checked) { attributes.Add("checked", "true"); }
1345 settings.CssClass = "form__control " + settings.CssClass;
1346 if (settings.Value != null) { attributes.Add("value", settings.Value); }
13471348 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
13491350 <div class="form__field-group @settings.WrapperCssClass dw-mod">
1351 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1352 @if (!string.IsNullOrEmpty(settings.Label))
1353 {
1354 <label for="@settings.Id" class="dw-mod">@settings.Label</label>
1355 }
13561357 @if (settings.Link != null) {
1358 <span>
1359 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1360 @Render(settings.Link)
1361 </span>
1362 }
13631364 @if (!string.IsNullOrEmpty(settings.HelpText))
1365 {
1366 <small class="form__help-text checkbox-help dw-mod">@settings.HelpText</small>
1367 }
1368 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1369 </div>
1370 }
1371 @using System.Reflection
1372 @using Dynamicweb.Rapido.Blocks.Components.General
1373 @using Dynamicweb.Rapido.Blocks.Components
137413751376 @* Component *@
13771378 @helper RenderCheckboxListField(CheckboxListField settings)
1379 {
1380 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1381 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1382 {
1383 <div class="u-full-width">
1384 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1385 @if (settings.Link != null) {
1386 <div class="u-pull--right">
1387 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1388 @Render(settings.Link)
1389 </div>
1390 }
1391 </div>
13921393 }
13941395 <div class="u-pull--left">
1396 @if (!string.IsNullOrEmpty(settings.HelpText))
1397 {
1398 <small class="form__help-text">@settings.HelpText</small>
1399 }
14001401 @foreach (var item in settings.Options)
1402 {
1403 if (settings.Required)
1404 {
1405 item.Required = true;
1406 }
1407 if (settings.Disabled)
1408 {
1409 item.Disabled = true;
1410 }
1411 if (!string.IsNullOrEmpty(settings.Name))
1412 {
1413 item.Name = settings.Name;
1414 }
1415 if (!string.IsNullOrEmpty(settings.CssClass))
1416 {
1417 item.CssClass += settings.CssClass;
1418 }
14191420 /* value is not supported */
14211422 if (!string.IsNullOrEmpty(settings.OnClick))
1423 {
1424 item.OnClick += settings.OnClick;
1425 }
1426 if (!string.IsNullOrEmpty(settings.OnChange))
1427 {
1428 item.OnChange += settings.OnChange;
1429 }
1430 @Render(item)
1431 }
14321433 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1434 </div>
14351436 </div>
1437 }
1438 @using Dynamicweb.Rapido.Blocks.Components.General
14391440 @* Component *@
14411442 @helper RenderSearch(Search settings)
1443 {
1444 var searchValue = HttpContext.Current.Request.QueryString.Get(settings.SearchParameter) ?? "";
1445 var groupValue = HttpContext.Current.Request.QueryString.Get(settings.GroupsParameter) ?? "";
14461447 if (string.IsNullOrEmpty(settings.Id))
1448 {
1449 settings.Id = Guid.NewGuid().ToString("N");
1450 }
14511452 var resultAttributes = new Dictionary<string, string>();
14531454 if (settings.PageSize != 0)
1455 {
1456 resultAttributes.Add("data-page-size", settings.PageSize.ToString());
1457 }
1458 if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl))
1459 {
1460 resultAttributes.Add("data-groups-feed-url", settings.GroupItemsFeedUrl);
1461 if (!string.IsNullOrEmpty(groupValue))
1462 {
1463 resultAttributes.Add("data-selected-group", groupValue);
1464 }
1465 if (!string.IsNullOrEmpty(settings.GroupsParameter))
1466 {
1467 resultAttributes.Add("data-groups-parameter", settings.GroupsParameter);
1468 }
1469 }
1470 resultAttributes.Add("data-force-init", "true");
1471 if (settings.GoToFirstSearchResultOnEnter)
1472 {
1473 resultAttributes.Add("data-go-to-first-search-result-on-enter", settings.GoToFirstSearchResultOnEnter.ToString().ToLower());
1474 }
1475 if (!string.IsNullOrEmpty(settings.SearchParameter))
1476 {
1477 resultAttributes.Add("data-search-parameter", settings.SearchParameter);
1478 }
1479 resultAttributes.Add("data-search-feed-url", settings.SearchData.SearchFeedUrl);
1480 resultAttributes.Add("data-results-template-id", settings.SearchData.ResultsTemplateId);
14811482 if (settings.SecondSearchData != null)
1483 {
1484 resultAttributes.Add("data-second-search-feed-url", settings.SecondSearchData.SearchFeedUrl);
1485 resultAttributes.Add("data-second-results-template-id", settings.SecondSearchData.ResultsTemplateId);
1486 }
1487 if (!string.IsNullOrEmpty(settings.ResultsPageUrl))
1488 {
1489 resultAttributes.Add("data-results-page-url", settings.ResultsPageUrl);
1490 }
14911492 resultAttributes = resultAttributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
14931494 string searchFieldCss = (settings.SearchButton == null) ? "search--with-icon" : "";
14951496 <div class="search @settings.CssClass @searchFieldCss js-search-data-source dw-mod" id="@settings.Id" @ComponentMethods.AddAttributes(resultAttributes)>
1497 @if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl))
1498 {
1499 <button type="button" class="search__groups-btn dw-mod js-search-groups-btn">@Translate("All")</button>
1500 <ul class="dropdown dropdown--absolute-position dw-mod search__groups-results js-search-groups-list"></ul>
1501 }
15021503 <input type="text" class="search__field dw-mod js-search-field" placeholder="@settings.Placeholder" value="@searchValue">
15041505 <div class="dropdown dropdown--absolute-position search__results dw-mod js-search-results @(settings.SecondSearchData != null ? "search__results--combined" : "")">
1506 @if (settings.SecondSearchData != null)
1507 {
1508 <div class="search__column search__column--products dw-mod">
1509 <div class="search__column-header dw-mod">@Translate("Products")</div>
1510 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul>
1511 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl))
1512 {
1513 @Render(new Link {
1514 Title = Translate("View all"),
1515 CssClass = "js-view-all-button u-margin",
1516 Href = settings.SearchData.ResultsPageUrl
1517 });
1518 }
1519 </div>
1520 <div class="search__column search__column--pages dw-mod">
1521 <div class="search__column-header">@Translate("Pages")</div>
1522 <ul class="search__results-list dw-mod js-search-results-second-list" id="@(settings.Id)_SecondResultsList"></ul>
1523 @if (!string.IsNullOrEmpty(settings.SecondSearchData.ResultsPageUrl))
1524 {
1525 @Render(new Link
1526 {
1527 Title = Translate("View all"),
1528 CssClass = "js-view-all-button u-margin",
1529 Href = settings.SecondSearchData.ResultsPageUrl
1530 });
1531 }
1532 </div>
1533 }
1534 else
1535 {
1536 <div class="search__column search__column--only dw-mod">
1537 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul>
1538 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl))
1539 {
1540 @Render(new Link {
1541 Title = Translate("View all"),
1542 CssClass = "js-view-all-button u-margin",
1543 Href = settings.SearchData.ResultsPageUrl
1544 });
1545 }
1546 </div>
1547 }
1548 </div>
15491550 @if (settings.SearchButton != null)
1551 {
1552 settings.SearchButton.CssClass += " search__btn js-search-btn";
1553 if (settings.RenderDefaultSearchIcon)
1554 {
1555 settings.SearchButton.Icon = new Icon { Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue };
1556 }
1557 @Render(settings.SearchButton);
1558 }
1559 </div>
1560 }
1561 @using System.Reflection
1562 @using Dynamicweb.Rapido.Blocks.Components.General
1563 @using Dynamicweb.Rapido.Blocks.Components
156415651566 @* Component *@
15671568 @helper RenderSelectField(SelectField settings)
1569 {
1570 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1571 {
1572 settings.Id = Guid.NewGuid().ToString("N");
1573 }
15741575 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod">
1576 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1577 {
1578 <div class="u-full-width">
1579 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1580 @if (settings.Link != null) {
1581 <div class="u-pull--right">
1582 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1583 @Render(settings.Link)
1584 </div>
1585 }
1586 </div>
1587 }
15881589 @if (!string.IsNullOrEmpty(settings.HelpText))
1590 {
1591 <small class="form__help-text">@settings.HelpText</small>
1592 }
15931594 @if (settings.ActionButton != null)
1595 {
1596 settings.ActionButton.CssClass += " btn--condensed u-no-margin";
1597 <div class="form__field-combi u-no-margin dw-mod">
1598 @RenderSelectBase(settings)
1599 @Render(settings.ActionButton)
1600 </div>
1601 }
1602 else
1603 {
1604 @RenderSelectBase(settings)
1605 }
16061607 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1608 </div>
1609 }
16101611 @helper RenderSelectBase(SelectField settings)
1612 {
1613 var attributes = new Dictionary<string, string>();
16141615 /*base settings*/
1616 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1617 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1618 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1619 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1620 if (settings.Required) { attributes.Add("required", "true"); }
1621 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1622 /*end*/
16231624 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
16251626 <select @ComponentMethods.AddAttributes(resultAttributes) class="u-full-width @settings.CssClass dw-mod">
1627 @if (settings.Default != null)
1628 {
1629 @Render(settings.Default)
1630 }
16311632 @foreach (var item in settings.Options)
1633 {
1634 if (settings.Value != null) {
1635 item.Checked = item.Value == settings.Value;
1636 }
1637 @Render(item)
1638 }
1639 </select>
1640 }
1641 @using System.Reflection
1642 @using Dynamicweb.Rapido.Blocks.Components.General
1643 @using Dynamicweb.Rapido.Blocks.Components
16441645 @* Component *@
16461647 @helper RenderRadioButtonField(RadioButtonField settings)
1648 {
1649 var attributes = new Dictionary<string, string>();
1650 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1651 {
1652 settings.Id = Guid.NewGuid().ToString("N");
1653 }
16541655 /*base settings*/
1656 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1657 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1658 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1659 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1660 if (settings.Required) { attributes.Add("required", "true"); }
1661 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1662 /*end*/
16631664 attributes.Add("type", "radio");
1665 if (settings.Checked) { attributes.Add("checked", "true"); }
1666 settings.CssClass = "form__control " + settings.CssClass;
1667 if (settings.Value != null) { attributes.Add("value", settings.Value); }
16681669 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
16701671 <div class="form__field-group @settings.WrapperCssClass dw-mod">
1672 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1673 @if (!string.IsNullOrEmpty(settings.Label))
1674 {
1675 <label for="@settings.Id" class="dw-mod">@settings.Label</label>
1676 }
1677 @if (!string.IsNullOrEmpty(settings.HelpText))
1678 {
1679 <small class="form__help-text">@settings.HelpText</small>
1680 }
1681 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1682 </div>
1683 }
1684 @using System.Reflection
1685 @using Dynamicweb.Rapido.Blocks.Components.General
1686 @using Dynamicweb.Rapido.Blocks.Components
168716881689 @* Component *@
16901691 @helper RenderRadioButtonListField(RadioButtonListField settings)
1692 {
1693 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
16941695 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1696 @if (!string.IsNullOrEmpty(settings.Label))
1697 {
1698 <label>@settings.Label</label>
1699 }
1700 @if (!string.IsNullOrEmpty(settings.HelpText))
1701 {
1702 <small class="form__help-text">@settings.HelpText</small>
1703 }
17041705 @foreach (var item in settings.Options)
1706 {
1707 if (settings.Required)
1708 {
1709 item.Required = true;
1710 }
1711 if (settings.Disabled)
1712 {
1713 item.Disabled = true;
1714 }
1715 if (!string.IsNullOrEmpty(settings.Name))
1716 {
1717 item.Name = settings.Name;
1718 }
1719 if (settings.Value != null && settings.Value == item.Value)
1720 {
1721 item.Checked = true;
1722 }
1723 if (!string.IsNullOrEmpty(settings.OnClick))
1724 {
1725 item.OnClick += settings.OnClick;
1726 }
1727 if (!string.IsNullOrEmpty(settings.OnChange))
1728 {
1729 item.OnChange += settings.OnChange;
1730 }
1731 if (!string.IsNullOrEmpty(settings.CssClass))
1732 {
1733 item.CssClass += settings.CssClass;
1734 }
1735 @Render(item)
1736 }
17371738 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1739 </div>
1740 }
1741 @using System.Reflection
1742 @using Dynamicweb.Rapido.Blocks.Components.General
1743 @using Dynamicweb.Rapido.Blocks.Components
174417451746 @* Component *@
17471748 @helper RenderNotificationMessage(NotificationMessage settings)
1749 {
1750 if (!string.IsNullOrEmpty(settings.Message))
1751 {
1752 var attributes = new Dictionary<string, string>();
1753 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
17541755 string messageTypeClass = Enum.GetName(typeof(NotificationMessageType), settings.MessageType).ToLower();
1756 string messageLayoutClass = Enum.GetName(typeof(NotificationMessageLayout), settings.MessageLayout).ToLower();
1757 string minHeightClass = settings.Icon != null ? "u-min-h70px" : "";
17581759 <div class="notification-message-@messageTypeClass notification-message-@messageLayoutClass @messageLayoutClass @minHeightClass @settings.CssClass u-full-width dw-mod" @ComponentMethods.AddAttributes(attributes)>
1760 @if (settings.Icon != null) {
1761 settings.Icon.Label = !string.IsNullOrEmpty(settings.Icon.Label) ? settings.Message + settings.Icon.Label : settings.Message;
1762 @Render(settings.Icon)
1763 } else {
1764 @settings.Message
1765 }
1766 </div>
1767 }
1768 }
1769 @using Dynamicweb.Rapido.Blocks.Components.General
177017711772 @* Component *@
17731774 @helper RenderHandlebarsRoot(HandlebarsRoot settings) {
1775 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : "";
17761777 <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>
1778 @if (settings.SubBlocks != null) {
1779 @RenderBlockList(settings.SubBlocks)
1780 }
1781 </div>
1782 }
1783 @using System.Reflection
1784 @using Dynamicweb.Rapido.Blocks.Components.General
1785 @using Dynamicweb.Rapido.Blocks.Components
1786 @using System.Text.RegularExpressions
178717881789 @* Component *@
17901791 @helper RenderSticker(Sticker settings) {
1792 if (!String.IsNullOrEmpty(settings.Title)) {
1793 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : "";
1794 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : "";
17951796 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>();
1797 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) {
1798 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : "";
1799 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : "";
1800 optionalAttributes.Add("style", styleTag);
1801 }
18021803 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div>
1804 }
1805 }
18061807 @using System.Reflection
1808 @using Dynamicweb.Rapido.Blocks.Components.General
1809 @using Dynamicweb.Rapido.Blocks.Components
181018111812 @* Component *@
18131814 @helper RenderStickersCollection(StickersCollection settings)
1815 {
1816 if (settings.Stickers.Count > 0)
1817 {
1818 string position = "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower();
18191820 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1821 @foreach (Sticker sticker in settings.Stickers)
1822 {
1823 @Render(sticker)
1824 }
1825 </div>
1826 }
1827 }
18281829 @using Dynamicweb.Rapido.Blocks.Components.General
183018311832 @* Component *@
18331834 @helper RenderForm(Form settings) {
1835 if (settings != null)
1836 {
1837 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>();
1838 if (!string.IsNullOrEmpty(settings.Action)) { optionalAttributes.Add("action", settings.Action); };
1839 if (!string.IsNullOrEmpty(settings.Name)) { optionalAttributes.Add("name", settings.Name); };
1840 if (!string.IsNullOrEmpty(settings.OnSubmit)) { optionalAttributes.Add("onsubmit", settings.OnSubmit); };
1841 var enctypes = new Dictionary<string, string>
1842 {
1843 { "multipart", "multipart/form-data" },
1844 { "text", "text/plain" },
1845 { "application", "application/x-www-form-urlencoded" }
1846 };
1847 if (settings.Enctype != FormEnctype.none) { optionalAttributes.Add("enctype", enctypes[Enum.GetName(typeof(FormEnctype), settings.Enctype).ToLower()]); };
1848 optionalAttributes.Add("method", settings.Method.ToString());
18491850 if (!string.IsNullOrEmpty(settings.FormStartMarkup))
1851 {
1852 @settings.FormStartMarkup
1853 }
1854 else
1855 {
1856 @:<form class="@settings.CssClass u-no-margin dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1857 }
18581859 foreach (var field in settings.GetFields())
1860 {
1861 @Render(field)
1862 }
18631864 @:</form>
1865 }
1866 }
1867 @using System.Reflection
1868 @using Dynamicweb.Rapido.Blocks.Components.General
1869 @using Dynamicweb.Rapido.Blocks.Components
187018711872 @* Component *@
18731874 @helper RenderText(Text settings)
1875 {
1876 @settings.Content
1877 }
1878 @using System.Reflection
1879 @using Dynamicweb.Rapido.Blocks.Components.General
1880 @using Dynamicweb.Rapido.Blocks.Components
188118821883 @* Component *@
18841885 @helper RenderContentModule(ContentModule settings) {
1886 if (!string.IsNullOrEmpty(settings.Content))
1887 {
1888 @settings.Content
1889 }
1890 }
1891 @using System.Reflection
1892 @using Dynamicweb.Rapido.Blocks.Components.General
1893 @using Dynamicweb.Rapido.Blocks.Components
189418951896 @* Component *@
18971898 @helper RenderModal(Modal settings) {
1899 if (settings != null)
1900 {
1901 string modalId = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N");
19021903 string onchange = !string.IsNullOrEmpty(settings.OnClose) ? "onchange=\"if(!this.checked){" + settings.OnClose + "}\"" : "";
19041905 <input type="checkbox" id="@(modalId)ModalTrigger" class="modal-trigger" @onchange />
19061907 <div class="modal-container">
1908 @if (!settings.DisableDarkOverlay)
1909 {
1910 <label for="@(modalId)ModalTrigger" id="@(modalId)ModalOverlay" class="modal-overlay"></label>
1911 }
1912 <div class="modal modal--@settings.Width.ToString().ToLower() modal-height--@settings.Height.ToString().ToLower()" id="@(modalId)Modal">
1913 @if (settings.Heading != null)
1914 {
1915 if (!string.IsNullOrEmpty(settings.Heading.Title))
1916 {
1917 <div class="modal__header">
1918 @Render(settings.Heading)
1919 </div>
1920 }
1921 }
1922 <div class="modal__body @(settings.Width.ToString().ToLower() == "full" ? "modal__body--full" : "")">
1923 @if (!string.IsNullOrEmpty(settings.BodyText))
1924 {
1925 @settings.BodyText
1926 }
1927 @if (settings.BodyTemplate != null)
1928 {
1929 @settings.BodyTemplate
1930 }
1931 @{
1932 var actions = settings.GetActions();
1933 }
1934 </div>
1935 @if (actions.Length > 0)
1936 {
1937 <div class="modal__footer">
1938 @foreach (var action in actions)
1939 {
1940 if (Pageview.Device.ToString() != "Mobile") {
1941 action.CssClass += " u-no-margin";
1942 } else {
1943 action.CssClass += " u-full-width u-margin-bottom";
1944 }
19451946 @Render(action)
1947 }
1948 </div>
1949 }
1950 <label class="modal__close-btn" for="@(modalId)ModalTrigger"></label>
1951 </div>
1952 </div>
1953 }
1954 }
1955 @using Dynamicweb.Rapido.Blocks.Components.General
19561957 @* Component *@
19581959 @helper RenderMediaListItem(MediaListItem settings)
1960 {
1961 <div class="media-list-item @settings.CssClass dw-mod" @(!string.IsNullOrEmpty(settings.Id) ? "id=\"" + settings.Id + "\"" : "")>
1962 @if (!string.IsNullOrEmpty(settings.Label))
1963 {
1964 if (!string.IsNullOrEmpty(settings.Link))
1965 {
1966 @Render(new Link
1967 {
1968 Href = settings.Link,
1969 CssClass = "media-list-item__sticker dw-mod",
1970 ButtonLayout = ButtonLayout.None,
1971 Title = settings.Label,
1972 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : ""
1973 })
1974 }
1975 else if (!string.IsNullOrEmpty(settings.OnClick))
1976 {
1977 <span class="media-list-item__sticker dw-mod" onclick="@(settings.OnClick)">
1978 <span class="u-uppercase">@settings.Label</span>
1979 </span>
1980 }
1981 else
1982 {
1983 <span class="media-list-item__sticker media-list-item__sticker--no-link dw-mod">
1984 <span class="u-uppercase">@settings.Label</span>
1985 </span>
1986 }
1987 }
1988 <div class="media-list-item__wrap">
1989 <div class="media-list-item__info dw-mod">
1990 <div class="media-list-item__header dw-mod">
1991 @if (!string.IsNullOrEmpty(settings.Title))
1992 {
1993 if (!string.IsNullOrEmpty(settings.Link))
1994 {
1995 @Render(new Link
1996 {
1997 Href = settings.Link,
1998 CssClass = "media-list-item__name dw-mod",
1999 ButtonLayout = ButtonLayout.None,
2000 Title = settings.Title,
2001 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : ""
2002 })
2003 }
2004 else if (!string.IsNullOrEmpty(settings.OnClick))
2005 {
2006 <span class="media-list-item__name dw-mod" onclick="@(settings.OnClick)">@settings.Title</span>
2007 }
2008 else
2009 {
2010 <span class="media-list-item__name media-list-item__name--no-link dw-mod">@settings.Title</span>
2011 }
2012 }
20132014 @if (!string.IsNullOrEmpty(settings.Status))
2015 {
2016 <div class="media-list-item__state dw-mod">@settings.Status</div>
2017 }
2018 </div>
2019 @{
2020 settings.InfoTable.CssClass += " media-list-item__parameters-table";
2021 }
20222023 @Render(settings.InfoTable)
2024 </div>
2025 <div class="media-list-item__actions dw-mod">
2026 <div class="media-list-item__actions-list dw-mod">
2027 @{
2028 var actions = settings.GetActions();
20292030 foreach (ButtonBase action in actions)
2031 {
2032 action.ButtonLayout = ButtonLayout.None;
2033 action.CssClass += " media-list-item__action link";
20342035 @Render(action)
2036 }
2037 }
2038 </div>
20392040 @if (settings.SelectButton != null && !string.IsNullOrEmpty(settings.SelectButton.Title))
2041 {
2042 settings.SelectButton.CssClass += " u-no-margin";
20432044 <div class="media-list-item__action-button">
2045 @Render(settings.SelectButton)
2046 </div>
2047 }
2048 </div>
2049 </div>
2050 </div>
2051 }
2052 @using Dynamicweb.Rapido.Blocks.Components.General
2053 @using Dynamicweb.Rapido.Blocks.Components
20542055 @helper RenderTable(Table settings)
2056 {
2057 Dictionary<string, string> attributes = new Dictionary<string, string>();
2058 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
20592060 var enumToClasses = new Dictionary<TableDesign, string>
2061 {
2062 { TableDesign.Clean, "table--clean" },
2063 { TableDesign.Bordered, "table--bordered" },
2064 { TableDesign.Striped, "table--striped" },
2065 { TableDesign.Hover, "table--hover" },
2066 { TableDesign.Compact, "table--compact" },
2067 { TableDesign.Condensed, "table--condensed" },
2068 { TableDesign.NoTopBorder, "table--no-top-border" }
2069 };
2070 string tableDesignClass = "";
2071 if (settings.Design != TableDesign.None)
2072 {
2073 tableDesignClass = enumToClasses[settings.Design];
2074 }
20752076 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableDesign.None) { attributes.Add("class", "table " + tableDesignClass + " " + settings.CssClass + " dw-mod"); }
20772078 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);
20792080 <table @ComponentMethods.AddAttributes(resultAttributes)>
2081 @if (settings.Header != null)
2082 {
2083 <thead>
2084 @Render(settings.Header)
2085 </thead>
2086 }
2087 <tbody>
2088 @foreach (var row in settings.Rows)
2089 {
2090 @Render(row)
2091 }
2092 </tbody>
2093 @if (settings.Footer != null)
2094 {
2095 <tfoot>
2096 @Render(settings.Footer)
2097 </tfoot>
2098 }
2099 </table>
2100 }
2101 @using Dynamicweb.Rapido.Blocks.Components.General
2102 @using Dynamicweb.Rapido.Blocks.Components
21032104 @helper RenderTableRow(TableRow settings)
2105 {
2106 Dictionary<string, string> attributes = new Dictionary<string, string>();
2107 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
21082109 var enumToClasses = new Dictionary<TableRowDesign, string>
2110 {
2111 { TableRowDesign.NoBorder, "table__row--no-border" },
2112 { TableRowDesign.Border, "table__row--border" },
2113 { TableRowDesign.TopBorder, "table__row--top-line" },
2114 { TableRowDesign.BottomBorder, "table__row--bottom-line" },
2115 { TableRowDesign.Solid, "table__row--solid" }
2116 };
21172118 string tableRowDesignClass = "";
2119 if (settings.Design != TableRowDesign.None)
2120 {
2121 tableRowDesignClass = enumToClasses[settings.Design];
2122 }
21232124 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableRowDesign.None) { attributes.Add("class", "table__row " + tableRowDesignClass + " " + settings.CssClass + " dw-mod"); }
21252126 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);
21272128 <tr @ComponentMethods.AddAttributes(resultAttributes)>
2129 @foreach (var cell in settings.Cells)
2130 {
2131 if (settings.IsHeaderRow)
2132 {
2133 cell.IsHeader = true;
2134 }
2135 @Render(cell)
2136 }
2137 </tr>
2138 }
2139 @using Dynamicweb.Rapido.Blocks.Components.General
2140 @using Dynamicweb.Rapido.Blocks.Components
2141 @using Dynamicweb.Core
21422143 @helper RenderTableCell(TableCell settings)
2144 {
2145 Dictionary<string, string> attributes = new Dictionary<string, string>();
2146 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
2147 if (settings.Colspan != 0) { attributes.Add("colspan", Converter.ToString(settings.Colspan)); }
2148 if (settings.Rowspan != 0) { attributes.Add("rowspan", Converter.ToString(settings.Rowspan)); }
2149 if (!string.IsNullOrEmpty(settings.CssClass)) { attributes.Add("class", settings.CssClass + " dw-mod"); }
21502151 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);
21522153 string tagName = settings.IsHeader ? "th" : "td";
21542155 @("<" + tagName + " " + ComponentMethods.AddAttributes(resultAttributes) + ">")
2156 @settings.Content
2157 @("</" + tagName + ">");
2158 }
2159 @using System.Linq
2160 @using Dynamicweb.Rapido.Blocks.Components.General
21612162 @* Component *@
21632164 @helper RenderPagination(Dynamicweb.Rapido.Blocks.Components.General.Pagination settings)
2165 {
2166 var pageNumberQueryStringName = Dynamicweb.Rapido.Services.Pagination.GetPageNumberQueryStringName(settings); // Get the proper 'page number' query string parameter
2167 var queryParameters = Dynamicweb.Rapido.Services.Url.GetQueryParameters(pageNumberQueryStringName); // Get the NameValueCollection from the querystring
21682169 if (settings.NumberOfPages > 1)
2170 {
2171 string url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/Default.aspx";
2172 string ariaLabel = !string.IsNullOrWhiteSpace(settings.AriaLabel) ? settings.AriaLabel : Translate("Page navigation");
2173 Dictionary<string, int> startAndEndPageNumber = Dynamicweb.Rapido.Services.Pagination.GetStartAndEndPageNumber(settings);
21742175 <div class="pager u-margin-top dw-mod @settings.CssClass" aria-label="@ariaLabel">
2176 @if (settings.ShowPagingInfo)
2177 {
2178 <div class="pager__info dw-mod">
2179 @Translate("Page") @settings.CurrentPageNumber @Translate("of") @settings.NumberOfPages
2180 </div>
2181 }
2182 <ul class="pager__list dw-mod">
2183 @if (!string.IsNullOrWhiteSpace(settings.FirstPageUrl) && settings.ShowFirstAndLastControls)
2184 {
2185 @Render(new PaginationItem { Link = settings.FirstPageUrl, Icon = settings.FirstIcon })
2186 }
2187 @if (!string.IsNullOrWhiteSpace(settings.PreviousPageUrl) && settings.ShowNextAndPrevControls)
2188 {
2189 @Render(new PaginationItem { Link = settings.PreviousPageUrl, Icon = settings.PrevIcon })
2190 }
2191 @if (settings.GetPages().Any())
2192 {
2193 foreach (var page in settings.GetPages())
2194 {
2195 @Render(page)
2196 }
2197 }
2198 else
2199 {
2200 for (var page = startAndEndPageNumber["StartPage"]; page <= startAndEndPageNumber["EndPage"]; page++)
2201 {
2202 queryParameters = Dynamicweb.Rapido.Services.Url.UpdateQueryStringParameter(queryParameters, pageNumberQueryStringName, page.ToString());
2203 @Render(new PaginationItem { Label = page.ToString(), Link = Dynamicweb.Rapido.Services.Url.BuildUri(url, queryParameters).PathAndQuery, IsActive = (settings.CurrentPageNumber == page) });
2204 }
2205 }
2206 @if (!string.IsNullOrWhiteSpace(settings.NextPageUrl) && settings.ShowNextAndPrevControls)
2207 {
2208 @Render(new PaginationItem { Link = settings.NextPageUrl, Icon = settings.NextIcon })
2209 }
2210 @if (!string.IsNullOrWhiteSpace(settings.LastPageUrl) && settings.ShowFirstAndLastControls)
2211 {
2212 @Render(new PaginationItem { Link = settings.LastPageUrl, Icon = settings.LastIcon })
2213 }
2214 </ul>
2215 </div>
2216 }
2217 }
22182219 @helper RenderPaginationItem(PaginationItem settings)
2220 {
2221 if (settings.Icon == null)
2222 {
2223 settings.Icon = new Icon();
2224 }
22252226 settings.Icon.Label = settings.Label;
2227 <li class="pager__btn dw-mod">
2228 @if (settings.IsActive)
2229 {
2230 <span class="pager__num pager__num--current dw-mod">
2231 @Render(settings.Icon)
2232 </span>
2233 }
2234 else
2235 {
2236 <a href="@settings.Link" class="pager__num dw-mod">
2237 @Render(settings.Icon)
2238 </a>
2239 }
2240 </li>
2241 }
224222432244 @using Dynamicweb.Rapido.Blocks.Components.General
2245 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
224622472248 @using Dynamicweb.Frontend
2249 @using System.Reflection
2250 @using Dynamicweb.Content.Items
2251 @using System.Web.UI.HtmlControls
2252 @using Dynamicweb.Rapido.Blocks.Components
2253 @using Dynamicweb.Rapido.Blocks
2254 @using Dynamicweb.Rapido.Blocks.Components.Articles
22552256 @* Components for the articles *@
2257 @using System.Reflection
2258 @using Dynamicweb.Rapido.Blocks.Components.Articles
225922602261 @* Component for the articles *@
22622263 @helper RenderArticleBanner(dynamic settings) {
2264 string filterClasses = "image-filter image-filter--darken";
2265 settings.Layout = ArticleHeaderLayout.Banner;
22662267 if (settings.Image != null)
2268 {
2269 if (settings.Image.Path != null)
2270 {
2271 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width">
2272 <div class="background-image @filterClasses dw-mod">
2273 <div class="background-image__wrapper @filterClasses dw-mod">
2274 @{
2275 settings.Image.CssClass += "background-image__cover dw-mod";
2276 }
2277 @Render(settings.Image)
2278 </div>
2279 </div>
2280 <div class="center-container dw-mod">
2281 <div class="grid">
2282 <div class="grid__col-md-8 grid__col-xs-12 paragraph-container paragraph-container--height-lg">
2283 <div class="u-left-middle">
2284 <div>
2285 @if (!String.IsNullOrEmpty(settings.Heading))
2286 {
2287 <h1 class="article__header article__header--giant dw-mod" style="color: @settings.TextColor">@settings.Heading</h1>
2288 }
2289 @if (!String.IsNullOrEmpty(settings.Subheading))
2290 {
2291 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div>
2292 }
2293 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2294 {
2295 <small class="article__post-info u-margin-bottom--lg dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small>
2296 }
2297 @if (!String.IsNullOrEmpty(settings.Link)) {
2298 <div class="grid__cell">
2299 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2300 </div>
2301 }
2302 </div>
2303 </div>
2304 </div>
2305 @if (settings.ExternalParagraphId != 0)
2306 {
2307 <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod">
2308 <div class="u-color-light-gray--bg u-color-dark dw-mod">
2309 @RenderParagraphContent(settings.ExternalParagraphId)
2310 </div>
2311 </div>
2312 }
23132314 </div>
2315 </div>
2316 </section>
2317 if (!String.IsNullOrEmpty(settings.Image.Caption)) {
2318 <div class="image-caption dw-mod">@settings.Image.Caption</div>
2319 }
2320 }
2321 else
2322 {
2323 settings.Layout = ArticleHeaderLayout.Clean;
2324 @RenderArticleCleanHeader(settings);
2325 }
2326 }
2327 else
2328 {
2329 settings.Layout = ArticleHeaderLayout.Clean;
2330 @RenderArticleCleanHeader(settings);
2331 }
2332 }
2333 @using System.Reflection
2334 @using Dynamicweb.Rapido.Blocks.Components
2335 @using Dynamicweb.Rapido.Blocks.Components.General
2336 @using Dynamicweb.Rapido.Blocks.Components.Articles
2337 @using Dynamicweb.Rapido.Blocks
233823392340 @* Component for the articles *@
23412342 @helper RenderArticleHeader(ArticleHeader settings) {
2343 dynamic[] methodParameters = new dynamic[1];
2344 methodParameters[0] = settings;
2345 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleHeaderCustom");
23462347 if (customMethod != null)
2348 {
2349 @customMethod.Invoke(this, methodParameters).ToString();
2350 } else {
2351 switch (settings.Layout)
2352 {
2353 case ArticleHeaderLayout.Clean:
2354 @RenderArticleCleanHeader(settings);
2355 break;
2356 case ArticleHeaderLayout.Split:
2357 @RenderArticleSplitHeader(settings);
2358 break;
2359 case ArticleHeaderLayout.Banner:
2360 @RenderArticleBannerHeader(settings);
2361 break;
2362 case ArticleHeaderLayout.Overlay:
2363 @RenderArticleOverlayHeader(settings);
2364 break;
2365 default:
2366 @RenderArticleCleanHeader(settings);
2367 break;
2368 }
2369 }
2370 }
23712372 @helper RenderArticleCleanHeader(ArticleHeader settings) {
2373 dynamic[] methodParameters = new dynamic[1];
2374 methodParameters[0] = settings;
2375 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom");
23762377 if (customMethod != null)
2378 {
2379 @customMethod.Invoke(this, methodParameters).ToString();
2380 }
2381 else
2382 {
2383 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12";
23842385 <div class="grid grid--align-content-start grid--justify-start">
2386 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod">
2387 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0)
2388 {
2389 <div class="u-border-bottom u-padding-bottom">
2390 @if (!String.IsNullOrEmpty(settings.Category))
2391 {
2392 <div class="u-pull--left">
2393 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div>
2394 </div>
2395 }
2396 <div class="u-pull--right">
2397 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2398 {
2399 <small class="article__post-info dw-mod">@settings.Author @settings.Date</small>
2400 }
2401 @if (settings.RatingOutOf != 0)
2402 {
2403 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })
2404 }
2405 </div>
2406 </div>
2407 }
24082409 <div class="grid__cell">
2410 @if (!String.IsNullOrEmpty(settings.Heading))
2411 {
2412 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1>
2413 }
2414 @if (settings.Image != null)
2415 {
2416 if (settings.Image.Path != null)
2417 {
2418 <div class="u-padding-bottom--lg">
2419 @Render(settings.Image)
2420 </div>
2421 }
2422 }
2423 @if (!String.IsNullOrEmpty(settings.Subheading))
2424 {
2425 <div class="article__leadtext dw-mod">@settings.Subheading</div>
2426 }
2427 @if (!String.IsNullOrEmpty(settings.Link))
2428 {
2429 <div class="grid__cell">
2430 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2431 </div>
2432 }
2433 </div>
2434 </div>
2435 @if (settings.ExternalParagraphId != 0)
2436 {
2437 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod">
2438 @RenderParagraphContent(settings.ExternalParagraphId)
2439 </div>
2440 }
2441 </div>
2442 }
2443 }
24442445 @helper RenderArticleSplitHeader(ArticleHeader settings) {
2446 dynamic[] methodParameters = new dynamic[1];
2447 methodParameters[0] = settings;
2448 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSplitHeaderCustom");
24492450 if (customMethod != null)
2451 {
2452 @customMethod.Invoke(this, methodParameters).ToString();
2453 }
2454 else
2455 {
2456 string headerColumnWidth = settings.ExternalParagraphId != 0 ? "4" : "6";
24572458 if (settings.Image != null)
2459 {
2460 if (settings.Image.Path != null)
2461 {
2462 <section class="multiple-paragraphs-container paragraph-container--full-width">
2463 <div class="grid">
2464 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod">
2465 <div class="u-left-middle u-padding--lg">
2466 <div>
2467 @if (!String.IsNullOrEmpty(settings.Category))
2468 {
2469 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div>
2470 }
2471 @if (!String.IsNullOrEmpty(settings.Heading))
2472 {
2473 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1>
2474 }
2475 @if (!String.IsNullOrEmpty(settings.Subheading))
2476 {
2477 <div class="article__leadtext dw-mod">@settings.Subheading</div>
2478 }
2479 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2480 {
2481 <small class="article__post-info u-pull--left dw-mod">@settings.Author @settings.Date</small>
2482 }
2483 @if (settings.RatingOutOf != 0)
2484 {
2485 <div class="u-pull--right">
2486 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })
2487 </div>
2488 }
2489 @if (!String.IsNullOrEmpty(settings.Link)) {
2490 <div class="u-full-width u-pull--left u-margin-top">
2491 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2492 </div>
2493 }
2494 </div>
2495 </div>
2496 </div>
2497 <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>
2498 @if (settings.ExternalParagraphId != 0)
2499 {
2500 <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">
2501 @RenderParagraphContent(settings.ExternalParagraphId)
2502 </div>
2503 }
2504 </div>
2505 </section>
2506 }
2507 }
2508 else
2509 {
2510 @RenderArticleCleanHeader(settings);
2511 }
2512 }
2513 }
25142515 @helper RenderArticleOverlayHeader(ArticleHeader settings) {
2516 dynamic[] methodParameters = new dynamic[1];
2517 methodParameters[0] = settings;
2518 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleOverlayHeaderCustom");
25192520 if (customMethod != null)
2521 {
2522 @customMethod.Invoke(this, methodParameters).ToString();
2523 }
2524 else
2525 {
2526 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12";
2527 string contentAlignment = settings.TextLayout == ArticleHeaderTextLayout.Center ? "grid--justify-center" : "";
25282529 if (settings.Image != null)
2530 {
2531 if (settings.Image.Path != null)
2532 {
2533 if (settings.ExternalParagraphId == 0)
2534 {
2535 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width">
2536 <div class="background-image image-filter image-filter--darken dw-mod">
2537 <div class="background-image__wrapper image-filter image-filter--darken dw-mod">
2538 @{
2539 settings.Image.CssClass += "background-image__cover dw-mod";
2540 }
2541 @Render(settings.Image)
2542 </div>
2543 </div>
2544 <div class="center-container dw-mod">
2545 <div class="grid @contentAlignment">
2546 <div class="grid__col-md-@contentColumns grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod">
2547 @if (!string.IsNullOrEmpty(settings.Heading))
2548 {
2549 <h1 class="article__header article__header--giant u-padding-top--lg dw-mod" style="color: @settings.TextColor">@settings.Heading</h1>
2550 }
2551 @if (!String.IsNullOrEmpty(settings.Subheading))
2552 {
2553 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div>
2554 }
2555 <div class="u-margin-top">
2556 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2557 {
2558 <small class="article__post-info u-pull--left dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small>
2559 }
2560 @if (settings.RatingOutOf != 0)
2561 {
2562 <div class="u-pull--right">
2563 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })
2564 </div>
2565 }
2566 </div>
2567 @if (!String.IsNullOrEmpty(settings.Link))
2568 {
2569 <div class="grid__cell">
2570 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2571 </div>
2572 }
2573 </div>
2574 </div>
2575 </div>
2576 </section>
2577 }
2578 else
2579 {
2580 @RenderArticleBanner(settings);
2581 }
2582 }
2583 }
2584 else
2585 {
2586 @RenderArticleCleanHeader(settings);
2587 }
2588 }
2589 }
25902591 @helper RenderArticleBannerHeader(dynamic settings) {
2592 dynamic[] methodParameters = new dynamic[1];
2593 methodParameters[0] = settings;
2594 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerHeaderCustom");
25952596 if (customMethod != null)
2597 {
2598 @customMethod.Invoke(this, methodParameters).ToString();
2599 }
2600 else
2601 {
2602 @RenderArticleBanner(settings);
2603 }
2604 }
2605 @using System.Reflection
2606 @using System.Text.RegularExpressions;
2607 @using Dynamicweb.Frontend
2608 @using Dynamicweb.Content.Items
2609 @using Dynamicweb.Rapido.Blocks.Components
2610 @using Dynamicweb.Rapido.Blocks.Components.Articles
2611 @using Dynamicweb.Rapido.Blocks
26122613 @* Component for the articles *@
26142615 @helper RenderArticleBodyRow(ArticleBodyRow settings)
2616 {
2617 string position = settings.TopLayout == "overlay" ? "article__overlay-offset" : "";
2618 string contentAlignment = settings.TextLayout == "center" ? "grid--justify-center" : "";
26192620 <div class="grid grid--align-content-start @contentAlignment @position dw-mod">
2621 @RenderBlockList(settings.SubBlocks)
2622 </div>
2623 }
2624 @using System.Reflection
2625 @using Dynamicweb.Rapido.Blocks.Components
2626 @using Dynamicweb.Rapido.Blocks.Components.General
2627 @using Dynamicweb.Rapido.Blocks.Components.Articles
2628 @using Dynamicweb.Rapido.Blocks
26292630 @* Component for the articles *@
26312632 @helper RenderArticleImage(ArticleImage settings)
2633 {
2634 if (settings.Image != null)
2635 {
2636 if (settings.Image.Path != null)
2637 {
2638 <div class="u-margin-bottom--lg">
2639 @Render(settings.Image)
2640 </div>
2641 }
2642 }
2643 }
2644 @using System.Reflection
2645 @using Dynamicweb.Rapido.Blocks.Components
2646 @using Dynamicweb.Rapido.Blocks.Components.Articles
264726482649 @* Component for the articles *@
26502651 @helper RenderArticleSubHeader(ArticleSubHeader settings)
2652 {
2653 if (!String.IsNullOrEmpty(settings.Title))
2654 {
2655 <h2 class="article__header">@settings.Title</h2>
2656 }
2657 }
2658 @using System.Reflection
2659 @using Dynamicweb.Rapido.Blocks.Components
2660 @using Dynamicweb.Rapido.Blocks.Components.Articles
2661 @using Dynamicweb.Rapido.Blocks
266226632664 @* Component for the articles *@
26652666 @helper RenderArticleText(ArticleText settings)
2667 {
2668 if (!String.IsNullOrEmpty(settings.Text))
2669 {
2670 string greatTextClass = settings.EnableLargeText == true ? "article__paragraph--great-text" : "";
26712672 <div class="article__paragraph @greatTextClass dw-mod">
2673 @settings.Text
2674 </div>
2675 }
2676 }
2677 @using System.Reflection
2678 @using Dynamicweb.Rapido.Blocks.Components
2679 @using Dynamicweb.Rapido.Blocks.Components.Articles
2680 @using Dynamicweb.Rapido.Blocks
268126822683 @* Component for the articles *@
26842685 @helper RenderArticleQuote(ArticleQuote settings)
2686 {
2687 string text = Regex.Replace(settings.Text, "<.*?>", String.Empty);
26882689 <div class="grid u-padding-bottom--lg">
2690 @if (settings.Image != null)
2691 {
2692 if (settings.Image.Path != null) {
2693 <div class="grid__col-3">
2694 <div class="grid__cell-img">
2695 @{
2696 settings.Image.Title = !String.IsNullOrEmpty(settings.Image.Title) ? settings.Image.Title : settings.Author;
2697 settings.Image.CssClass += " article__image article__image--ball";
2698 settings.Image.ImageDefault.Width = 200;
2699 settings.Image.ImageDefault.Height = 200;
2700 }
2701 @Render(settings.Image)
2702 </div>
2703 </div>
2704 }
2705 }
2706 <div class="grid__col-auto">
2707 @if (!String.IsNullOrEmpty(settings.Text))
2708 {
2709 <div class="article__quote dw-mod">
2710 <i class="fas fa-quote-right u-margin-bottom--lg"></i>
2711 @settings.Text
2712 <i class="fas fa-quote-right"></i>
2713 </div>
2714 }
2715 @if (!String.IsNullOrEmpty(settings.Author))
2716 {
2717 <div class="article__quote-author dw-mod">
2718 - @settings.Author
2719 </div>
2720 }
2721 </div>
2722 </div>
2723 }
2724 @using System.Reflection
2725 @using Dynamicweb.Rapido.Blocks.Components
2726 @using Dynamicweb.Rapido.Blocks.Components.Articles
2727 @using Dynamicweb.Rapido.Blocks
27282729 @* Component for the articles *@
27302731 @helper RenderArticleInfoTable(ArticleInfoTable settings)
2732 {
2733 <table class="table table--clean">
2734 @foreach (var row in settings.Rows)
2735 {
2736 string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two";
27372738 <tr>
2739 @if (!String.IsNullOrEmpty(row.Icon))
2740 {
2741 <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td>
2742 }
2743 <td class="u-no-margin-on-p-elements">
2744 <div class="u-bold">@row.Title</div>
2745 @if (!String.IsNullOrEmpty(row.SubTitle))
2746 {
2747 if (row.Link == null)
2748 {
2749 <div>@row.SubTitle</div>
2750 }
2751 else
2752 {
2753 <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a>
2754 }
2755 }
2756 </td>
2757 </tr>
2758 }
2759 </table>
2760 }
2761 @using System.Reflection
2762 @using Dynamicweb.Rapido.Blocks.Components
2763 @using Dynamicweb.Rapido.Blocks.Components.General
2764 @using Dynamicweb.Rapido.Blocks.Components.Articles
2765 @using Dynamicweb.Rapido.Blocks
27662767 @* Component for the articles *@
27682769 @helper RenderArticleGalleryModal(ArticleGalleryModal settings)
2770 {
2771 Modal galleryModal = new Modal
2772 {
2773 Id = "ParagraphGallery",
2774 Width = ModalWidth.Full,
2775 BodyTemplate = RenderArticleGalleryModalContent()
2776 };
27772778 @Render(galleryModal)
2779 }
27802781 @helper RenderArticleGalleryModalContent() {
2782 <div class="modal__image-min-size-wrapper">
2783 @Render(new Image {
2784 Id = "ParagraphGallery",
2785 Path = "#",
2786 CssClass = "modal--full__img",
2787 DisableLazyLoad = true,
2788 DisableImageEngine = true
2789 })
2790 </div>
27912792 <div class="modal__images-counter" id="ParagraphGallery_counter"></div>
27932794 @Render(new Button {
2795 Id = "ParagraphGallery_prev",
2796 ButtonType = ButtonType.Button,
2797 ButtonLayout = ButtonLayout.None,
2798 CssClass = "modal__prev-btn",
2799 Icon = new Icon { Prefix = "far", Name = "fa-angle-left", LabelPosition = IconLabelPosition.After },
2800 OnClick = "Gallery.prevImage('ParagraphGallery')"
2801 })
28022803 @Render(new Button {
2804 Id = "ParagraphGallery_next",
2805 ButtonType = ButtonType.Button,
2806 ButtonLayout = ButtonLayout.None,
2807 CssClass = "modal__next-btn",
2808 Icon = new Icon { Prefix = "far", Name = "fa-angle-right", LabelPosition = IconLabelPosition.After },
2809 OnClick = "Gallery.nextImage('ParagraphGallery')"
2810 })
2811 }
2812 @using System.Reflection
2813 @using Dynamicweb.Rapido.Blocks.Components
2814 @using Dynamicweb.Rapido.Blocks.Components.Articles
2815 @using Dynamicweb.Rapido.Blocks
281628172818 @* Component for the articles *@
28192820 @helper RenderArticleRelated(ArticleRelated settings)
2821 {
2822 string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : "";
2823 string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : "";
28242825 <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width">
2826 <div class="center-container dw-mod">
2827 <div class="grid u-padding">
2828 <div class="grid__col-md-12 grid__col-xs-12">
2829 <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2>
2830 </div>
2831 </div>
28322833 <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>
28342835 <script id="RelatedSimpleTemplate" type="text/x-template">
2836 {{#.}}
2837 <div class="grid u-padding-bottom--lg">
2838 {{#Cases}}
2839 <div class="grid__col-lg-3 grid__col-sm-6 image-hover--zoom dw-mod">
2840 <a href="{{link}}" class="u-full-height u-color-light--bg u-flex u-flex--column">
2841 {{#if image}}
2842 <div class="u-color-light--bg u-no-padding dw-mod">
2843 <div class="flex-img image-hover__wrapper">
2844 <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}}" />
2845 </div>
2846 </div>
2847 {{/if}}
28482849 <div class="card u-color-light--bg u-full-height dw-mod">
2850 <h3 class="article-list__item-header u-truncate-text dw-mod">{{title}}</h3>
2851 <p class="article__short-summary dw-mod">{{summary}}</p>
2852 </div>
2853 </a>
2854 </div>
2855 {{/Cases}}
2856 </div>
2857 {{/.}}
2858 </script>
2859 </div>
2860 </section>
2861 }
2862 @using System.Reflection
2863 @using Dynamicweb.Rapido.Blocks.Components
2864 @using Dynamicweb.Rapido.Blocks.Components.Articles
2865 @using Dynamicweb.Rapido.Blocks
286628672868 @* Component for the articles *@
28692870 @helper RenderArticleMenu(ArticleMenu settings)
2871 {
2872 if (!String.IsNullOrEmpty(settings.Title)) {
2873 <div class="u-margin u-border-bottom">
2874 <h3 class="u-no-margin">@settings.Title</h3>
2875 </div>
2876 }
28772878 <ul class="menu-left u-margin-bottom dw-mod">
2879 @foreach (var item in settings.Items)
2880 {
2881 @Render(item)
2882 }
2883 </ul>
2884 }
28852886 @helper RenderArticleMenuItem(ArticleMenuItem settings)
2887 {
2888 string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#";
28892890 if (!String.IsNullOrEmpty(settings.Title)) {
2891 <li class="menu-left__item dw-mod">
2892 <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a>
2893 </li>
2894 }
2895 }
2896 @using System.Reflection
2897 @using Dynamicweb.Rapido.Blocks.Components
2898 @using Dynamicweb.Rapido.Blocks.Components.Articles
2899 @using Dynamicweb.Rapido.Blocks
29002901 @* Component for the articles *@
29022903 @helper RenderArticleList(ArticleList settings)
2904 {
2905 if (Pageview != null)
2906 {
2907 bool isParagraph = Pageview.CurrentParagraph != null ? true : false;
2908 string[] sortArticlesListBy = new string[2];
29092910 if (isParagraph) {
2911 sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" };
2912 }
2913 else {
2914 sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" };
2915 }
29162917 string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString();
29182919 if (!settings.DisablePagination) {
2920 @RenderItemList(new
2921 {
2922 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle",
2923 ListSourceType = settings.SourceType,
2924 ListSourcePage = sourcePage,
2925 ItemFieldsList = "*",
2926 Filter = settings.Filter,
2927 ListOrderBy = sortArticlesListBy[0],
2928 ListOrderByDirection = sortArticlesListBy[1],
2929 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date",
2930 ListSecondOrderByDirection = "ASC",
2931 IncludeAllChildItems = true,
2932 ListTemplate = settings.Template,
2933 ListPageSize = settings.PageSize.ToString()
2934 });
2935 } else {
2936 @RenderItemList(new
2937 {
2938 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle",
2939 ListSourceType = settings.SourceType,
2940 ListSourcePage = sourcePage,
2941 ItemFieldsList = "*",
2942 Filter = settings.Filter,
2943 ListOrderBy = sortArticlesListBy[0],
2944 ListOrderByDirection = sortArticlesListBy[1],
2945 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date",
2946 ListSecondOrderByDirection = "ASC",
2947 IncludeAllChildItems = true,
2948 ListTemplate = settings.Template,
2949 ListPageSize = settings.PageSize.ToString(),
2950 ListViewMode = "Partial",
2951 ListShowTo = settings.PageSize + 1
2952 });
2953 }
2954 }
2955 }
2956 @using System.Reflection
2957 @using Dynamicweb.Rapido.Blocks.Components.Articles
295829592960 @* Component for the articles *@
29612962 @helper RenderArticleSummary(ArticleSummary settings)
2963 {
2964 if (!String.IsNullOrEmpty(settings.Text))
2965 {
2966 <div class="article__summary dw-mod">@settings.Text</div>
2967 }
2968 }
2969 @using System.Reflection
2970 @using Dynamicweb.Rapido.Blocks.Components
2971 @using Dynamicweb.Rapido.Blocks.Components.Articles
2972 @using Dynamicweb.Rapido.Blocks
29732974 @* Component for the articles *@
29752976 @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings)
2977 {
2978 string pageId = Pageview.ID.ToString();
2979 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All");
2980 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString());
29812982 foreach (var option in settings.Categories)
2983 {
2984 selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter;
2985 }
29862987 if (selectedFilter == pageId)
2988 {
2989 selectedFilter = Translate("All");
2990 }
29912992 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
2993 {
2994 <div class="u-pull--right u-margin-left">
2995 <div class="collection u-no-margin">
2996 <h5>@Translate("Category")</h5>
2997 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" />
2998 <div class="dropdown u-w180px dw-mod">
2999 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label>
3000 <div class="dropdown__content dw-mod">
3001 @foreach (var option in settings.Categories)
3002 {
3003 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div>
3004 }
3005 </div>
3006 <label class="dropdown-trigger-off" for="CategorySelector"></label>
3007 </div>
3008 </div>
3009 </div>
3010 }
3011 else
3012 {
3013 <div class="u-full-width u-margin-bottom">
3014 <h5 class="u-no-margin">@Translate("Category")</h5>
3015 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" />
3016 <div class="dropdown u-full-width dw-mod">
3017 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label>
3018 <div class="dropdown__content dw-mod">
3019 @foreach (var option in settings.Categories)
3020 {
3021 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div>
3022 }
3023 </div>
3024 <label class="dropdown-trigger-off" for="CategorySelector"></label>
3025 </div>
3026 </div>
3027 }
3028 }
3029 @using System.Reflection
3030 @using Dynamicweb.Rapido.Blocks.Components
3031 @using Dynamicweb.Rapido.Blocks.Components.Articles
3032 @using Dynamicweb.Rapido.Blocks
3033 @using System.Collections.Generic
30343035 @* Component for the articles *@
30363037 @helper RenderArticleListFilter(ArticleListFilter settings)
3038 {
3039 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All");
3040 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString());
30413042 if (settings.Options != null)
3043 {
3044 if (settings.Options is IEnumerable<dynamic>)
3045 {
3046 var options = (IEnumerable<dynamic>) settings.Options;
3047 settings.Options = options.OrderBy(item => item.Name);
3048 }
30493050 foreach (var option in settings.Options)
3051 {
3052 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter;
3053 }
30543055 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
3056 {
3057 <div class="u-pull--right u-margin-left">
3058 <div class="collection u-no-margin">
3059 <h5>@settings.Label</h5>
3060 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" />
3061 <div class="dropdown u-w180px dw-mod">
3062 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label>
3063 <div class="dropdown__content dw-mod">
3064 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div>
3065 @foreach (var option in settings.Options)
3066 {
3067 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div>
3068 }
3069 </div>
3070 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label>
3071 </div>
3072 </div>
3073 </div>
3074 }
3075 else
3076 {
3077 <div class="u-full-width u-margin-bottom">
3078 <h5 class="u-no-margin">@settings.Label</h5>
3079 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" />
3080 <div class="dropdown u-full-width w-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 }
3093 }
3094 }
3095 @using System.Reflection
3096 @using Dynamicweb.Rapido.Blocks.Components
3097 @using Dynamicweb.Rapido.Blocks.Components.Articles
3098 @using Dynamicweb.Rapido.Blocks
30993100 @* Component for the articles *@
31013102 @helper RenderArticleListSearch(ArticleListSearch settings)
3103 {
3104 string searchParameter = !string.IsNullOrEmpty(settings.SearchParameter) ? settings.SearchParameter : "Title";
3105 string searchWord = HttpContext.Current.Request.QueryString.Get(searchParameter);
3106 string searchString = !string.IsNullOrEmpty(searchWord) ? searchWord.Trim('*') : "";
3107 string className = "u-w340px u-pull--right u-margin-left";
31083109 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet")
3110 {
3111 className = "u-full-width";
3112 }
31133114 <div class="typeahead u-color-inherit u-margin-bottom dw-mod @className">
3115 <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 + '*')">
3116 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button>
3117 </div>
3118 }
3119 @using System.Reflection
3120 @using Dynamicweb.Rapido.Blocks.Components
3121 @using Dynamicweb.Rapido.Blocks.Components.Articles
3122 @using Dynamicweb.Rapido.Blocks
31233124 @* Component for the articles *@
31253126 @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings)
3127 {
3128 <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div>
3129 }
3130 @using System.Reflection
3131 @using Dynamicweb.Rapido.Blocks.Components
3132 @using Dynamicweb.Rapido.Blocks.Components.General
3133 @using Dynamicweb.Rapido.Blocks.Components.Articles
3134 @using Dynamicweb.Rapido.Blocks
3135 @using System.Text.RegularExpressions
31363137 @* Component for the articles *@
31383139 @helper RenderArticleListItem(ArticleListItem settings)
3140 {
3141 switch (settings.Type) {
3142 case ArticleListItemType.Card:
3143 @RenderArticleListItemCard(settings);
3144 break;
3145 case ArticleListItemType.List:
3146 @RenderArticleListItemList(settings);
3147 break;
3148 case ArticleListItemType.Simple:
3149 @RenderArticleListItemSimple(settings);
3150 break;
3151 default:
3152 @RenderArticleListItemCard(settings);
3153 break;
3154 }
3155 }
31563157 @helper RenderArticleListItemCard(ArticleListItem settings) {
3158 <a href="@settings.Link" class="u-full-height u-color-light--bg u-flex u-flex--column">
3159 <div class="u-color-light--bg u-no-padding dw-mod">
3160 @if (settings.Logo != null)
3161 {
3162 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;" : "";
3163 settings.Logo.ImageDefault.Crop = 5;
3164 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width;
3165 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height;
3166 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage">
3167 @if (settings.Stickers != null)
3168 {
3169 if (settings.Stickers.Position != StickersListPosition.Custom && settings.Stickers.Position != StickersListPosition.None)
3170 {
3171 @Render(settings.Stickers);
3172 }
3173 }
3174 @RenderImage(settings.Logo)
3175 </div>
3176 } else if (settings.Image != null)
3177 {
3178 <div class="flex-img image-hover__wrapper u-position-relative dw-mod">
3179 @if (settings.Stickers != null)
3180 {
3181 if (settings.Stickers.Position != StickersListPosition.Custom && settings.Stickers.Position != StickersListPosition.None)
3182 {
3183 @Render(settings.Stickers);
3184 }
3185 }
3186 @Render(settings.Image)
3187 </div>
3188 }
3189 </div>
31903191 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary))
3192 {
3193 <div class="card u-color-light--bg u-full-height dw-mod">
3194 @if (settings.Stickers != null)
3195 {
3196 if (settings.Stickers.Position == StickersListPosition.Custom)
3197 {
3198 @Render(settings.Stickers);
3199 }
3200 }
3201 @if (!String.IsNullOrEmpty(settings.Title))
3202 {
3203 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3>
3204 }
3205 @if (!String.IsNullOrEmpty(settings.SubTitle))
3206 {
3207 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>
3208 }
3209 @if (!String.IsNullOrEmpty(settings.Summary))
3210 {
3211 <p class="article__short-summary dw-mod">@settings.Summary</p>
3212 }
3213 </div>
3214 }
3215 </a>
3216 }
32173218 @helper RenderArticleListItemList(ArticleListItem settings) {
3219 <a href="@settings.Link">
3220 <div class="grid u-color-light--bg u-no-padding dw-mod">
3221 <div class="grid__col-md-3">
3222 <div class="u-color-light--bg u-no-padding dw-mod">
3223 @if (settings.Logo != null)
3224 {
3225 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;" : "";
3226 settings.Logo.ImageDefault.Crop = 5;
3227 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width;
3228 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height;
3229 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage">
3230 @if (settings.Stickers != null)
3231 {
3232 if (settings.Stickers.Position != StickersListPosition.Custom)
3233 {
3234 @Render(settings.Stickers);
3235 }
3236 }
3237 @RenderImage(settings.Logo)
3238 </div>
3239 } else if (settings.Image != null)
3240 {
3241 <div class="flex-img image-hover__wrapper dw-mod">
3242 @if (settings.Stickers != null)
3243 {
3244 if (settings.Stickers.Position != StickersListPosition.Custom)
3245 {
3246 @Render(settings.Stickers);
3247 }
3248 }
3249 @Render(settings.Image)
3250 </div>
3251 }
3252 </div>
3253 </div>
32543255 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary))
3256 {
3257 <div class="grid__col-md-9">
3258 @if (!String.IsNullOrEmpty(settings.Title))
3259 {
3260 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3>
3261 }
3262 @if (settings.Stickers != null)
3263 {
3264 if (settings.Stickers.Position == StickersListPosition.Custom)
3265 {
3266 @Render(settings.Stickers);
3267 }
3268 }
3269 @if (!String.IsNullOrEmpty(settings.SubTitle))
3270 {
3271 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>
3272 }
3273 @if (!String.IsNullOrEmpty(settings.Summary))
3274 {
3275 <p class="article__short-summary dw-mod">@settings.Summary</p>
3276 }
3277 </div>
3278 }
3279 </div>
3280 </a>
3281 }
32823283 @helper RenderArticleListItemSimple(ArticleListItem settings) {
3284 <a href="@settings.Link" class="u-color-inherit">
3285 <div class="grid u-color-light--bg u-no-padding dw-mod">
3286 <div class="grid__col-md-12">
3287 @if (!String.IsNullOrEmpty(settings.Title))
3288 {
3289 <div class="article-list-item__header u-truncate-text u-no-margin dw-mod">@settings.Title</div>
3290 }
3291 @if (!String.IsNullOrEmpty(settings.SubTitle))
3292 {
3293 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>
3294 }
3295 </div>
3296 </div>
3297 </a>
3298 }
3299 @using System.Reflection
3300 @using Dynamicweb.Rapido.Blocks.Components.Articles
330133023303 @* Component for the articles *@
33043305 @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings)
3306 {
3307 <small class="article__subscription">
3308 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date)))
3309 {
3310 <text>@Translate("Written")</text>
3311 }
3312 @if (!string.IsNullOrWhiteSpace(settings.Author))
3313 {
3314 <text>@Translate("by") @settings.Author</text>
3315 }
3316 @if (!string.IsNullOrWhiteSpace(settings.Date))
3317 {
3318 <text>@Translate("on") @settings.Date</text>
3319 }
3320 </small>
3321 }
3322 @using System.Reflection
3323 @using Dynamicweb.Rapido.Blocks.Components.Articles
3324 @using Dynamicweb.Rapido.Blocks.Components.General
332533263327 @* Component for the articles *@
33283329 @helper RenderArticleLink(ArticleLink settings)
3330 {
3331 if (!string.IsNullOrEmpty(settings.Title))
3332 {
3333 Button link = new Button {
3334 ConfirmText = settings.ConfirmText,
3335 ConfirmTitle = settings.ConfirmTitle,
3336 ButtonType = settings.ButtonType,
3337 Id = settings.Id,
3338 Title = settings.Title,
3339 AltText = settings.AltText,
3340 OnClick = settings.OnClick,
3341 CssClass = settings.CssClass,
3342 Disabled = settings.Disabled,
3343 Icon = settings.Icon,
3344 Name = settings.Name,
3345 Href = settings.Href,
3346 ButtonLayout = settings.ButtonLayout,
3347 ExtraAttributes = settings.ExtraAttributes
3348 };
3349 <div class="grid__cell">
3350 @Render(link)
3351 </div>
3352 }
3353 }
3354 @using System.Reflection
3355 @using Dynamicweb.Rapido.Blocks
3356 @using Dynamicweb.Rapido.Blocks.Components.Articles
3357 @using Dynamicweb.Rapido.Blocks.Components.General
335833593360 @* Component for the articles *@
33613362 @helper RenderArticleCarousel(ArticleCarousel settings)
3363 {
3364 <div class="grid">
3365 <div class="grid__col-12 u-no-padding u-margin-bottom">
3366 <div class="carousel" id="carousel_@settings.Id">
3367 <div class="carousel__container js-carousel-slides dw-mod">
3368 @RenderBlockList(settings.SubBlocks)
3369 </div>
3370 </div>
3371 </div>
3372 </div>
33733374 <script>
3375 document.addEventListener("DOMContentLoaded", function () {
3376 new CarouselModule("#carousel_@settings.Id", {
3377 slideTime: 0,
3378 dots: true
3379 });
3380 });
3381 </script>
3382 }
33833384 @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings)
3385 {
3386 string imageEngine = "/Admin/Public/GetImage.ashx?";
33873388 string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image;
3389 if (settings.ImageSettings != null)
3390 {
3391 defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : "";
3392 defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : "";
3393 defaultImage += "Crop=" + settings.ImageSettings.Crop + "&";
3394 defaultImage += "Compression=" + settings.ImageSettings.Compression + "&";
3395 defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&";
3396 defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&";
3397 }
3398 defaultImage += "&Image=" + settings.Image;
33993400 <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')">
3401 <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title">
3402 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2>
3403 <div class="article-list__item-info">
3404 @if (settings.Stickers != null)
3405 {
3406 settings.Stickers.Position = StickersListPosition.Custom;
3407 @Render(settings.Stickers);
3408 }
34093410 <small class="u-margin-top--lg u-color-light">
3411 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date)))
3412 {
3413 <text>@Translate("Written")</text>
3414 }
3415 @if (!string.IsNullOrWhiteSpace(settings.Author))
3416 {
3417 <text>@Translate("by") @settings.Author</text>
3418 }
3419 @if (!string.IsNullOrWhiteSpace(settings.Date))
3420 {
3421 <text>@Translate("on") @settings.Date</text>
3422 }
3423 </small>
3424 </div>
34253426 <h3 class="article__short-summary u-color-light">@settings.Summary</h3>
3427 </a>
3428 @if (settings.UseFilters == true)
3429 {
3430 <div class="background-image image-filter image-filter--darken dw-mod"></div>
3431 }
3432 </div>
3433 }
3434 @using System.Text.RegularExpressions
3435 @using Dynamicweb.Rapido.Blocks.Components
3436 @using Dynamicweb.Rapido.Blocks.Components.General
3437 @using Dynamicweb.Rapido.Blocks.Components.Articles
3438 @using Dynamicweb.Rapido.Blocks
34393440 @* Component for the articles *@
34413442 @helper RenderArticleVideo(ArticleVideo settings)
3443 {
3444 if (settings.Url != null)
3445 {
3446 //getting video ID from youtube URL
3447 string videoCode = settings.Url;
3448 Regex regex = new Regex(@".be\/(.[^?]*)");
3449 Match match = regex.Match(videoCode);
3450 string videoId = "";
3451 if (match.Success)
3452 {
3453 videoId = match.Groups[1].Value;
3454 }
3455 else
3456 {
3457 regex = new Regex(@"v=([^&]+)");
3458 match = regex.Match(videoCode);
3459 if (match.Success)
3460 {
3461 videoId = match.Groups[1].Value;
3462 }
3463 }
34643465 int autoPlay = settings.AutoPlay == "true" ? 1 : 0;
34663467 <div class="video-wrapper">
3468 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div>
3469 </div>
3470 }
3471 }
3472347334743475 @* Simple helpers *@
34763477 @*Requires the Gallery ItemType that comes with Rapido*@
3478 @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) {
3479 if (gallery != null && gallery.Count > 0)
3480 {
3481 int count = 1;
34823483 foreach (var item in gallery)
3484 {
3485 if (item.GetFile("ImagePath") != null)
3486 {
3487 string image = item.GetFile("ImagePath").PathUrlEncoded;
3488 string imagePrefix = "/Admin/Public/GetImage.ashx?width=1200&height=820&crop=5&Compression=75&DoNotUpscale=1&image=";
3489 int imagesCount = gallery.Count;
34903491 if (count == 1)
3492 {
3493 <label class="gallery" for="ParagraphGalleryModalTrigger" onclick="Gallery.openImage(this.querySelector('.js-gallery'))">
3494 <span class="gallery__main-image">
3495 <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" />
3496 </span>
3497 <span class="gallery__image-counter">
3498 <i class="fas fa-camera fa-2x"></i> <span class="gallery__image-counter__number">@imagesCount</span>
3499 <span class="gallery__image-counter__text">@Translate("See all") <i class="fas fa-angle-right"></i></span>
3500 </span>
3501 </label>
3502 }
3503 else
3504 {
3505 <div class="u-hidden js-gallery" data-for="ParagraphGallery" data-image="@imagePrefix@image"></div>
3506 }
35073508 count++;
3509 }
3510 }
35113512 @Render(new ArticleGalleryModal())
3513 }
3514 }
35153516 @helper RenderMobileFilters(List<Block> subBlocks)
3517 {
3518 if (subBlocks.Count > 0)
3519 {
3520 <div class="grid__col-12">
3521 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" />
3522 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters">
3523 @RenderBlockList(subBlocks)
3524 </div>
3525 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label>
3526 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label>
3527 </div>
3528 }
3529 }
353035313532 @* Include the Blocks for the page *@
3533 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
35343535 @using System
3536 @using System.Web
3537 @using System.Collections.Generic
3538 @using Dynamicweb.Rapido.Blocks.Extensibility
3539 @using Dynamicweb.Rapido.Blocks
35403541 @functions {
3542 string GoogleTagManagerID = "";
3543 string GoogleAnalyticsID = "";
3544 }
35453546 @{
3547 GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID");
3548 GoogleAnalyticsID = Model.Area.Item.GetItem("Settings").GetString("GoogleAnalyticsTrackingID");
35493550 BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master");
35513552 if (!string.IsNullOrWhiteSpace(GoogleAnalyticsID))
3553 {
3554 Block tagManager = new Block()
3555 {
3556 Id = "GoogleAnalytics",
3557 SortId = 0,
3558 Template = RenderGoogleAnalyticsSnippet()
3559 };
3560 topSnippetsBlocksPage.Add("Head", tagManager);
3561 }
35623563 if (!string.IsNullOrWhiteSpace(GoogleTagManagerID))
3564 {
3565 Block tagManager = new Block()
3566 {
3567 Id = "TagManager",
3568 SortId = 1,
3569 Template = RenderGoogleTagManager()
3570 };
3571 topSnippetsBlocksPage.Add("Head", tagManager);
35723573 Block tagManagerBodySnippet = new Block()
3574 {
3575 Id = "TagManagerBodySnippet",
3576 SortId = 1,
3577 Template = RenderGoogleTagManagerBodySnippet()
3578 };
3579 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManagerBodySnippet);
3580 }
35813582 Block facebookPixel = new Block()
3583 {
3584 Id = "FacebookPixel",
3585 SortId = 2,
3586 Template = RenderFacebookPixel()
3587 };
35883589 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel);
3590 }
35913592 @helper RenderGoogleAnalyticsSnippet()
3593 {
3594 <!-- Global site tag (gtag.js) - Google Analytics -->
3595 <script async src="https://www.googletagmanager.com/gtag/js?id=@GoogleAnalyticsID"></script>
3596 <script>
3597 window.dataLayer = window.dataLayer || [];
3598 function gtag(){dataLayer.push(arguments);}
3599 gtag('js', new Date());
36003601 gtag('config', '@GoogleAnalyticsID');
3602 </script>
36033604 }
36053606 @helper RenderGoogleTagManager()
3607 {
3608 <script>
3609 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
3610 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
3611 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
3612 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
3613 })(window,document,'script','dataLayer','@GoogleTagManagerID');
3614 </script>
3615 }
36163617 @helper RenderGoogleTagManagerBodySnippet()
3618 {
3619 <!-- Google Tag Manager (noscript) -->
3620 <noscript>
3621 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID"
3622 height="0" width="0" style="display:none;visibility:hidden"></iframe>
3623 </noscript>
3624 <!-- End Google Tag Manager (noscript) -->
3625 }
36263627 @helper RenderFacebookPixel()
3628 {
3629 string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID");
36303631 if (!string.IsNullOrWhiteSpace(FacebookPixelID))
3632 {
3633 <!-- Facebook Pixel Code -->
3634 <script>
3635 !function(f,b,e,v,n,t,s)
3636 {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
3637 n.callMethod.apply(n,arguments):n.queue.push(arguments)};
3638 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
3639 n.queue=[];t=b.createElement(e);t.async=!0;
3640 t.src=v;s=b.getElementsByTagName(e)[0];
3641 s.parentNode.insertBefore(t,s)}(window, document,'script',
3642 'https://connect.facebook.net/en_US/fbevents.js');
3643 fbq('init', '@FacebookPixelID');
3644 fbq('track', 'PageView');
3645 </script>
3646 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript>
3647 }
3648 }
3649 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
36503651 @using System
3652 @using System.Web
3653 @using System.Collections.Generic
3654 @using Dynamicweb.Rapido.Blocks
3655 @using Dynamicweb.Rapido.Blocks.Extensibility
3656 @using Dynamicweb.Security.UserManagement
3657 @using Dynamicweb.Security.UserManagement.ExternalAuthentication
3658 @using Dynamicweb.Rapido.Blocks.Components.General
36593660 @{
3661 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master");
36623663 Block loginModal = new Block()
3664 {
3665 Id = "LoginModal",
3666 SortId = 10,
3667 Component = new Modal
3668 {
3669 Id = "SignIn",
3670 Heading = new Heading
3671 {
3672 Level = 0,
3673 Title = Translate("Sign in")
3674 },
3675 Width = ModalWidth.Sm,
3676 BodyTemplate = RenderLoginForm()
3677 }
3678 };
36793680 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal);
3681 }
36823683 @helper RenderLoginForm()
3684 {
3685 int pageId = Model.TopPage.ID;
3686 string userSignedInErrorText = "";
3687 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
3688 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery";
3689 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");
3690 bool showModalOnStart = pageId != GetPageIdByNavigationTag("CustomerCenter") && Model.LogOnFailed;
3691 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");
3692 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink");
36933694 ProviderCollection providers = Provider.GetActiveProviders();
36953696 if (Model.LogOnFailed)
3697 {
3698 switch (Model.LogOnFailedReason)
3699 {
3700 case LogOnFailedReason.PasswordLengthInvalid:
3701 userSignedInErrorText = Translate("Password length is invalid");
3702 break;
3703 case LogOnFailedReason.IncorrectLogin:
3704 userSignedInErrorText = Translate("Invalid email or password");
3705 break;
3706 case LogOnFailedReason.ExceededFailedLogOnLimit:
3707 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked");
3708 break;
3709 case LogOnFailedReason.LoginLocked:
3710 userSignedInErrorText = Translate("The user account is temporarily locked");
3711 break;
3712 case LogOnFailedReason.PasswordExpired:
3713 userSignedInErrorText = Translate("The password has expired and needs to be renewed");
3714 break;
3715 default:
3716 userSignedInErrorText = Translate("An unknown error occured");
3717 break;
3718 }
3719 }
37203721 Form form = new Form { Method = FormMethod.Post, Name = "LoginModalForm" };
37223723 TextField passwordField = new TextField { Id = "login-password", Type = TextFieldType.Password, Name = "password", Label = Translate("Password"), Required = true };
37243725 if (!hideForgotPasswordLink) {
3726 passwordField.Link = new Link { Title = Translate("Forgot password?"), Href = "/Default.aspx?id=" + signInProfilePageId + "&LoginAction=Recovery" };
3727 }
37283729 form.Add(new HiddenField { Name = "ID", Value = Converter.ToString(pageId) });
3730 form.Add(new HiddenField { Name = "DWExtranetUsernameRemember", Value = "True" });
3731 form.Add(new HiddenField { Name = "DWExtranetPasswordRemember", Value = "True" });
3732 form.Add(new HiddenField { Name = "LoginAction", Value = "Login" });
3733 form.Add(new TextField { Id = "LoginUsername", Name = "username", Label = Translate("Email"), CssClass = "u-full-width", Required = true });
3734 form.Add(passwordField);
3735 form.Add(new NotificationMessage { Message = userSignedInErrorText, MessageType = NotificationMessageType.Error });
3736 form.Add(new CheckboxField { Id = "LoginRememberMe", Value = "True", Name = "Autologin", Label = Translate("Remember me") });
3737 form.Add(new Button { ButtonType = ButtonType.Submit, Title = Translate("Sign in"), CssClass = "btn--full", OnClick = "Buttons.LockButton(event)" });
37383739 foreach (Provider LoginProvider in providers)
3740 {
3741 var ProviderName = LoginProvider.Name.ToLower();
3742 form.Add(new Link {
3743 Href = "/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=" + LoginProvider.ID,
3744 Icon = new Icon { Prefix = "fab", Name = "fa-" + ProviderName, CssClass = "fa-1_5x", LabelPosition = IconLabelPosition.After },
3745 ButtonLayout = ButtonLayout.LinkClean,
3746 CssClass = "btn--condensed u-margin-bottom u-margin-right u-inline-block u-color-" + ProviderName,
3747 AltText = ProviderName
3748 });
3749 }
37503751 if (!hideCreateAccountLink) {
3752 form.Add(new Text { Content = "<div class=\"u-border-top u-full-width u-margin-bottom--lg\"></div>" });
3753 form.Add(new Link
3754 {
3755 Href = "/Default.aspx?id=" + createAccountPageId,
3756 ButtonLayout = ButtonLayout.LinkClean,
3757 Title = Translate("Create account"),
3758 CssClass = "u-full-width u-ta-center"
3759 });
3760 }
37613762 @Render(form)
37633764 if (showModalOnStart)
3765 {
3766 <script>
3767 document.getElementById("SignInModalTrigger").checked = true;
3768 </script>
3769 }
3770 }
37713772 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet")
3773 {
3774 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
37753776 @using System
3777 @using System.Web
3778 @using System.Collections.Generic
3779 @using Dynamicweb.Rapido.Blocks.Extensibility
3780 @using Dynamicweb.Rapido.Blocks
3781 @using Dynamicweb.Rapido.Services
378237833784 @functions {
3785 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master");
3786 }
37873788 @{
3789 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";
3790 bool mobileHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");
3791 bool mobileHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart") || !Dynamicweb.Rapido.Services.User.IsBuyingAllowed();
37923793 Block mobileHeader = new Block()
3794 {
3795 Id = "MobileTop",
3796 SortId = 10,
3797 Template = RenderMobileTop(),
3798 SkipRenderBlocksList = true
3799 };
3800 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader);
38013802 Block mobileHeaderNavigation = new Block()
3803 {
3804 Id = "MobileHeaderNavigation",
3805 SortId = 10,
3806 Template = RenderMobileHeaderNavigation(),
3807 SkipRenderBlocksList = true,
3808 BlocksList = new List<Block> {
3809 new Block {
3810 Id = "MobileHeaderNavigationTrigger",
3811 SortId = 10,
3812 Template = RenderMobileHeaderNavigationTrigger()
3813 }
3814 }
3815 };
3816 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation);
38173818 Block mobileHeaderLogo = new Block()
3819 {
3820 Id = "MobileHeaderLogo",
3821 SortId = 20,
3822 Template = RenderMobileHeaderLogo(),
3823 SkipRenderBlocksList = true
3824 };
3825 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo);
38263827 Block mobileHeaderActions = new Block()
3828 {
3829 Id = "MobileHeaderActions",
3830 SortId = 30,
3831 Template = RenderMobileTopActions(),
3832 SkipRenderBlocksList = true
3833 };
3834 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions);
38353836 if (!mobileHideSearch)
3837 {
3838 Block mobileHeaderSearch = new Block
3839 {
3840 Id = "MobileHeaderSearch",
3841 SortId = 10,
3842 Template = RenderMobileTopSearch()
3843 };
3844 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch);
3845 }
38463847 Block mobileHeaderMiniCart;
38483849 if (!mobileHideCart)
3850 {
3851 mobileHeaderMiniCart = new Block
3852 {
3853 Id = "MobileHeaderMiniCart",
3854 SortId = 20,
3855 Template = RenderMobileTopMiniCart()
3856 };
38573858 Block miniCartCounterScriptTemplate = new Block
3859 {
3860 Id = "MiniCartCounterScriptTemplate",
3861 Template = RenderMobileMiniCartCounterContent()
3862 };
3863 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate);
3864 }
3865 else
3866 {
3867 mobileHeaderMiniCart = new Block
3868 {
3869 Id = "MobileHeaderMiniCart",
3870 SortId = 20
3871 };
3872 }
38733874 if (!mobileHideSearch)
3875 {
3876 Block mobileHeaderSearchBar = new Block()
3877 {
3878 Id = "MobileHeaderSearchBar",
3879 SortId = 30,
3880 Template = RenderMobileTopSearchBar()
3881 };
3882 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar);
3883 }
38843885 switch (mobileTopLayout)
3886 {
3887 case "nav-left":
3888 mobileHeaderNavigation.SortId = 10;
3889 mobileHeaderLogo.SortId = 20;
3890 mobileHeaderActions.SortId = 30;
3891 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart);
3892 break;
3893 case "nav-right":
3894 mobileHeaderLogo.SortId = 10;
3895 mobileHeaderActions.SortId = 20;
3896 mobileHeaderNavigation.SortId = 30;
3897 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart);
3898 break;
3899 case "nav-search-left":
3900 mobileHeaderNavigation.SortId = 10;
3901 mobileHeaderLogo.SortId = 20;
3902 mobileHeaderActions.SortId = 30;
3903 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart);
3904 break;
3905 case "search-left":
3906 mobileHeaderActions.SortId = 10;
3907 mobileHeaderLogo.SortId = 20;
3908 mobileHeaderNavigation.SortId = 30;
3909 mobileHeaderMiniCart.SortId = 0;
3910 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart);
3911 break;
3912 }
3913 }
391439153916 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
39173918 @using System
3919 @using System.Web
3920 @using Dynamicweb.Rapido.Blocks.Extensibility
3921 @using Dynamicweb.Rapido.Blocks
39223923 @{
3924 BlocksPage customMobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master");
3925 }
39263927392839293930 @helper RenderMobileTop() {
3931 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList();
39323933 <nav class="main-navigation-mobile dw-mod">
3934 <div class="center-container top-container__center-container dw-mod">
3935 <div class="grid grid--align-center">
3936 @RenderBlockList(subBlocks)
3937 </div>
3938 </div>
3939 </nav>
3940 }
39413942 @helper RenderMobileHeaderNavigation() {
3943 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList();
39443945 <div class="grid__col-auto-width">
3946 <ul class="menu dw-mod">
3947 @RenderBlockList(subBlocks)
3948 </ul>
3949 </div>
3950 }
39513952 @helper RenderMobileHeaderNavigationTrigger() {
3953 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">
3954 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label>
3955 </li>
3956 }
39573958 @helper RenderMobileHeaderLogo() {
3959 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList();
39603961 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";
3962 string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : "";
3963 string firstPageId = Model.Area.FirstActivePage.ID.ToString();
3964 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName");
39653966 string mobileLogo = "/Files/Images/logo-dynamicweb.png";
3967 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null)
3968 {
3969 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded;
3970 }
39713972 if (Path.GetExtension(mobileLogo).ToLower() != ".svg")
3973 {
3974 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&width=100&crop=5&Compression=75&image=" + mobileLogo;
3975 }
3976 else
3977 {
3978 mobileLogo = HttpUtility.UrlDecode(mobileLogo);
3979 }
39803981 <div class="grid__col-auto grid__col--bleed">
3982 <div class="grid__cell @centeredLogo">
3983 <a href="/Default.aspx?ID=@firstPageId" class="logo logo--mobile u-inline-block dw-mod">
3984 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" />
3985 </a>
3986 </div>
39873988 @RenderBlockList(subBlocks)
3989 </div>
3990 }
39913992 @helper RenderMobileTopActions() {
3993 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList();
39943995 <div class="grid__col-auto-width">
3996 <ul class="menu dw-mod">
3997 @RenderBlockList(subBlocks)
3998 </ul>
3999 </div>
4000 }
40014002 @helper RenderMobileTopSearch() {
4003 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">
4004 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod">
4005 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i>
4006 </label>
4007 </li>
4008 }
40094010 @helper RenderMobileTopMiniCart() {
4011 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
4012 int cartPageId = GetPageIdByNavigationTag("CartPage");
4013 double cartProductsCount = Model.Cart.TotalProductsCount;
40144015 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper">
4016 <div class="mini-cart dw-mod">
4017 <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">
4018 <div class="u-inline u-position-relative">
4019 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i>
4020 <div class="mini-cart__counter dw-mod">
4021 <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">
4022 <div class="js-mini-cart-counter-content" data-count="@cartProductsCount">
4023 @cartProductsCount
4024 </div>
4025 </div>
4026 </div>
4027 </div>
4028 </a>
4029 </div>
4030 </li>
4031 }
40324033 @helper RenderMobileTopSearchBar()
4034 {
4035 string searchFeedId = "";
4036 string searchSecondFeedId = "";
4037 int groupsFeedId;
4038 int productsPageId = GetPageIdByNavigationTag("ProductsPage");
4039 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;
4040 string resultPageLink;
4041 string searchPlaceholder;
4042 string searchType = "product-search";
4043 string searchTemplate;
4044 string searchContentTemplate = "";
4045 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? "";
4046 bool showGroups = true;
40474048 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch")
4049 {
4050 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true";
4051 resultPageLink = contentSearchPageLink;
4052 searchPlaceholder = Translate("Search page");
4053 groupsFeedId = 0;
4054 searchType = "content-search";
4055 searchTemplate = "SearchPagesTemplate";
4056 showGroups = false;
4057 }
4058 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch")
4059 {
4060 searchFeedId = productsPageId + "&feed=true";
4061 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true";
4062 resultPageLink = Converter.ToString(productsPageId);
4063 searchPlaceholder = Translate("Search products or pages");
4064 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed");
4065 searchType = "combined-search";
4066 searchTemplate = "SearchProductsTemplateWrap";
4067 searchContentTemplate = "SearchPagesTemplateWrap";
4068 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector");
4069 }
4070 else
4071 {
4072 resultPageLink = Converter.ToString(productsPageId);
4073 searchFeedId = productsPageId + "&feed=true";
4074 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed");
4075 searchPlaceholder = Translate("Search products");
4076 searchTemplate = "SearchProductsTemplate";
4077 searchType = "product-search";
4078 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector");
4079 }
40804081 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" />
40824083 <div class="main-navigation-mobile typeahead-mobile dw-mod">
4084 <div class="center-container top-container__center-container dw-mod">
4085 <div class="grid">
4086 <div class="grid__col-auto">
4087 <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">
4088 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue">
4089 @if (string.IsNullOrEmpty(searchSecondFeedId))
4090 {
4091 <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>
4092 }
4093 else
4094 {
4095 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid">
4096 <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>
4097 <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>
4098 </div>
4099 }
4100 <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>
4101 </div>
4102 </div>
4103 <div class="grid__col-auto-width">
4104 <ul class="menu dw-mod">
4105 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">
4106 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod">
4107 <i class="fas fa-times fa-1_5x"></i>
4108 </label>
4109 </li>
4110 </ul>
4111 </div>
4112 </div>
4113 </div>
4114 </div>
4115 }
41164117 @helper RenderMobileMiniCartCounterContent()
4118 {
4119 <script id="MiniCartCounterContent" type="text/x-template">
4120 {{#.}}
4121 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}">
4122 {{numberofproducts}}
4123 </div>
4124 {{/.}}
4125 </script>
4126 }
4127 </text>
4128 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
41294130 @using System
4131 @using System.Web
4132 @using System.Collections.Generic
4133 @using Dynamicweb.Rapido.Blocks.Extensibility
4134 @using Dynamicweb.Rapido.Blocks
41354136 @functions {
4137 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master");
4138 }
41394140 @{
4141 bool mobileNavigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn");
4142 bool mobileHideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");
4143 bool mobileHideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile");
4144 bool mobileHideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders");
4145 bool mobileHideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards");
4146 bool mobileHideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites");
41474148 Block mobileNavigation = new Block()
4149 {
4150 Id = "MobileNavigation",
4151 SortId = 10,
4152 Template = MobileNavigation(),
4153 SkipRenderBlocksList = true
4154 };
4155 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation);
41564157 if (Model.CurrentUser.ID > 0 && !mobileHideMyProfileLink)
4158 {
4159 Block mobileNavigationSignIn = new Block
4160 {
4161 Id = "MobileNavigationSignIn",
4162 SortId = 10,
4163 Template = RenderMobileNavigationSignIn()
4164 };
4165 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn);
4166 }
41674168 Block mobileNavigationMenu = new Block
4169 {
4170 Id = "MobileNavigationMenu",
4171 SortId = 20,
4172 Template = RenderMobileNavigationMenu()
4173 };
4174 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu);
41754176 Block mobileNavigationActions = new Block
4177 {
4178 Id = "MobileNavigationActions",
4179 SortId = 30,
4180 Template = RenderMobileNavigationActions(),
4181 SkipRenderBlocksList = true
4182 };
4183 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions);
41844185 if (!mobileNavigationItemsHideSignIn)
4186 {
4187 if (Model.CurrentUser.ID <= 0)
4188 {
4189 Block mobileNavigationSignInAction = new Block
4190 {
4191 Id = "MobileNavigationSignInAction",
4192 SortId = 10,
4193 Template = RenderMobileNavigationSignInAction()
4194 };
4195 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction);
41964197 if (!mobileHideCreateAccountLink)
4198 {
4199 Block mobileNavigationCreateAccountAction = new Block
4200 {
4201 Id = "MobileNavigationCreateAccountAction",
4202 SortId = 20,
4203 Template = RenderMobileNavigationCreateAccountAction()
4204 };
4205 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction);
4206 }
4207 }
4208 else
4209 {
4210 if (!mobileHideMyOrdersLink)
4211 {
4212 Block mobileNavigationOrdersAction = new Block
4213 {
4214 Id = "MobileNavigationOrdersAction",
4215 SortId = 20,
4216 Template = RenderMobileNavigationOrdersAction()
4217 };
4218 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction);
4219 }
4220 if (!mobileHideMyFavoritesLink)
4221 {
4222 Block mobileNavigationFavoritesAction = new Block
4223 {
4224 Id = "MobileNavigationFavoritesAction",
4225 SortId = 30,
4226 Template = RenderMobileNavigationFavoritesAction()
4227 };
4228 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction);
4229 }
4230 if (!mobileHideMySavedCardsLink)
4231 {
4232 Block mobileNavigationSavedCardsAction = new Block
4233 {
4234 Id = "MobileNavigationFavoritesAction",
4235 SortId = 30,
4236 Template = RenderMobileNavigationSavedCardsAction()
4237 };
4238 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction);
4239 }
42404241 Block mobileNavigationSignOutAction = new Block
4242 {
4243 Id = "MobileNavigationSignOutAction",
4244 SortId = 40,
4245 Template = RenderMobileNavigationSignOutAction()
4246 };
4247 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction);
4248 }
4249 }
42504251 if (Model.Languages.Count > 1)
4252 {
4253 Block mobileNavigationLanguagesAction = new Block
4254 {
4255 Id = "MobileNavigationLanguagesAction",
4256 SortId = 50,
4257 Template = RenderMobileNavigationLanguagesAction()
4258 };
4259 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction);
4260 }
4261 }
426242634264 @helper MobileNavigation()
4265 {
4266 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList();
4267 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left";
4268 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right";
42694270 <!-- Trigger for mobile navigation -->
4271 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" />
42724273 <!-- Mobile navigation -->
4274 <nav class="mobile-navigation mobile-navigation--@position dw-mod">
4275 <div class="mobile-navigation__wrapper" id="mobileNavigationWrapper">
4276 @RenderBlockList(subBlocks)
4277 </div>
4278 </nav>
42794280 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label>
4281 }
42824283 @helper RenderMobileNavigationSignIn()
4284 {
4285 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4286 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");
4287 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
4288 string myProfilePageLink = linkStart + myProfilePageId;
4289 string userName = Model.CurrentUser.FirstName;
4290 if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(Model.CurrentUser.LastName))
4291 {
4292 userName += " " + Model.CurrentUser.LastName;
4293 }
4294 if (string.IsNullOrEmpty(userName))
4295 {
4296 userName = Model.CurrentUser.Name;
4297 }
4298 if (string.IsNullOrEmpty(userName))
4299 {
4300 userName = Model.CurrentUser.UserName;
4301 }
4302 if (string.IsNullOrEmpty(userName))
4303 {
4304 userName = Model.CurrentUser.Email;
4305 }
43064307 <ul class="menu menu-mobile">
4308 <li class="menu-mobile__item">
4309 <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>
4310 </li>
4311 </ul>
4312 }
43134314 @helper RenderMobileNavigationMenu()
4315 {
4316 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides";
4317 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt";
4318 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3";
4319 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");
4320 int startLevel = 0;
43214322 @RenderNavigation(new
4323 {
4324 id = "mobilenavigation",
4325 cssclass = "menu menu-mobile dwnavigation",
4326 startLevel = @startLevel,
4327 ecomStartLevel = @startLevel + 1,
4328 endlevel = @levels,
4329 expandmode = "all",
4330 template = @menuTemplate
4331 })
43324333 if (isSlidesDesign)
4334 {
4335 <script>
4336 function goToLevel(level) {
document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%";
}
43374338 document.addEventListener('DOMContentLoaded', function () {
4339 goToLevel(document.getElementById('mobileNavigationWrapper').querySelectorAll('input[type=radio]:checked').length);
4340 });
4341 </script>
4342 }
43434344 if (renderPagesInToolBar)
4345 {
4346 @RenderNavigation(new
4347 {
4348 id = "topToolsMobileNavigation",
4349 cssclass = "menu menu-mobile dwnavigation",
4350 template = "ToolsMenuForMobile.xslt"
4351 })
4352 }
4353 }
43544355 @helper RenderMobileNavigationActions()
4356 {
4357 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ;
43584359 <ul class="menu menu-mobile">
4360 @RenderBlockList(subBlocks)
4361 </ul>
4362 }
43634364 @helper RenderMobileNavigationSignInAction()
4365 {
4366 <li class="menu-mobile__item">
4367 <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>
4368 </li>
4369 }
43704371 @helper RenderMobileNavigationCreateAccountAction()
4372 {
4373 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");
43744375 <li class="menu-mobile__item">
4376 <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>
4377 </li>
4378 }
43794380 @helper RenderMobileNavigationProfileAction()
4381 {
4382 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4383 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
4384 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");
4385 string myProfilePageLink = linkStart + myProfilePageId;
43864387 <li class="menu-mobile__item">
4388 <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>
4389 </li>
4390 }
43914392 @helper RenderMobileNavigationOrdersAction()
4393 {
4394 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4395 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
4396 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders");
4397 string myOrdersPageLink = linkStart + myOrdersPageId;
4398 string ordersIcon = "fas fa-list";
43994400 <li class="menu-mobile__item">
4401 <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>
4402 </li>
4403 }
44044405 @helper RenderMobileNavigationFavoritesAction()
4406 {
4407 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4408 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
4409 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");
4410 string myFavoritesPageLink = linkStart + myFavoritesPageId;
4411 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";
441244134414 <li class="menu-mobile__item">
4415 <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>
4416 </li>
4417 }
44184419 @helper RenderMobileNavigationSavedCardsAction()
4420 {
4421 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4422 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
4423 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards");
4424 string mySavedCardsPageLink = linkStart + mySavedCardsPageId;
4425 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";
44264427 <li class="menu-mobile__item">
4428 <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>
4429 </li>
4430 }
44314432 @helper RenderMobileNavigationSignOutAction()
4433 {
4434 int pageId = Model.TopPage.ID;
4435 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";
44364437 <li class="menu-mobile__item">
4438 <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>
4439 </li>
4440 }
44414442 @helper RenderMobileNavigationLanguagesAction()
4443 {
4444 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides";
44454446 string selectedLanguage = "";
4447 foreach (var lang in Model.Languages)
4448 {
4449 if (lang.IsCurrent)
4450 {
4451 selectedLanguage = lang.Name;
4452 }
4453 }
44544455 <li class="menu-mobile__item dw-mod">
4456 @if (isSlidesDesign)
4457 {
4458 <input id="MobileMenuCheck_Language" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(1);">
4459 }
4460 else
4461 {
4462 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger">
4463 }
4464 <div class="menu-mobile__link__wrap">
4465 <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>
4466 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label>
4467 </div>
4468 <ul class="menu-mobile menu-mobile__submenu expand-menu">
4469 @if (isSlidesDesign)
4470 {
4471 <li class="menu-mobile__item dw-mod">
4472 <div class="menu-mobile__link__wrap">
4473 <input id="MobileMenuCheck_Language_back" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(0);" />
4474 <label for="MobileMenuCheck_Language_back" class="menu-mobile__trigger menu-mobile__trigger--back"></label>
4475 <label for="MobileMenuCheck_Language_back" class="menu-mobile__link dw-mod ">@Translate("Back")</label>
4476 </div>
4477 </li>
4478 }
4479 @foreach (var lang in Model.Languages)
4480 {
4481 <li class="menu-mobile__item dw-mod">
4482 <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>
4483 </li>
4484 }
4485 </ul>
4486 </li>
4487 }</text>
4488 }
4489 else
4490 {
4491 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
44924493 @using System
4494 @using System.Web
4495 @using System.Collections.Generic
4496 @using Dynamicweb.Rapido.Blocks.Extensibility
4497 @using Dynamicweb.Rapido.Blocks
44984499 @functions {
4500 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master");
4501 }
45024503 @{
4504 Block masterTools = new Block()
4505 {
4506 Id = "MasterDesktopTools",
4507 SortId = 10,
4508 Template = RenderDesktopTools(),
4509 SkipRenderBlocksList = true,
4510 BlocksList = new List<Block>
4511 {
4512 new Block {
4513 Id = "MasterDesktopToolsText",
4514 SortId = 10,
4515 Template = RenderDesktopToolsText(),
4516 Design = new Design
4517 {
4518 Size = "auto",
4519 HidePadding = true,
4520 RenderType = RenderType.Column
4521 }
4522 },
4523 new Block {
4524 Id = "MasterDesktopToolsNavigation",
4525 SortId = 20,
4526 Template = RenderDesktopToolsNavigation(),
4527 Design = new Design
4528 {
4529 Size = "auto-width",
4530 HidePadding = true,
4531 RenderType = RenderType.Column
4532 }
4533 }
4534 }
4535 };
4536 headerBlocksPage.Add("MasterHeader", masterTools);
45374538 Block masterDesktopExtra = new Block()
4539 {
4540 Id = "MasterDesktopExtra",
4541 SortId = 10,
4542 Template = RenderDesktopExtra(),
4543 SkipRenderBlocksList = true
4544 };
4545 headerBlocksPage.Add("MasterHeader", masterDesktopExtra);
45464547 Block masterDesktopNavigation = new Block()
4548 {
4549 Id = "MasterDesktopNavigation",
4550 SortId = 20,
4551 Template = RenderDesktopNavigation(),
4552 SkipRenderBlocksList = true
4553 };
4554 headerBlocksPage.Add("MasterHeader", masterDesktopNavigation);
4555 }
45564557 @* Include the Blocks for the page *@
4558 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
45594560 @using System
4561 @using System.Web
4562 @using Dynamicweb.Rapido.Blocks.Extensibility
4563 @using Dynamicweb.Rapido.Blocks
45644565 @{
4566 Block masterDesktopLogo = new Block
4567 {
4568 Id = "MasterDesktopLogo",
4569 SortId = 10,
4570 Template = RenderDesktopLogo(),
4571 Design = new Design
4572 {
4573 Size = "auto-width",
4574 HidePadding = true,
4575 RenderType = RenderType.Column,
4576 CssClass = "grid--align-self-center"
4577 }
4578 };
45794580 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo);
4581 }
458245834584 @helper RenderDesktopLogo()
4585 {
4586 string firstPageId = Model.Area.FirstActivePage.ID.ToString();
4587 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4588 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : "";
4589 alignClass = topLayout == "splitted-center" ? "u-middle" : alignClass;
4590 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png";
4591 if (Path.GetExtension(logo).ToLower() != ".svg")
4592 {
4593 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight");
4594 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40;
4595 logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&crop=5&Compression=75&image=" + logo;
4596 }
4597 else
4598 {
4599 logo = HttpUtility.UrlDecode(logo);
4600 }
46014602 <div class="logo @alignClass dw-mod">
4603 <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block">
4604 <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" />
4605 </a>
4606 </div>
4607 }
4608 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
46094610 @using System
4611 @using System.Web
4612 @using Dynamicweb.Rapido.Blocks.Extensibility
4613 @using Dynamicweb.Rapido.Blocks
46144615 @functions {
4616 bool isMegaMenu;
4617 }
46184619 @{
4620 isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false;
4621 Block masterDesktopMenu = new Block
4622 {
4623 Id = "MasterDesktopMenu",
4624 SortId = 10,
4625 Template = RenderDesktopMenu(),
4626 Design = new Design
4627 {
4628 Size = "auto",
4629 HidePadding = true,
4630 RenderType = RenderType.Column
4631 }
4632 };
46334634 if (isMegaMenu)
4635 {
4636 masterDesktopMenu.Design.CssClass = "u-reset-position";
4637 }
46384639 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu);
4640 }
46414642 @helper RenderDesktopMenu()
4643 {
4644 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4645 string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : "";
4646 menuAlignment = topLayout == "minimal-center" ? "grid--align-self-center" : topLayout;
4647 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : "";
4648 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");
4649 bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders");
4650 int startLevel = renderPagesInToolBar ? 1 : 0;
46514652 string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink");
46534654 <div class="grid__cell u-align-right u-flex @(isMegaMenu ? "u-reset-position" : "") @menuAlignment">
4655 @if (!isMegaMenu)
4656 {
4657 @RenderNavigation(new
4658 {
4659 id = "topnavigation",
4660 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap",
4661 startLevel = startLevel,
4662 ecomStartLevel = startLevel + 1,
4663 endlevel = 5,
4664 expandmode = "all",
4665 template = "BaseMenuWithDropdown.xslt"
4666 });
4667 }
4668 else
4669 {
4670 @RenderNavigation(new
4671 {
4672 id = "topnavigation",
4673 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap",
4674 startLevel = startLevel,
4675 ecomStartLevel = startLevel + 1,
4676 endlevel = 5,
4677 promotionImage = megamenuPromotionImage,
4678 promotionLink = promotionLink,
4679 expandmode = "all",
4680 showOnlyHeaders = showOnlyHeaders.ToString().ToLower(),
4681 template = "BaseMegaMenu.xslt"
4682 });
4683 }
4684 </div>
4685 }
4686 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
46874688 @using System
4689 @using System.Web
4690 @using Dynamicweb.Rapido.Blocks.Extensibility
4691 @using Dynamicweb.Rapido.Blocks
46924693 @{
4694 Block masterDesktopActionsMenu = new Block
4695 {
4696 Id = "MasterDesktopActionsMenu",
4697 SortId = 10,
4698 Template = RenderDesktopActionsMenu(),
4699 Design = new Design
4700 {
4701 CssClass = "u-flex"
4702 },
4703 SkipRenderBlocksList = true
47044705 };
4706 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu);
47074708 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink")))
4709 {
4710 Block masterDesktopActionsHeaderButton = new Block
4711 {
4712 Id = "MasterDesktopActionsHeaderButton",
4713 SortId = 60,
4714 Template = RenderHeaderButton()
4715 };
4716 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton);
4717 }
4718 }
47194720 @helper RenderDesktopActionsMenu()
4721 {
4722 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList();
47234724 <ul class="menu u-flex dw-mod">
4725 @RenderBlockList(subBlocks)
4726 </ul>
4727 }
47284729 @helper RenderHeaderButton()
4730 {
4731 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText");
4732 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink");
4733 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : "";
47344735 <li class="menu__item menu__item--horizontal menu--clean dw-mod">
4736 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-left" href="@headerButtonLink">@headerButtonText</a>
4737 </li>
4738 }
4739 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
47404741 @using System
4742 @using System.Web
4743 @using Dynamicweb.Core;
4744 @using System.Text.RegularExpressions
4745 @using Dynamicweb.Rapido.Blocks.Extensibility
4746 @using Dynamicweb.Rapido.Blocks
47474748 @{
4749 Block masterDesktopActionsMenuLanguageSelector = new Block
4750 {
4751 Id = "MasterDesktopActionsMenuLanguageSelector",
4752 SortId = 40,
4753 Template = RenderLanguageSelector()
4754 };
47554756 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector);
4757 }
47584759 @helper RenderLanguageSelector()
4760 {
4761 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4762 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
4763 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
4764 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() : "";
47654766 if (Model.Languages.Count > 1)
4767 {
4768 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod">
4769 <div class="@menuLinkClass dw-mod" title="@Translate("Language")">
4770 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i>
4771 </div>
4772 <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell">
4773 @foreach (var lang in Model.Languages)
4774 {
4775 string widthClass = "menu__item--fixed-width";
4776 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name;
4777 string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty);
4778 cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1);
47794780 if (languageViewType == "flag-culture")
4781 {
4782 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span> " + cultureName;
4783 }
47844785 if (languageViewType == "flag")
4786 {
4787 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span>";
4788 widthClass = "";
4789 }
47904791 if (languageViewType == "name")
4792 {
4793 langInfo = lang.Name;
4794 }
47954796 if (languageViewType == "culture")
4797 {
4798 langInfo = cultureName;
4799 widthClass = "";
4800 }
48014802 <div class="menu__item dw-mod @widthClass">
4803 <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__link dw-mod">@langInfo</a>
4804 </div>
4805 }
4806 </div>
4807 </li>
4808 }
4809 }
4810 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
48114812 @using System
4813 @using System.Web
4814 @using Dynamicweb.Rapido.Blocks.Extensibility
4815 @using Dynamicweb.Rapido.Blocks
48164817 @{
4818 Block masterDesktopActionsMenuSignIn = new Block
4819 {
4820 Id = "MasterDesktopActionsMenuSignIn",
4821 SortId = 20,
4822 Template = RenderSignIn()
4823 };
48244825 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuSignIn);
4826 }
48274828 @helper RenderSignIn()
4829 {
4830 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn");
4831 string userInitials = "";
4832 int pageId = Model.TopPage.ID;
4833 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");
4834 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard");
4835 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");
4836 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders");
4837 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");
4838 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards");
4839 int myOrderDraftsPageId = GetPageIdByNavigationTag("OrderDraft");
4840 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4841 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");
4842 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile");
4843 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders");
4844 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards");
4845 bool hideMyOrderDraftsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrderDrafts");
4846 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites");
4847 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink");
48484849 string linkStart = "/Default.aspx?ID=";
4850 if (Model.CurrentUser.ID <= 0)
4851 {
4852 linkStart += signInProfilePageId + "&RedirectPageId=";
4853 }
48544855 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery";
4856 string myProfilePageLink = linkStart + myProfilePageId;
4857 string myOrdersPageLink = linkStart + myOrdersPageId;
4858 string myFavoritesPageLink = linkStart + myFavoritesPageId;
4859 string mySavedCardsPageLink = linkStart + mySavedCardsPageId;
4860 string myOrderDraftsLink = linkStart + myOrderDraftsPageId;
48614862 string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user";
4863 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";
4864 string orderDraftsIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon").SelectedValue : "fa fa-clipboard";
48654866 if (Model.CurrentUser.ID != 0)
4867 {
4868 userInitials = Dynamicweb.Rapido.Services.User.GetInitials(Model.CurrentUser.Name, Model.CurrentUser.FirstName, Model.CurrentUser.LastName, Model.CurrentUser.Email, Model.CurrentUser.UserName);
4869 }
48704871 if (!navigationItemsHideSignIn)
4872 {
4873 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4874 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean";
4875 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
48764877 <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod">
4878 <div class="@menuLinkClass dw-mod">
4879 @if (Model.CurrentUser.ID <= 0)
4880 {
4881 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x" title="@Translate("Sign in")"></i>
4882 }
4883 else
4884 {
4885 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit" title="@Translate("Customer center")"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a>
4886 }
4887 </div>
4888 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod">
4889 <ul class="list list--clean dw-mod">
4890 @if (Model.CurrentUser.ID <= 0)
4891 {
4892 <li>
4893 <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>
4894 </li>
48954896 if (!hideCreateAccountLink)
4897 {
4898 @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account"));
4899 }
4900 if (!hideForgotPasswordLink)
4901 {
4902 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?"))
4903 }
4904 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink)
4905 {
4906 @RenderSeparator()
4907 }
4908 }
4909 @if (!hideMyProfileLink)
4910 {
4911 @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon)
4912 }
4913 @if (!hideMyOrdersLink)
4914 {
4915 @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list")
4916 }
4917 @if (!hideMyFavoritesLink)
4918 {
4919 @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon)
4920 }
4921 @if (!hideMySavedCardsLink)
4922 {
4923 @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card")
4924 }
4925 @if (!hideMyOrderDraftsLink)
4926 {
4927 @RenderListItem(myOrderDraftsLink, Translate("My Order drafts"), orderDraftsIcon)
4928 }
4929 @if (Model.CurrentUser.ID > 0)
4930 {
4931 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink)
4932 {
4933 @RenderSeparator()
4934 }
49354936 //Check if impersonation is on
4937 if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0)
4938 {
4939 <li>
4940 <div class="list__link dw-mod" onclick="document.getElementById('StopImpersonationModalTrigger').checked = true;">
4941 @Translate("Sign out")
4942 </div>
4943 </li>
4944 } else {
4945 @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out"))
4946 }
4947 }
4948 </ul>
4949 </div>
4950 </li>
4951 }
4952 }
49534954 @helper RenderListItem(string link, string text, string icon = null) {
4955 <li>
4956 <a href="@link" class="list__link dw-mod" onclick="RememberState.SetCookie('useAnotherAddress', false)">
4957 @if (!string.IsNullOrEmpty(icon)){<i class="@icon u-margin-right"></i>}@text
4958 </a>
4959 </li>
4960 }
49614962 @helper RenderSeparator()
4963 {
4964 <li class="list__seperator dw-mod"></li>
4965 }
4966 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
49674968 @using System
4969 @using System.Web
4970 @using Dynamicweb.Rapido.Blocks.Extensibility
4971 @using Dynamicweb.Rapido.Blocks
49724973 @{
4974 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites");
49754976 Block masterDesktopActionsMenuFavorites = new Block
4977 {
4978 Id = "MasterDesktopActionsMenuFavorites",
4979 SortId = 30,
4980 Template = RenderFavorites()
4981 };
49824983 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0)
4984 {
4985 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites);
4986 }
4987 }
49884989 @helper RenderFavorites()
4990 {
4991 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");
4992 string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId;
49934994 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4995 string liClasses = topLayout != "normal" && topLayout != "splitted-center" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
4996 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
49974998 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod">
4999 <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod" title="@Translate("Favorites")">
5000 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i>
5001 </a>
5002 </li>
5003 }
5004 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
50055006 @using System
5007 @using System.Web
5008 @using Dynamicweb.Rapido.Blocks.Extensibility
5009 @using Dynamicweb.Rapido.Blocks
5010 @using Dynamicweb.Rapido.Services
50115012 @{
5013 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart");
5014 string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown";
50155016 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !hideCart)
5017 {
5018 Block masterDesktopActionsMenuMiniCart = new Block
5019 {
5020 Id = "MasterDesktopActionsMenuMiniCart",
5021 SortId = 60,
5022 Template = RenderMiniCart(miniCartLayout == "dropdown"),
5023 SkipRenderBlocksList = true,
5024 BlocksList = new List<Block>()
5025 };
50265027 Block miniCartCounterScriptTemplate = new Block
5028 {
5029 Id = "MiniCartCounterScriptTemplate",
5030 Template = RenderMiniCartCounterContent()
5031 };
50325033 //dropdown layout is default
5034 RazorEngine.Templating.TemplateWriter layoutTemplate;
5035 RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate;
50365037 switch (miniCartLayout)
5038 {
5039 case "dropdown":
5040 layoutTemplate = RenderMiniCartDropdownLayout();
5041 miniCartTriggerTemplate = RenderMiniCartTriggerLink();
5042 break;
5043 case "panel":
5044 layoutTemplate = RenderMiniCartPanelLayout();
5045 miniCartTriggerTemplate = RenderMiniCartTriggerLabel();
5046 break;
5047 case "modal":
5048 layoutTemplate = RenderMiniCartModalLayout();
5049 miniCartTriggerTemplate = RenderMiniCartTriggerLabel();
5050 break;
5051 case "none":
5052 default:
5053 layoutTemplate = RenderMiniCartDropdownLayout();
5054 miniCartTriggerTemplate = RenderMiniCartTriggerLink();
5055 break;
5056 }
50575058 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block
5059 {
5060 Id = "MiniCartTrigger",
5061 Template = miniCartTriggerTemplate
5062 });
50635064 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
5065 {
5066 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block
5067 {
5068 Id = "MiniCartLayout",
5069 Template = layoutTemplate
5070 });
5071 }
50725073 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuMiniCart);
5074 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate);
5075 }
50765077 if (hideCart && Dynamicweb.Rapido.Services.User.IsBuyingAllowed())
5078 {
5079 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block {
5080 Id = "CartInitialization"
5081 });
5082 }
5083 }
50845085 @helper RenderMiniCart(bool hasMouseEnterEvent)
5086 {
5087 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterDesktopActionsMenuMiniCart").OrderBy(item => item.SortId).ToList();
5088 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5089 string liClasses = topLayout != "normal" ? "menu__item--top-level" : "menu--clean";
5090 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5091 string mouseEvent = "";
5092 string id = "MiniCart";
5093 if (hasMouseEnterEvent)
5094 {
5095 mouseEvent = "onmouseenter=\"Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=" + miniCartFeedPageId + "&feedType=MiniCart')\"";
5096 id = "miniCartTrigger";
5097 }
5098 <li class="menu__item menu__item--horizontal menu__item--icon @liClasses dw-mod" id="@id" @mouseEvent>
5099 @RenderBlockList(subBlocks)
5100 </li>
5101 }
51025103 @helper RenderMiniCartTriggerLabel()
5104 {
5105 int cartPageId = GetPageIdByNavigationTag("CartPage");
5106 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart";
5107 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5108 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5109 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
51105111 <div class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')" title="@Translate("Cart")">
5112 <div class="u-inline u-position-relative">
5113 <i class="@cartIcon fa-1_5x"></i>
5114 @RenderMiniCartCounter()
5115 </div>
5116 </div>
5117 }
51185119 @helper RenderMiniCartTriggerLink()
5120 {
5121 int cartPageId = GetPageIdByNavigationTag("CartPage");
5122 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart";
5123 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5124 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
51255126 <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button" title="@Translate("Cart")">
5127 <span class="u-inline u-position-relative">
5128 <i class="@cartIcon fa-1_5x"></i>
5129 @RenderMiniCartCounter()
5130 </span>
5131 </a>
5132 }
51335134 @helper RenderMiniCartCounter()
5135 {
5136 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5137 string cartProductsCount = Model.Cart.TotalProductsCount.ToString();
5138 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";
5139 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice");
5140 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : "";
5141 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : "";
51425143 if (showPrice && counterPosition == "right")
5144 {
5145 cartProductsCount = Translate("Cart") + " (" + cartProductsCount + ")";
5146 }
51475148 <span class="mini-cart__counter @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod">
5149 <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">
5150 <span class="js-mini-cart-counter-content" data-count="@Model.Cart.TotalProductsCount.ToString()">
5151 @cartProductsCount @cartProductsTotalPrice
5152 </span>
5153 </span>
5154 </span>
5155 }
51565157 @helper RenderMiniCartCounterContent()
5158 {
5159 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice");
5160 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";
5161 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice;
51625163 <script id="MiniCartCounterContent" type="text/x-template">
5164 {{#.}}
5165 <span class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}">
5166 @if (showPriceInMiniCartCounter)
5167 {
5168 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text>
5169 }
5170 else
5171 {
5172 <text>{{numberofproducts}}</text>
5173 }
5174 </span>
5175 {{/.}}
5176 </script>
5177 }
51785179 @helper RenderMiniCartDropdownLayout()
5180 {
5181 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5182 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");
51835184 <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">
5185 <div class="mini-cart-dropdown__inner dw-mod">
5186 <h3 class="u-ta-center dw-mod">@Translate("Shopping cart")</h3>
5187 <div class="mini-cart-dropdown__body u-flex dw-mod">
5188 <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>
5189 </div>
5190 </div>
5191 </div>
5192 }
51935194 @helper RenderMiniCartPanelLayout()
5195 {
5196 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5197 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");
51985199 <div class="mini-cart grid__cell dw-mod">
5200 <input type="checkbox" id="miniCartTrigger" class="panel-trigger" />
5201 <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">
5202 <label for="miniCartTrigger" class="panel__close-btn" title="@Translate("Close panel")"><i class="fas fa-times"></i></label>
5203 <div class="panel__content u-full-width dw-mod">
5204 <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3>
5205 <div class="panel__content-body panel__content-body--cart dw-mod">
5206 <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>
5207 </div>
5208 </div>
5209 </div>
5210 </div>
5211 }
52125213 @helper RenderMiniCartModalLayout()
5214 {
5215 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5216 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");
52175218 <div class="mini-cart grid__cell dw-mod">
5219 <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" />
5220 <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink">
5221 <label for="miniCartTrigger" class="modal-overlay"></label>
5222 <div class="modal modal--md modal--top-right dw-mod">
5223 <div class="modal__body u-flex grid--direction-column dw-mod">
5224 <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3>
5225 <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>
5226 </div>
5227 <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label>
5228 </div>
5229 </div>
5230 </div>
5231 }
5232 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
52335234 @using System
5235 @using System.Web
5236 @using Dynamicweb.Rapido.Blocks.Extensibility
5237 @using Dynamicweb.Rapido.Blocks
52385239 @{
5240 bool showOrderDraftLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOrderDraftIcon");
52415242 Block masterDesktopActionsMenuOrderDraft = new Block
5243 {
5244 Id = "MasterDesktopActionsMenuOrderDraft",
5245 SortId = 40,
5246 Template = RenderOrderDraft()
5247 };
52485249 if (showOrderDraftLink && Model.CurrentUser.ID > 0)
5250 {
5251 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuOrderDraft);
5252 }
5253 }
52545255 @helper RenderOrderDraft()
5256 {
5257 int OrderDraftPageId = GetPageIdByNavigationTag("OrderDraft");
5258 string OrderDraftPageLink = "/Default.aspx?ID=" + OrderDraftPageId;
5259 string draftIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon").SelectedValue : "fa fa-clipboard";
526052615262 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5263 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
5264 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
52655266 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod">
5267 <a href="@OrderDraftPageLink" class="@menuLinkClass dw-mod" title="@Translate("My order drafts")">
5268 <span class="u-inline u-position-relative">
5269 <i class="@draftIcon fa-1_5x"></i>
5270 </span>
5271 </a>
5272 </li>
5273 }
5274 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
52755276 @using System
5277 @using System.Web
5278 @using Dynamicweb.Rapido.Blocks.Extensibility
5279 @using Dynamicweb.Rapido.Blocks
52805281 @{
5282 bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart");
52835284 Block masterDesktopActionsMenuDownloadCart = new Block
5285 {
5286 Id = "MasterDesktopActionsMenuDownloadCart",
5287 SortId = 50,
5288 Template = RenderDownloadCart()
5289 };
52905291 if (showDownloadCartLink && Model.CurrentUser.ID > 0)
5292 {
5293 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuDownloadCart);
5294 }
5295 }
52965297 @helper RenderDownloadCart()
5298 {
5299 int downloadCartPageId = GetPageIdByNavigationTag("DownloadCart");
5300 string downloadCartPageLink = "/Default.aspx?ID=" + downloadCartPageId;
53015302 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5303 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
5304 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5305 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";
53065307 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod">
5308 <a href="@downloadCartPageLink" class="@menuLinkClass dw-mod" title="@Translate("Download cart")">
5309 <span class="u-inline u-position-relative">
5310 <i class="fas fa-download fa-1_5x"></i>
5311 <span class="mini-cart__counter u-hidden @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod js-download-cart-counter"></span>
5312 </span>
5313 </a>
5314 </li>
5315 }
5316 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
53175318 @using System
5319 @using System.Web
5320 @using Dynamicweb.Rapido.Blocks.Extensibility
5321 @using Dynamicweb.Rapido.Blocks
53225323 @functions {
5324 public class SearchConfiguration
5325 {
5326 public string searchFeedId { get; set; }
5327 public string searchSecondFeedId { get; set; }
5328 public int groupsFeedId { get; set; }
5329 public string resultPageLink { get; set; }
5330 public string searchPlaceholder { get; set; }
5331 public string searchType { get; set; }
5332 public string searchTemplate { get; set; }
5333 public string searchContentTemplate { get; set; }
5334 public string searchValue { get; set; }
5335 public bool showGroups { get; set; }
53365337 public SearchConfiguration()
5338 {
5339 searchFeedId = "";
5340 searchSecondFeedId = "";
5341 searchType = "product-search";
5342 searchContentTemplate = "";
5343 showGroups = true;
5344 }
5345 }
5346 }
5347 @{
5348 Block masterSearchBar = new Block
5349 {
5350 Id = "MasterSearchBar",
5351 SortId = 40,
5352 Template = RenderSearch("bar"),
5353 Design = new Design
5354 {
5355 Size = "auto",
5356 HidePadding = true,
5357 RenderType = RenderType.Column
5358 }
5359 };
53605361 Block masterSearchAction = new Block
5362 {
5363 Id = "MasterDesktopActionsMenuSearch",
5364 SortId = 10,
5365 Template = RenderSearch()
5366 };
53675368 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar);
5369 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction);
5370 }
53715372 @helper RenderSearch(string type = "mini-search")
5373 {
5374 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage"));
5375 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;
5376 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch";
53775378 SearchConfiguration searchConfiguration = null;
53795380 switch (searchType) {
5381 case "contentSearch":
5382 searchConfiguration = new SearchConfiguration() {
5383 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true",
5384 resultPageLink = contentSearchPageLink,
5385 searchPlaceholder = Translate("Search page"),
5386 groupsFeedId = 0,
5387 searchType = "content-search",
5388 searchTemplate = "SearchPagesTemplate",
5389 showGroups = false
5390 };
5391 break;
5392 case "combinedSearch":
5393 searchConfiguration = new SearchConfiguration() {
5394 searchFeedId = productsPageId + "&feed=true",
5395 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true",
5396 resultPageLink = Converter.ToString(productsPageId),
5397 searchPlaceholder = Translate("Search products or pages"),
5398 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"),
5399 searchType = "combined-search",
5400 searchTemplate = "SearchProductsTemplateWrap",
5401 searchContentTemplate = "SearchPagesTemplateWrap",
5402 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector")
5403 };
5404 break;
5405 default: //productSearch
5406 searchConfiguration = new SearchConfiguration() {
5407 resultPageLink = Converter.ToString(productsPageId),
5408 searchFeedId = productsPageId + "&feed=true",
5409 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"),
5410 searchPlaceholder = Translate("Search products"),
5411 searchTemplate = "SearchProductsTemplate",
5412 searchType = "product-search",
5413 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector")
5414 };
5415 break;
5416 }
5417 searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? "";
54185419 if (type == "mini-search") {
5420 @RenderMiniSearch(searchConfiguration)
5421 } else {
5422 @RenderSearchBar(searchConfiguration)
5423 }
5424 }
54255426 @helper RenderSearchBar(SearchConfiguration options)
5427 {
5428 <div class="typeahead typeahead--right u-color-inherit js-typeahead dw-mod" id="ProductSearchBar"
5429 data-page-size="7"
5430 data-search-feed-id="@options.searchFeedId"
5431 data-search-second-feed-id="@options.searchSecondFeedId"
5432 data-result-page-id="@options.resultPageLink"
5433 data-groups-page-id="@options.groupsFeedId"
5434 data-search-type="@options.searchType">
5435 @if (options.showGroups)
5436 {
5437 <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>
5438 <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>
5439 }
5440 <div class="typeahead-search-field">
5441 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue">
5442 @if (string.IsNullOrEmpty(options.searchSecondFeedId))
5443 {
5444 <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>
5445 }
5446 else
5447 {
5448 <div class="dropdown dropdown--absolute-position dropdown--combined grid">
5449 <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>
5450 <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>
5451 </div>
5452 }
5453 </div>
5454 <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>
5455 </div>
5456 }
54575458 @helper RenderMiniSearch(SearchConfiguration options)
5459 {
5460 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5461 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
54625463 <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">
5464 <div class="@menuLinkClass dw-mod" title="@Translate("Search")">
5465 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i>
5466 </div>
5467 <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod">
5468 <div class="typeahead js-typeahead" id="ProductSearchBar"
5469 data-page-size="7"
5470 data-search-feed-id="@options.searchFeedId"
5471 data-search-second-feed-id="@options.searchSecondFeedId"
5472 data-result-page-id="@options.resultPageLink"
5473 data-search-type="@options.searchType">
5474 <div class="typeahead-search-field">
5475 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue">
5476 @if (string.IsNullOrEmpty(options.searchSecondFeedId))
5477 {
5478 <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>
5479 }
5480 else
5481 {
5482 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned">
5483 <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>
5484 <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>
5485 </div>
5486 }
5487 </div>
5488 </div>
5489 </div>
5490 </li>
5491 }
5492 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
54935494 @using System
5495 @using System.Web
5496 @using Dynamicweb.Rapido.Blocks.Extensibility
5497 @using Dynamicweb.Rapido.Blocks
54985499 @{
5500 string headerConfigurationTopLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5501 bool headerConfigurationHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");
55025503 BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master");
55045505 Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo");
5506 headerConfigurationPage.RemoveBlock(configDesktopLogo);
55075508 Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu");
5509 headerConfigurationPage.RemoveBlock(configDesktopMenu);
55105511 Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar");
5512 headerConfigurationPage.RemoveBlock(configSearchBar);
55135514 Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch");
5515 headerConfigurationPage.RemoveBlock(configSearchAction);
55165517 Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu");
5518 headerConfigurationPage.RemoveBlock(configDesktopActionsMenu);
55195520 Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra");
55215522 switch (headerConfigurationTopLayout)
5523 {
5524 case "condensed": //2
5525 configDesktopLogo.Design.Size = "auto-width";
5526 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
55275528 configDesktopMenu.SortId = 20;
5529 configDesktopMenu.Design.Size = "auto";
5530 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
55315532 configDesktopActionsMenu.SortId = 30;
5533 configDesktopActionsMenu.Design.Size = "auto-width";
5534 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
55355536 if (!headerConfigurationHideSearch)
5537 {
5538 configSearchBar.SortId = 40;
5539 configSearchBar.Design.Size = "12";
5540 configDesktopExtra.SortId = 50;
5541 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);
5542 }
5543 break;
5544 case "splitted": //3
5545 configDesktopLogo.Design.Size = "auto";
5546 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
55475548 if (!headerConfigurationHideSearch)
5549 {
5550 configSearchBar.SortId = 20;
5551 configSearchBar.Design.Size = "auto";
5552 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);
5553 }
55545555 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
55565557 configDesktopActionsMenu.SortId = 20;
5558 configDesktopActionsMenu.Design.Size = "auto-width";
5559 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
5560 break;
5561 case "splitted-center": //4
5562 configDesktopLogo.Design.Size = "auto";
5563 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
5564 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
55655566 configDesktopActionsMenu.SortId = 30;
5567 configDesktopActionsMenu.Design.Size = "auto-width";
5568 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu);
55695570 if (!headerConfigurationHideSearch)
5571 {
5572 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
5573 }
5574 break;
5575 case "minimal": //5
5576 configDesktopLogo.Design.Size = "auto-width";
5577 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
55785579 configDesktopMenu.Design.Size = "auto";
5580 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
55815582 configDesktopActionsMenu.SortId = 20;
5583 configDesktopActionsMenu.Design.Size = "auto-width";
5584 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
55855586 if (!headerConfigurationHideSearch)
5587 {
5588 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
5589 }
5590 break;
5591 case "minimal-center": //6
5592 configDesktopLogo.Design.Size = "auto-width";
5593 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
55945595 configDesktopMenu.Design.Size = "auto";
5596 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
55975598 configDesktopActionsMenu.SortId = 20;
5599 configDesktopActionsMenu.Design.Size = "auto-width";
5600 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
56015602 if (!headerConfigurationHideSearch)
5603 {
5604 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
5605 }
5606 break;
5607 case "minimal-right": //7
5608 configDesktopLogo.Design.Size = "auto-width";
5609 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
56105611 configDesktopMenu.Design.Size = "auto";
5612 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
56135614 configDesktopActionsMenu.SortId = 20;
5615 configDesktopActionsMenu.Design.Size = "auto-width";
5616 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
56175618 if (!headerConfigurationHideSearch)
5619 {
5620 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
5621 }
5622 break;
5623 case "two-lines": //8
5624 configDesktopLogo.Design.Size = "auto";
5625 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
56265627 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
56285629 configDesktopActionsMenu.SortId = 20;
5630 configDesktopActionsMenu.Design.Size = "auto-width";
5631 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
56325633 if (!headerConfigurationHideSearch)
5634 {
5635 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
5636 }
5637 break;
5638 case "two-lines-centered": //9
5639 configDesktopLogo.Design.Size = "auto";
5640 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
56415642 configDesktopMenu.Design.Size = "auto-width";
5643 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
56445645 configDesktopActionsMenu.SortId = 20;
5646 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
56475648 if (!headerConfigurationHideSearch)
5649 {
5650 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
5651 }
5652 break;
5653 case "normal": //1
5654 default:
5655 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
56565657 if (!headerConfigurationHideSearch)
5658 {
5659 configSearchBar.SortId = 20;
5660 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);
5661 }
56625663 configDesktopActionsMenu.SortId = 30;
5664 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu);
56655666 configDesktopActionsMenu.Design.Size = "auto-width";
5667 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
5668 break;
5669 }
5670 }
5671 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
56725673 @using System
5674 @using System.Web
5675 @using Dynamicweb.Rapido.Blocks.Extensibility
5676 @using Dynamicweb.Rapido.Blocks
56775678 @{
56795680 }
568156825683 @helper RenderDesktopTools()
5684 {
5685 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList();
56865687 <div class="tools-navigation dw-mod">
5688 <div class="center-container grid top-container__center-container dw-mod">
5689 @RenderBlockList(subBlocks)
5690 </div>
5691 </div>
5692 }
56935694 @helper RenderDesktopToolsText()
5695 {
5696 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText");
5697 if (!string.IsNullOrEmpty(toolsText))
5698 {
5699 <div class="u-margin-top u-margin-bottom">@toolsText</div>
5700 }
5701 }
57025703 @helper RenderDesktopToolsNavigation()
5704 {
5705 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");
57065707 if (renderPagesInToolBar)
5708 {
5709 @RenderNavigation(new
5710 {
5711 id = "topToolsNavigation",
5712 cssclass = "menu menu-tools dw-mod dwnavigation",
5713 template = "TopMenu.xslt"
5714 })
5715 }
5716 }
57175718 @helper RenderDesktopNavigation()
5719 {
5720 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList();
5721 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5722 string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : "";
5723 <nav class="main-navigation dw-mod">
5724 <div class="center-container top-container__center-container grid @alignClass dw-mod">
5725 @RenderBlockList(subBlocks)
5726 </div>
5727 </nav>
5728 }
57295730 @helper RenderDesktopExtra()
5731 {
5732 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList();
57335734 if (subBlocks.Count > 0)
5735 {
5736 <div class="header header-top dw-mod">
5737 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod">
5738 @RenderBlockList(subBlocks)
5739 </div>
5740 </div>
5741 }
5742 }</text>
5743 }
57445745 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
57465747 @using System
5748 @using System.Web
5749 @using Dynamicweb.Rapido.Blocks.Extensibility
5750 @using Dynamicweb.Rapido.Blocks
5751 @using Dynamicweb.Rapido.Blocks.Components.General
5752 @using Dynamicweb.Frontend
57535754 @functions {
5755 int impersonationPageId;
5756 string impersonationLayout;
5757 int impersonationFeed;
5758 Block impersonationBar;
57595760 string getUserNameFromParams(string firstName, string middleName, string lastName, string name, string email, string userName)
5761 {
5762 string username = "";
57635764 if (!string.IsNullOrEmpty(firstName) && !string.IsNullOrEmpty(lastName))
5765 {
5766 username = firstName + " " + (!string.IsNullOrEmpty(middleName) ? middleName + " " : "") + lastName;
5767 }
5768 else if (!string.IsNullOrEmpty(name))
5769 {
5770 username = name;
5771 }
5772 else if (!string.IsNullOrEmpty(email))
5773 {
5774 username = email;
5775 }
5776 else
5777 {
5778 username = userName;
5779 }
5780 return username;
5781 }
57825783 string getUserName(UserViewModel user)
5784 {
5785 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName);
5786 }
57875788 string getUserName(Dynamicweb.Security.UserManagement.User user)
5789 {
5790 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName);
5791 }
5792 }
57935794 @{
5795 impersonationPageId = GetPageIdByNavigationTag("Impersonation");
5796 impersonationLayout = Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout") != null ? Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout").SelectedValue : "bar";
5797 impersonationFeed = GetPageIdByNavigationTag("UsersFeed");
57985799 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0)
5800 {
5801 impersonationBar = new Block
5802 {
5803 Id = "ImpersonationBar",
5804 SortId = 50,
5805 Template = RenderImpersonation(),
5806 SkipRenderBlocksList = true,
5807 Design = new Design
5808 {
5809 Size = "auto-width",
5810 HidePadding = true,
5811 RenderType = RenderType.Column
5812 }
5813 };
58145815 if (impersonationLayout == "top-bar") {
5816 impersonationBar.SortId = 9;
5817 }
58185819 Block impersonationContent = new Block
5820 {
5821 Id = "ImpersonationContent",
5822 SortId = 20
5823 };
58245825 if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0)
5826 {
5827 //Render stop impersonation view
5828 impersonationContent.Template = RenderStopImpersonationView();
582958305831 Modal stopImpersonation = new Modal
5832 {
5833 Id = "StopImpersonation",
5834 Heading = new Heading {
5835 Level = 2,
5836 Title = Translate("Sign out"),
5837 Icon = new Icon {
5838 Name = "fa-sign-out",
5839 Prefix = "fas",
5840 LabelPosition = IconLabelPosition.After
5841 }
5842 },
5843 Width = ModalWidth.Sm,
5844 BodyTemplate = RenderStopImpersonationForm()
5845 };
58465847 Block stopImpersonationBlock = new Block
5848 {
5849 Id = "StopImpersonationBlock",
5850 SortId = 10,
5851 Component = stopImpersonation
5852 };
5853 impersonationBar.BlocksList.Add(stopImpersonationBlock);
5854 }
5855 else
5856 {
5857 //Render main view
5858 switch (impersonationLayout)
5859 {
5860 case "right-lower-box":
5861 impersonationContent.BlocksList.Add(
5862 new Block {
5863 Id = "RightLowerBoxHeader",
5864 SortId = 10,
5865 Component = new Heading {
5866 Level = 5,
5867 Title = Translate("View the list of users you can sign in as"),
5868 CssClass = "impersonation-text"
5869 }
5870 }
5871 );
5872 impersonationContent.BlocksList.Add(
5873 new Block {
5874 Id = "RightLowerBoxContent",
5875 SortId = 20,
5876 Template = RenderImpersonationControls()
5877 }
5878 );
5879 break;
5880 case "right-lower-bar":
5881 impersonationContent.BlocksList.Add(
5882 new Block {
5883 Id = "RightLowerBarContent",
5884 SortId = 10,
5885 Template = RenderImpersonationControls()
5886 }
5887 );
5888 break;
5889 case "bar":
5890 default:
5891 impersonationContent.BlocksList.Add(
5892 new Block {
5893 Id = "ViewListLink",
5894 SortId = 20,
5895 Template = RenderViewListLink()
5896 }
5897 );
5898 impersonationContent.BlocksList.Add(
5899 new Block {
5900 Id = "BarTypeaheadSearch",
5901 SortId = 30,
5902 Template = RenderTypeaheadSearch()
5903 }
5904 );
5905 break;
5906 }
5907 }
5908 impersonationBar.BlocksList.Add(impersonationContent);
59095910 impersonationBar.BlocksList.Add(
5911 new Block
5912 {
5913 Id = "ImpersonationSearchTemplates",
5914 SortId = 30,
5915 Template = RenderSearchResultTemplate()
5916 }
5917 );
5918 if (impersonationLayout != "bar" && impersonationLayout != "top-bar")
5919 {
5920 impersonationBar.BlocksList.Add(
5921 new Block
5922 {
5923 Id = "ImpersonationSearchScripts",
5924 SortId = 40,
5925 Template = RenderSearchScripts()
5926 }
5927 );
5928 }
5929 BlocksPage.GetBlockPage("Master").Add("MasterHeader", impersonationBar);
5930 }
5931 }
59325933 @helper RenderImpersonation()
5934 {
5935 List<Block> subBlocks = impersonationBar.BlocksList.OrderBy(item => item.SortId).ToList();
5936 <input type="checkbox" class="impersonation-trigger js-remember-state" id="ImpersonationMinimizeTrigger" />
5937 <div class="impersonation impersonation--@(impersonationLayout)-layout dw-mod" id="Impersonation">
5938 @if (impersonationLayout == "right-lower-box")
5939 {
5940 @RenderRightLowerBoxHeader()
5941 }
5942 <div class="center-container top-container__center-container impersonation__container @(impersonationLayout != "bar" && impersonationLayout != "top-bar" ? "impersonation__container--box" : "") dw-mod">
5943 @*Impersonation*@
5944 @RenderBlockList(subBlocks)
5945 </div>
5946 </div>
5947 }
59485949 @helper RenderRightLowerBoxHeader()
5950 {
5951 <div class="impersonation__header dw-mod">
5952 <div class="impersonation__title">@Translate("Impersonation")</div>
5953 <label for="ImpersonationMinimizeTrigger" class="btn btn--impersonation impersonation__minimize-btn dw-mod" onclick="this.blur();">
5954 @Render(new Icon
5955 {
5956 Prefix = "fas",
5957 Name = "fa-window-minimize"
5958 })
5959 </label>
5960 </div>
5961 }
59625963 @helper RenderStopImpersonationView()
5964 {
5965 string secondaryUserName = getUserName(Model.CurrentSecondaryUser);
5966 string userName = getUserName(Pageview.User);
5967 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> ";
5968 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;
59695970 if (impersonationLayout == "right-lower-box")
5971 {
5972 <div class="u-margin-bottom--lg u-ta-center">
5973 @impersonationText
5974 </div>
5975 <div class="u-margin-bottom--lg u-ta-center">
5976 @RenderSwitchAccountButton()
5977 </div>
5978 @RenderStopImpersonationButton()
5979 }
5980 else
5981 {
5982 <div class="grid grid--align-center impersonation__stop-wrap">
5983 <div class="impersonation-bar-item dw-mod">
5984 @impersonationText
5985 </div>
5986 <div class="impersonation-bar-item dw-mod">
5987 @RenderSwitchAccountButton()
5988 </div>
5989 <div class="impersonation-bar-item dw-mod">
5990 @RenderStopImpersonationButton()
5991 </div>
5992 </div>
5993 }
5994 }
59955996 @helper RenderSwitchAccountButton() {
5997 @Render(new Button
5998 {
5999 Href = "/Default.aspx?ID=" + impersonationPageId,
6000 ButtonType = ButtonType.Button,
6001 ButtonLayout = ButtonLayout.Clean,
6002 Title = Translate("Switch account"),
6003 Icon = new Icon {
6004 Name = "fa-users",
6005 Prefix = "fal",
6006 LabelPosition = IconLabelPosition.After
6007 },
6008 CssClass = "u-no-margin u-color-inherit"
6009 })
6010 }
60116012 @helper RenderStopImpersonationForm()
6013 {
6014 string secondaryUserName = getUserName(Model.CurrentSecondaryUser);
6015 string userName = getUserName(Pageview.User);
6016 int pageId = Model.TopPage.ID;
60176018 <form method="post" class="u-no-margin">
6019 @Render(new Button
6020 {
6021 ButtonType = ButtonType.Submit,
6022 ButtonLayout = ButtonLayout.Secondary,
6023 Title = Translate("Sign out as") + " " + userName,
6024 Href = "/Default.aspx?ID=" + impersonationPageId,
6025 CssClass = "btn--full",
6026 Name = "DwExtranetRemoveSecondaryUser"
6027 })
60286029 @Render(new Button
6030 {
6031 ButtonType = ButtonType.Submit,
6032 ButtonLayout = ButtonLayout.Secondary,
6033 Title = Translate("Sign out as") + " " + secondaryUserName,
6034 Href = "/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId,
6035 CssClass = "btn--full",
6036 Name = "DwExtranetRemoveSecondaryUser"
6037 })
6038 </form>
6039 }
60406041 @helper RenderStopImpersonationButton() {
6042 @Render(new Button
6043 {
6044 ButtonType = ButtonType.Button,
6045 ButtonLayout = ButtonLayout.Clean,
6046 Title = Translate("Sign out"),
6047 Icon = new Icon {
6048 Name = "fa-sign-out",
6049 Prefix = "fal",
6050 LabelPosition = IconLabelPosition.After
6051 },
6052 OnClick = "document.getElementById('StopImpersonationModalTrigger').checked = true",
6053 CssClass = "u-no-margin"
6054 })
6055 }
60566057 @helper RenderImpersonationControls()
6058 {
6059 <div class="impersonation__controls">
6060 @RenderViewListLink()
6061 @RenderSearchBox()
6062 </div>
6063 @RenderResultsList()
6064 }
60656066 @helper RenderViewListLink()
6067 {
6068 string title = impersonationLayout == "right-lower-box" ? Translate("View the list") : Translate("View the list of users you can sign in as");
6069 string buttonClasses = impersonationLayout == "right-lower-box" ? "impersonation__button btn btn--impersonation" : "impersonation__link impersonation__link";
60706071 @Render(new Link {
6072 ButtonLayout = ButtonLayout.None,
6073 Title = title,
6074 Href = "/Default.aspx?ID=" + impersonationPageId,
6075 CssClass = buttonClasses
6076 })
6077 }
60786079 @helper RenderSearchBox()
6080 {
6081 <div class="impersonation__search-wrap">
6082 <input placeholder="@Translate("Search users")" type="text" class="impersonation__search-field dw-mod" onkeyup="searchKeyUpHandler(event)" id="ImpersonationBoxSearchField">
6083 <div id="ImpersonationBoxSearchFind" class="impersonation__search-icon dw-mod" onclick="updateResults(document.getElementById('ImpersonationBoxSearchField').value)">
6084 <i class="fal fa-search"></i>
6085 </div>
6086 <div id="ImpersonationBoxSearchClear" class="impersonation__search-icon u-hidden dw-mod" onclick="clearResults();">
6087 <i class="fal fa-times"></i>
6088 </div>
6089 </div>
6090 }
60916092 @helper RenderTypeaheadSearch()
6093 {
6094 <div class="typeahead u-ta-right impersonation__typeahead js-typeahead dw-mod" id="ImpersonationSearchBar"
6095 data-page-size="5"
6096 data-search-feed-id="@impersonationFeed"
6097 data-result-page-id="@impersonationPageId"
6098 data-search-type="user-search"
6099 data-search-parameter-name="q">
61006101 <div class="typeahead-search-field">
6102 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" placeholder="@Translate("Search users")">
6103 <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>
6104 </div>
6105 </div>
6106 }
61076108 @helper RenderResultsList()
6109 {
6110 <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>
6111 }
61126113 @helper RenderSearchResultTemplate()
6114 {
6115 <script id="ImpersonationSearchResult" type="text/x-template">
6116 {{#.}}
6117 {{#Users}}
6118 <li class="impersonation__search-results-item impersonation-user">
6119 <form method="post" class="impersonation-user__form" name="account{{id}}">
6120 <input type="hidden" id="DWExtranetSecondaryUserSelector" name="DWExtranetSecondaryUserSelector" value="{{id}}">
6121 <div class="impersonation-user__info">
6122 <div class="impersonation-user__name">{{userName}}</div>
6123 <div class="impersonation-user__number">{{customerNumber}}</div>
6124 </div>
6125 @Render(new Button
6126 {
6127 ButtonType = ButtonType.Submit,
6128 ButtonLayout = ButtonLayout.Secondary,
6129 Title = Translate("Sign in as"),
6130 CssClass = "impersonation-user__sign-in-btn" + (impersonationLayout != "bar" ? " btn--impersonation" : "")
6131 })
6132 </form>
6133 </li>
6134 {{/Users}}
6135 {{#unless Users}}
6136 <li class="impersonation__search-results-item impersonation__search-results-item--not-found">
6137 @Translate("Your search gave 0 results")
6138 </li>
6139 {{/unless}}
6140 {{/.}}
6141 </script>
6142 }
61436144 @helper RenderSearchScripts()
6145 {
6146 <script>
6147 let inputDelayTimer;
6148 function searchKeyUpHandler(e) {
6149 clearTimeout(inputDelayTimer);
6150 let value = e.target.value;
6151 if (value != "") {
6152 inputDelayTimer = setTimeout(function () {
6153 updateResults(value);
6154 }, 500);
6155 } else {
6156 clearResults();
6157 }
6158 };
61596160 function updateResults(value) {
6161 if (value == "") {
6162 return null;
6163 }
6164 HandlebarsBolt.UpdateContent("ImpersonationBoxSearchResults", "/Default.aspx?ID=@impersonationFeed&q=" + value);
6165 document.getElementById("ImpersonationBoxSearchFind").classList.add("u-hidden");
6166 document.getElementById("ImpersonationBoxSearchClear").classList.remove("u-hidden");
6167 }
61686169 function clearResults() {
6170 document.getElementById("ImpersonationBoxSearchField").value = "";
6171 HandlebarsBolt.CleanContainer("ImpersonationBoxSearchResults");
6172 document.getElementById("ImpersonationBoxSearchFind").classList.remove("u-hidden");
6173 document.getElementById("ImpersonationBoxSearchClear").classList.add("u-hidden");
6174 }
6175 </script>
6176 }
6177 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
61786179 @using System
6180 @using System.Web
6181 @using System.Collections.Generic
6182 @using Dynamicweb.Rapido.Blocks.Extensibility
6183 @using Dynamicweb.Rapido.Blocks
61846185 @{
6186 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master");
6187 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table";
61886189 Block orderLines = new Block
6190 {
6191 Id = "MiniCartOrderLines",
6192 SkipRenderBlocksList = true,
6193 BlocksList = new List<Block>
6194 {
6195 new Block {
6196 Id = "MiniCartOrderLinesList",
6197 SortId = 20,
6198 Template = RenderMiniCartOrderLinesList()
6199 }
6200 }
6201 };
62026203 Block orderlinesScriptTemplates = new Block
6204 {
6205 Id = "OrderlinesScriptTemplates"
6206 };
62076208 if (orderlinesView == "table")
6209 {
6210 orderLines.Template = RenderMiniCartOrderLinesTable();
6211 orderLines.BlocksList.Add(
6212 new Block
6213 {
6214 Id = "MiniCartOrderlinesTableHeader",
6215 SortId = 10,
6216 Template = RenderMiniCartOrderLinesHeader()
6217 }
6218 );
62196220 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates();
6221 }
6222 else
6223 {
6224 orderLines.Template = RenderMiniCartOrderLinesBlocks();
6225 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates();
6226 }
62276228 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates);
62296230 Block miniCartScriptTemplates = new Block()
6231 {
6232 Id = "MasterMiniCartTemplates",
6233 SortId = 1,
6234 Template = RenderMiniCartScriptTemplates(),
6235 SkipRenderBlocksList = true,
6236 BlocksList = new List<Block>
6237 {
6238 orderLines,
6239 new Block {
6240 Id = "MiniCartFooter",
6241 Template = RenderMiniCartFooter(),
6242 SortId = 50,
6243 SkipRenderBlocksList = true,
6244 BlocksList = new List<Block>
6245 {
6246 new Block {
6247 Id = "MiniCartSubTotal",
6248 Template = RenderMiniCartSubTotal(),
6249 SortId = 30
6250 },
6251 new Block {
6252 Id = "MiniCartFees",
6253 Template = RenderMiniCartFees(),
6254 SortId = 40
6255 },
6256 new Block {
6257 Id = "MiniCartPoints",
6258 Template = RenderMiniCartPoints(),
6259 SortId = 50
6260 },
6261 new Block {
6262 Id = "MiniCartTotal",
6263 Template = RenderMiniCartTotal(),
6264 SortId = 60
6265 },
6266 new Block {
6267 Id = "MiniCartDisclaimer",
6268 Template = RenderMiniCartDisclaimer(),
6269 SortId = 70
6270 },
6271 new Block {
6272 Id = "MiniCartActions",
6273 Template = RenderMiniCartActions(),
6274 SortId = 80
6275 }
6276 }
6277 }
6278 }
6279 };
62806281 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates);
6282 }
62836284 @helper RenderMiniCartScriptsTableTemplates()
6285 {
6286 <script id="MiniCartOrderline" type="text/x-template">
6287 {{#unless isEmpty}}
6288 <tr>
6289 <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>
6290 <td class="u-va-middle">
6291 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a>
6292 {{#if variantname}}
6293 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a>
6294 {{/if}}
6295 {{#if unitname}}
6296 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div>
6297 {{/if}}
6298 </td>
6299 <td class="u-ta-right u-va-middle">{{quantity}}</td>
6300 <td class="u-ta-right u-va-middle">
6301 {{#if pointsTotal}}
6302 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points")
6303 {{else}}
6304 {{totalprice}}
6305 {{/if}}
6306 </td>
6307 </tr>
6308 {{/unless}}
6309 </script>
63106311 <script id="MiniCartOrderlineDiscount" type="text/x-template">
6312 {{#unless isEmpty}}
6313 <tr class="table__row--no-border">
6314 <td class="u-w60px"> </td>
6315 <td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td>
6316 <td class="u-ta-right"> </td>
6317 <td class="u-ta-right">{{totalprice}}</td>
6318 </tr>
6319 {{/unless}}
6320 </script>
6321 }
63226323 @helper RenderMiniCartScriptsListTemplates()
6324 {
6325 int cartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
63266327 <script id="MiniCartOrderline" type="text/x-template">
6328 {{#unless isEmpty}}
6329 <div class="mini-cart-orderline grid dw-mod">
6330 <div class="grid__col-4">
6331 <a href="{{link}}" class="{{hideimage}}">
6332 <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}}">
6333 </a>
6334 </div>
6335 <div class="grid__col-8">
6336 <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>
6337 {{#if variantname}}
6338 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div>
6339 {{/if}}
6340 {{#if unitname}}
6341 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div>
6342 {{/if}}
6343 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div>
63446345 <div class="grid__cell-footer">
6346 <div class="grid__cell">
6347 <div class="u-pull--left mini-cart-orderline__price dw-mod">
6348 {{#if pointsTotal}}
6349 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points")
6350 {{else}}
6351 {{totalprice}}
6352 {{/if}}
6353 </div>
6354 <button type="button"
6355 title="@Translate("Remove orderline")"
6356 class="btn btn--clean btn--condensed u-pull--right mini-cart-orderline__remove-btn dw-mod"
6357 onclick="{{#if googleImpression}}googleImpressionRemoveFromCart({{googleImpression}});{{/if}}Cart.UpdateCart('miniCartContent', '/Default.aspx?ID=@cartFeedPageId', 'CartCmd=DelOrderLine&key={{orderLineId}}&redirect=false', true);">@Translate("Remove")</button>
6358 </div>
6359 </div>
6360 </div>
6361 </div>
6362 {{/unless}}
6363 </script>
63646365 <script id="MiniCartOrderlineDiscount" type="text/x-template">
6366 {{#unless isEmpty}}
6367 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod">
6368 <div class="grid__col-4">
6369 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div>
6370 </div>
6371 <div class="grid__col-8">{{totalprice}}</div>
6372 </div>
6373 {{/unless}}
6374 </script>
6375 }
63766377 @helper RenderMiniCartScriptTemplates()
6378 {
6379 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList();
6380 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));
6381 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage"));
6382 bool miniCartUseGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));
63836384 <script id="MiniCartContent" type="text/x-template">
6385 {{#.}}
6386 {{#unless isEmpty}}
6387 @if (miniCartUseGoogleTagManager)
6388 {
6389 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text>
6390 }
6391 @RenderBlockList(subBlocks)
6392 {{/unless}}
6393 {{/.}}
6394 </script>
6395 }
63966397 @helper RenderMiniCartOrderLinesTable()
6398 {
6399 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList();
64006401 <div class="u-overflow-auto">
6402 <table class="table mini-cart-table dw-mod">
6403 @RenderBlockList(subBlocks)
6404 </table>
6405 </div>
6406 }
64076408 @helper RenderMiniCartOrderLinesBlocks()
6409 {
6410 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList();
64116412 <div class="u-overflow-auto">
6413 @RenderBlockList(subBlocks)
6414 </div>
6415 }
64166417 @helper RenderMiniCartOrderLinesHeader()
6418 {
6419 <thead>
6420 <tr>
6421 <td> </td>
6422 <td>@Translate("Product")</td>
6423 <td class="u-ta-right">@Translate("Qty")</td>
6424 <td class="u-ta-right" width="120">@Translate("Price")</td>
6425 </tr>
6426 </thead>
6427 }
64286429 @helper RenderMiniCartOrderLinesList()
6430 {
6431 <text>
6432 {{#OrderLines}}
6433 {{#ifCond template "===" "CartOrderline"}}
6434 {{>MiniCartOrderline}}
6435 {{/ifCond}}
6436 {{#ifCond template "===" "CartOrderlineMobile"}}
6437 {{>MiniCartOrderline}}
6438 {{/ifCond}}
6439 {{#ifCond template "===" "CartOrderlineDiscount"}}
6440 {{>MiniCartOrderlineDiscount}}
6441 {{/ifCond}}
6442 {{/OrderLines}}
6443 </text>
6444 }
64456446 @helper RenderMiniCartFees()
6447 {
6448 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
6449 if (!pointShop)
6450 {
6451 <text>
6452 {{#unless hidePaymentfee}}
6453 <div class="grid">
6454 <div class="grid__col-6 grid__col--bleed-y">
6455 {{paymentmethod}}
6456 </div>
6457 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{paymentfee}}</div>
6458 </div>
6459 {{/unless}}
6460 </text>
6461 }
6462 <text>
6463 {{#unless hideShippingfee}}
6464 <div class="grid">
6465 <div class="grid__col-6 grid__col--bleed-y">
6466 {{shippingmethod}}
6467 </div>
6468 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{shippingfee}}</div>
6469 </div>
6470 {{/unless}}
6471 </text>
6472 <text>
6473 {{#if hasTaxSettings}}
6474 <div class="grid">
6475 <div class="grid__col-6 grid__col--bleed-y">@Translate("Sales Tax")</div>
6476 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{totaltaxes}}</div>
6477 </div>
6478 {{/if}}
6479 </text>
6480 }
64816482 @helper RenderMiniCartFooter()
6483 {
6484 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList();
64856486 <div class="mini-cart__footer u-border-top u-padding-top dw-mod">
6487 @RenderBlockList(subBlocks)
6488 </div>
6489 }
64906491 @helper RenderMiniCartActions()
6492 {
6493 int cartPageId = GetPageIdByNavigationTag("CartPage");
64946495 <button type="button" title="@Translate("Empty cart")" class="btn btn--secondary u-full-width dw-mod u-no-margin u-margin-bottom" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event);">@Translate("Empty cart")</button>
6496 <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>
6497 }
64986499 @helper RenderMiniCartPoints()
6500 {
6501 <text>
6502 {{#if earnings}}
6503 <div class="grid">
6504 <div class="grid__col-6 grid__col--bleed-y">@Translate("Earnings")</div>
6505 <div class="grid__col-6 grid__col--bleed-y grid--align-end">
6506 <div>
6507 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points")
6508 </div>
6509 </div>
6510 </div>
6511 {{/if}}
6512 </text>
6513 }
65146515 @helper RenderMiniCartSubTotal()
6516 {
6517 bool hasTaxSettings = Dynamicweb.Rapido.Services.Countries.HasTaxSettings(Model.Cart.ID);
6518 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
6519 if (!pointShop)
6520 {
6521 <text>
6522 {{#unless hideSubTotal}}
6523 <div class="grid dw-mod u-bold">
6524 <div class="grid__col-6 grid__col--bleed-y">@Translate("Subtotal")</div>
6525 <div class="grid__col-6 grid__col--bleed-y grid--align-end">
6526 @if (hasTaxSettings)
6527 {
6528 <text>{{subtotalpricewithouttaxes}}</text>
6529 }
6530 else
6531 {
6532 <text>{{subtotalprice}}</text>
6533 }
6534 </div>
6535 </div>
6536 {{/unless}}
6537 </text>
6538 }
6539 }
65406541 @helper RenderMiniCartTotal()
6542 {
6543 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
65446545 <div class="mini-cart-totals grid u-border-top u-margin-top dw-mod">
6546 <div class="grid__col-6">@Translate("Total")</div>
6547 <div class="grid__col-6 grid--align-end">
6548 <div>
6549 @if (pointShop)
6550 {
6551 <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points")
6552 }
6553 else
6554 {
6555 <text>{{totalprice}}</text>
6556 }
6557 </div>
6558 </div>
6559 </div>
6560 }
65616562 @helper RenderMiniCartDisclaimer()
6563 {
6564 <text>
6565 {{#if showCheckoutDisclaimer}}
6566 <div class="grid u-margin-bottom u-ta-right">
6567 <small class="grid__col-12">{{checkoutDisclaimer}}</small>
6568 </div>
6569 {{/if}}
6570 </text>
6571 }
6572 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
65736574 @using Dynamicweb.Rapido.Blocks.Extensibility
6575 @using Dynamicweb.Rapido.Blocks
6576 @using Dynamicweb.Rapido.Blocks.Components.General
6577 @using Dynamicweb.Rapido.Blocks.Components
6578 @using Dynamicweb.Rapido.Services
65796580 @{
6581 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : "";
6582 string addToCartNotificationMiniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown";
6583 bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart");
65846585 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !string.IsNullOrEmpty(addToCartNotificationType))
6586 {
6587 if (addToCartNotificationType == "modal")
6588 {
6589 Block addToCartNotificationModal = new Block
6590 {
6591 Id = "AddToCartNotificationModal",
6592 Template = RenderAddToCartNotificationModal()
6593 };
65946595 Block addToCartNotificationScript = new Block
6596 {
6597 Id = "AddToCartNotificationScript",
6598 Template = RenderAddToCartNotificationModalScript()
6599 };
6600 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal);
6601 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript);
6602 }
6603 else if (addToCartNotificationType == "toggle" && addToCartNotificationMiniCartLayout != "none" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
6604 {
6605 Block addToCartNotificationScript = new Block
6606 {
6607 Id = "AddToCartNotificationScript",
6608 Template = RenderAddToCartNotificationToggleScript()
6609 };
6610 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript);
6611 }
6612 }
6613 }
66146615 @helper RenderAddToCartNotificationModal()
6616 {
6617 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div>
6618 }
66196620 @helper RenderAddToCartNotificationModalScript()
6621 {
6622 int cartPageId = GetPageIdByNavigationTag("DownloadCart");
66236624 <script id="LastAddedProductTemplate" type="text/x-template">
6625 @{
66266627 Modal lastAddedProduct = new Modal
6628 {
6629 Id = "LastAddedProduct",
6630 Heading = new Heading
6631 {
6632 Level = 2,
6633 Title = Translate("Product is added to the cart")
6634 },
6635 Width = ModalWidth.Md,
6636 BodyTemplate = RenderModalContent()
6637 };
66386639 lastAddedProduct.AddActions(
6640 new Button
6641 {
6642 ButtonType = ButtonType.Button,
6643 ButtonLayout = ButtonLayout.Secondary,
6644 Title = Translate("Continue shopping"),
6645 CssClass = "u-pull--left u-no-margin btn--sm",
6646 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false"
6647 },
6648 new Link
6649 {
6650 Href = "/Default.aspx?ID=" + cartPageId,
6651 ButtonLayout = ButtonLayout.Secondary,
6652 CssClass = "u-pull--right u-no-margin btn--sm",
6653 Title = Translate("Proceed to checkout"),
6654 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false"
6655 }
6656 );
66576658 @Render(lastAddedProduct)
6659 }
6660 </script>
6661 <script>
6662 document.addEventListener('addToCart', function (event) {
6663 Cart.ShowLastAddedProductModal(event.detail);
6664 });
6665 </script>
6666 }
66676668 @helper RenderModalContent()
6669 {
6670 <div class="grid">
6671 <div class="grid__col-2">
6672 @Render(new Image { Path = "{{ productInfo.image }}", Link = "{{ productInfo.link }}", Title = "{{ productInfo.name }}", DisableImageEngine = true })
6673 </div>
6674 <div class="u-padding grid--align-self-center">
6675 <span>{{quantity}}</span> x
6676 </div>
6677 <div class="grid__col-auto grid--align-self-center">
6678 <div>{{productInfo.name}}</div>
6679 {{#if productInfo.variantName}}
6680 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small>
6681 {{/if}}
6682 {{#if productInfo.unitName}}
6683 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small>
6684 {{/if}}
6685 </div>
6686 </div>
6687 }
66886689 @helper RenderAddToCartNotificationToggleScript()
6690 {
6691 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
66926693 <script>
6694 document.addEventListener('addToCart', function () {
6695 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId');
6696 });
6697 </script>
6698 }
6699 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
67006701 @using System
6702 @using System.Web
6703 @using System.Collections.Generic
6704 @using Dynamicweb.Rapido.Blocks.Extensibility
6705 @using Dynamicweb.Rapido.Blocks
6706 @using Dynamicweb.Rapido.Blocks.Components.General
67076708 @functions {
6709 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master");
6710 }
67116712 @{
6713 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content");
6714 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content");
6715 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content");
6716 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header");
6717 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header");
6718 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header");
67196720 Block masterFooterContent = new Block()
6721 {
6722 Id = "MasterFooterContent",
6723 SortId = 10,
6724 Template = RenderFooter(),
6725 SkipRenderBlocksList = true
6726 };
6727 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent);
67286729 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader))
6730 {
6731 Block masterFooterColumnOne = new Block
6732 {
6733 Id = "MasterFooterColumnOne",
6734 SortId = 10,
6735 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent),
6736 Design = new Design
6737 {
6738 Size = "auto",
6739 RenderType = RenderType.Column
6740 }
6741 };
6742 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne);
6743 }
67446745 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader))
6746 {
6747 Block masterFooterColumnTwo = new Block
6748 {
6749 Id = "MasterFooterColumnTwo",
6750 SortId = 20,
6751 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent),
6752 Design = new Design
6753 {
6754 Size = "auto",
6755 RenderType = RenderType.Column
6756 }
6757 };
6758 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo);
6759 }
67606761 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader))
6762 {
6763 Block masterFooterColumnThree = new Block
6764 {
6765 Id = "MasterFooterColumnThree",
6766 SortId = 30,
6767 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent),
6768 Design = new Design
6769 {
6770 Size = "auto",
6771 RenderType = RenderType.Column
6772 }
6773 };
6774 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree);
6775 }
67766777 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp"))
6778 {
6779 Block masterFooterNewsletterSignUp = new Block
6780 {
6781 Id = "MasterFooterNewsletterSignUp",
6782 SortId = 40,
6783 Template = RenderFooterNewsletterSignUp(),
6784 Design = new Design
6785 {
6786 Size = "auto",
6787 RenderType = RenderType.Column
6788 }
6789 };
6790 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp);
6791 }
67926793 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0)
6794 {
6795 Block masterFooterSocialLinks = new Block
6796 {
6797 Id = "MasterFooterSocialLinks",
6798 SortId = 50,
6799 Template = RenderFooterSocialLinks(),
6800 Design = new Design
6801 {
6802 Size = "auto",
6803 RenderType = RenderType.Column
6804 }
6805 };
6806 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks);
6807 }
68086809 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0)
6810 {
6811 Block masterFooterPayments = new Block
6812 {
6813 Id = "MasterFooterPayments",
6814 SortId = 60,
6815 Template = RenderFooterPayments(),
6816 Design = new Design
6817 {
6818 Size = "12",
6819 RenderType = RenderType.Column
6820 }
6821 };
6822 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments);
6823 }
68246825 Block masterFooterCopyright = new Block
6826 {
6827 Id = "MasterFooterCopyright",
6828 SortId = 70,
6829 Template = RenderFooterCopyright(),
6830 Design = new Design
6831 {
6832 Size = "12",
6833 RenderType = RenderType.Column
6834 }
6835 };
6836 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright);
6837 }
68386839 @helper RenderFooter()
6840 {
6841 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList();
68426843 <footer class="footer no-print dw-mod">
6844 <div class="center-container top-container__center-container dw-mod">
6845 <div class="grid grid--external-bleed-x">
6846 @RenderBlockList(subBlocks)
6847 </div>
6848 </div>
6849 </footer>
6850 }
68516852 @helper RenderFooterColumn(string header, string content)
6853 {
6854 <h3 class="footer__heading dw-mod">@header</h3>
6855 <div class="footer__content dw-mod">
6856 @content
6857 </div>
6858 }
68596860 @helper RenderFooterNewsletterSignUp()
6861 {
6862 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString();
6863 Form form = new Form { Action = "/Default.aspx", Method = FormMethod.Get, Enctype = FormEnctype.multipart };
68646865 form.Add(new HiddenField { Name = "ID", Value = newsletterSignUpPageId });
6866 form.Add(new Text { Content = "<p>" + Translate("Sign up if you would like to receive occasional treats from us") + "</p>" });
6867 form.Add(new TextField {
6868 Id = "NewsletterEmail", Name = "NewsletterEmail", Placeholder = Translate("Your email address"),
6869 Type = TextFieldType.Email,
6870 ActionButton = new Button {
6871 ButtonType = ButtonType.Submit, Id="Submitter", Title = Translate("Go"), OnClick = "Buttons.LockButton(event)", CssClass = "btn--condensed"
6872 }
6873 });
68746875 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3>
6876 <div class="footer__content dw-mod">
6877 @Render(form)
6878 </div>
6879 }
68806881 @helper RenderFooterSocialLinks()
6882 {
6883 <h3 class="footer__heading dw-mod">@Translate("Social links")</h3>
6884 <div class="footer__content dw-mod">
6885 <div class="collection dw-mod">
6886 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks"))
6887 {
6888 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel;
6889 string socialIconClass = socialIcon.SelectedValue;
6890 string socialIconTitle = socialIcon.SelectedName;
6891 string socialLink = socialitem.GetString("Link");
68926893 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a>
6894 }
6895 </div>
6896 </div>
6897 }
68986899 @helper RenderFooterPayments()
6900 {
6901 <div class="footer__content dw-mod">
6902 <div class="collection dw-mod">
6903 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments"))
6904 {
6905 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel;
6906 string paymentImage = null;
6907 string paymentTitle = paymentItem.SelectedName;
6908 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault();
6909 if (selected != null)
6910 {
6911 paymentImage = selected.Icon;
6912 }
69136914 <div class="footer__card-type">
6915 <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" />
6916 </div>
6917 }
6918 </div>
6919 </div>
6920 }
69216922 @helper RenderFooterCopyright()
6923 {
6924 <div class="grid__col-12 footer__copyright dw-mod">
6925 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p>
6926 </div>
6927 }
6928 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
69296930 @using System
6931 @using System.Web
6932 @using System.Collections.Generic
6933 @using Dynamicweb.Rapido.Blocks.Extensibility
6934 @using Dynamicweb.Rapido.Blocks
6935 @using Dynamicweb.Ecommerce.Common
69366937 @{
6938 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master");
69396940 Block masterScriptReferences = new Block()
6941 {
6942 Id = "MasterScriptReferences",
6943 SortId = 1,
6944 Template = RenderMasterScriptReferences()
6945 };
6946 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences);
6947 }
69486949 @helper RenderMasterScriptReferences() {
6950 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script>
6951 <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script>
69526953 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript"))
6954 {
6955 <script src="/Files/Templates/Designs/Rapido/js/custom.min.js"></script>
6956 PushPromise("/Files/Templates/Designs/Rapido/js/custom.min.js");
6957 }
69586959 PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js");
6960 PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js");
6961 }
6962 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
69636964 @using System
6965 @using System.Web
6966 @using System.Collections.Generic
6967 @using Dynamicweb.Rapido.Blocks.Extensibility
6968 @using Dynamicweb.Rapido.Blocks
6969 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
6970 @using Dynamicweb.Rapido.Services
69716972 @{
6973 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master");
6974 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");
6975 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID"));
69766977 if (!navigationItemsHideSearch || isFavoriteList)
6978 {
6979 Block masterSearchScriptTemplates = new Block()
6980 {
6981 Id = "MasterSearchScriptTemplates",
6982 SortId = 1,
6983 Template = RenderSearchScriptTemplates()
6984 };
69856986 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates);
6987 }
6988 }
69896990 @helper RenderSearchScriptTemplates()
6991 {
6992 int productsPageId = GetPageIdByNavigationTag("ProductsPage");
6993 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;
6994 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID"));
6995 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID"));
6996 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults");
6997 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton");
6998 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton");
6999 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton");
7000 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
70017002 <script id="SearchGroupsTemplate" type="text/x-template">
7003 {{#.}}
7004 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li>
7005 {{/.}}
7006 </script>
70077008 <script id="SearchProductsTemplate" type="text/x-template">
7009 {{#each .}}
7010 {{#Product}}
7011 {{#ifCond template "!==" "SearchMore"}}
7012 <li class="dropdown__item dropdown__item--seperator dw-mod">
7013 @if (useFacebookPixel)
7014 {
7015 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text>
7016 }
7017 @if (useGoogleTagManager)
7018 {
7019 <text>{{{googleEnchantImpression googleImpression}}}</text>
7020 }
7021 <div>
7022 <a href="{{link}}"
7023 class="js-typeahead-link u-color-inherit u-pull--left"
7024 onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}"
7025 title="{{name}}{{#if variantName}}, {{variantName}}{{/if}}">
7026 <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>
7027 <div class="u-pull--left">
7028 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}{{#if variantName}}, {{variantName}}{{/if}}</div>
7029 @if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed())
7030 {
7031 if (pointShopOnly)
7032 {
7033 <text>
7034 {{#if havePointPrice}}
7035 <div>
7036 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points")
7037 </div>
7038 {{else}}
7039 <small class="help-text u-no-margin">@Translate("Not available")</small>
7040 {{/if}}
7041 {{#unless canBePurchasedWithPoints}}
7042 {{#if havePointPrice}}
7043 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small>
7044 {{/if}}
7045 {{/unless}}
7046 </text>
7047 }
7048 else
7049 {
7050 <div>{{price}}</div>
7051 }
7052 }
7053 </div>
7054 </a>
7055 <div class="u-margin-left u-pull--right">
7056 @{
7057 var viewBtn = new Link
7058 {
7059 Href = "{{link}}",
7060 OnClick = "{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}",
7061 ButtonLayout = ButtonLayout.Secondary,
7062 CssClass = "btn--condensed u-no-margin u-w80px js-ignore-click-outside",
7063 Title = Translate("View")
7064 };
7065 }
7066 @if (showAddToCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed())
7067 {
7068 <text>{{#if hideAddToCartButton}}</text>
7069 @Render(viewBtn)
7070 <text>{{else}}</text>
7071 @Render(new AddToCartButton
7072 {
7073 HideTitle = true,
7074 ProductId = "{{productId}}",
7075 ProductInfo = "{{productInfo}}",
7076 BuyForPoints = pointShopOnly,
7077 OnClick = "{{facebookPixelAction}}",
7078 CssClass = "u-w80px u-no-margin js-ignore-click-outside",
7079 Icon = new Icon {
7080 CssClass = "js-ignore-click-outside"
7081 },
7082 ExtraAttributes = new Dictionary<string, string>
7083 {
7084 { "{{disabledBuyButton}}", "" }
7085 }
7086 })
7087 <text>{{/if}}</text>
7088 }
7089 else if (showViewButton)
7090 {
7091 @Render(viewBtn)
7092 }
7093 @if (showAddToDownloadButton)
7094 {
7095 <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}}">
7096 <i class="fas fa-plus js-button-icon"></i>
7097 </button>
7098 }
7099 </div>
7100 </div>
7101 </li>
7102 {{/ifCond}}
7103 {{#ifCond template "===" "SearchMore"}}
7104 {{>SearchMoreProducts}}
7105 {{/ifCond}}
7106 {{/Product}}
7107 {{else}}
7108 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod">
7109 @Translate("Your search gave 0 results")
7110 </li>
7111 {{/each}}
7112 </script>
71137114 <script id="SearchMoreProducts" type="text/x-template">
7115 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod">
7116 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link">
7117 @Translate("View all")
7118 </a>
7119 </li>
7120 </script>
71217122 <script id="SearchMorePages" type="text/x-template">
7123 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod">
7124 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link">
7125 @Translate("View all")
7126 </a>
7127 </li>
7128 </script>
71297130 <script id="SearchPagesTemplate" type="text/x-template">
7131 {{#each .}}
7132 {{#ifCond template "!==" "SearchMore"}}
7133 <li class="dropdown__item dropdown__item--seperator dropdown__item--no-padding dw-mod">
7134 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link dropdown__link u-color-inherit">
7135 <div class="u-margin-right u-inline"><i class="fa {{icon}} u-w20px u-ta-center"></i></div>
7136 <div class="u-inline u-va-middle"><div class="u-bold u-truncate-text u-max-w210px u-inline-block js-typeahead-name">{{name}}</div></div>
7137 </a>
7138 </li>
7139 {{/ifCond}}
7140 {{#ifCond template "===" "SearchMore"}}
7141 {{>SearchMorePages}}
7142 {{/ifCond}}
7143 {{else}}
7144 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod">
7145 @Translate("Your search gave 0 results")
7146 </li>
7147 {{/each}}
7148 </script>
71497150 <script id="SearchPagesTemplateWrap" type="text/x-template">
7151 <div class="dropdown__column-header">@Translate("Pages")</div>
7152 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod">
7153 {{>SearchPagesTemplate}}
7154 </ul>
7155 </script>
71567157 <script id="SearchProductsTemplateWrap" type="text/x-template">
7158 <div class="dropdown__column-header">@Translate("Products")</div>
7159 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod">
7160 {{>SearchProductsTemplate}}
7161 </ul>
7162 </script>
7163 }
71647165 @using Dynamicweb.Rapido.Blocks.Components
7166 @using Dynamicweb.Rapido.Blocks.Components.General
7167 @using Dynamicweb.Rapido.Blocks
7168 @using System.IO
716971707171 @using Dynamicweb.Rapido.Blocks.Components.General
7172 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
717371747175 @* Component *@
71767177 @helper RenderVariantMatrix(VariantMatrix settings) {
7178 if (settings != null)
7179 {
7180 int productLoopCounter = 0;
7181 int groupCount = 0;
7182 List<VariantOption> firstDimension = new List<VariantOption>();
7183 List<VariantOption> secondDimension = new List<VariantOption>();
7184 List<VariantOption> thirdDimension = new List<VariantOption>();
71857186 foreach (VariantGroup variantGroup in settings.GetVariantGroups())
7187 {
7188 foreach (VariantOption variantOptions in variantGroup.GetVariantOptions())
7189 {
7190 if (groupCount == 0) {
7191 firstDimension.Add(variantOptions);
7192 }
7193 if (groupCount == 1)
7194 {
7195 secondDimension.Add(variantOptions);
7196 }
7197 if (groupCount == 2)
7198 {
7199 thirdDimension.Add(variantOptions);
7200 }
7201 }
7202 groupCount++;
7203 }
72047205 int rowCount = 0;
7206 int columnCount = 0;
72077208 <script>
7209 var variantsCollection = [];
7210 </script>
72117212 <table class="table table--compact js-variants-matrix dw-mod" id="VariantMatrixTable_@settings.ProductId">
7213 @if (groupCount == 1)
7214 {
7215 <tbody>
7216 @foreach (VariantOption firstVariantOption in firstDimension)
7217 {
7218 var variantId = firstVariantOption.Id;
7219 <tr>
7220 <td class="u-bold">
7221 @firstVariantOption.Name
7222 </td>
7223 <td>
7224 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount)
7225 </td>
7226 </tr>
7227 productLoopCounter++;
7228 }
72297230 <tr>
7231 <td> </td>
7232 <td>
7233 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div>
7234 </td>
7235 </tr>
7236 </tbody>
7237 }
7238 @if (groupCount == 2)
7239 {
7240 <thead>
7241 <tr>
7242 <td> </td>
7243 @foreach (VariantOption variant in secondDimension)
7244 {
7245 <td>@variant.Name</td>
7246 }
7247 </tr>
7248 </thead>
7249 <tbody>
7250 @foreach (VariantOption firstVariantOption in firstDimension)
7251 {
7252 string variantId = "";
7253 columnCount = 0;
72547255 <tr>
7256 <td class="u-min-w120px">@firstVariantOption.Name</td>
72577258 @foreach (VariantOption secondVariantOption in secondDimension)
7259 {
7260 variantId = firstVariantOption.Id + "." + secondVariantOption.Id;
7261 <td>
7262 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount)
7263 </td>
72647265 columnCount++;
72667267 productLoopCounter++;
7268 }
72697270 <td>
7271 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div>
7272 </td>
7273 </tr>
72747275 rowCount++;
7276 }
72777278 @{
7279 columnCount = 0;
7280 }
72817282 <tr>
7283 <td> </td>
7284 @foreach (VariantOption secondVariantOption in secondDimension)
7285 {
7286 <td>
7287 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div>
7288 </td>
72897290 columnCount++;
7291 }
7292 <td> </td>
7293 </tr>
7294 </tbody>
7295 }
7296 @if (groupCount == 3)
7297 {
7298 <thead>
7299 <tr>
7300 <td> </td>
7301 @foreach (VariantOption thirdVariantOption in thirdDimension)
7302 {
7303 <td>@thirdVariantOption.Name</td>
7304 }
7305 </tr>
7306 </thead>
7307 <tbody>
7308 @foreach (VariantOption firstVariantOption in firstDimension)
7309 {
7310 int colspan = (thirdDimension.Count + 1);
73117312 <tr>
7313 <td colspan="@colspan" class="u-color-light-gray--bg u-bold">@firstVariantOption.Name</td>
7314 </tr>
73157316 foreach (VariantOption secondVariantOption in secondDimension)
7317 {
7318 string variantId = "";
7319 columnCount = 0;
73207321 <tr>
7322 <td class="u-min-w120px">@secondVariantOption.Name</td>
73237324 @foreach (VariantOption thirdVariantOption in thirdDimension)
7325 {
7326 variantId = firstVariantOption.Id + "." + secondVariantOption.Id + "." + thirdVariantOption.Id;
73277328 <td>
7329 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount)
7330 </td>
73317332 columnCount++;
7333 productLoopCounter++;
7334 }
73357336 <td>
7337 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div>
7338 </td>
7339 </tr>
7340 rowCount++;
7341 }
7342 }
73437344 @{
7345 columnCount = 0;
7346 }
73477348 <tr>
7349 <td> </td>
7350 @foreach (VariantOption thirdVariantOption in thirdDimension)
7351 {
7352 <td>
7353 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div>
7354 </td>
73557356 columnCount++;
7357 }
7358 <td> </td>
7359 </tr>
7360 </tbody>
7361 }
7362 </table>
73637364 <script>
7365 document.addEventListener("DOMContentLoaded", function (event) {
7366 MatrixUpdateQuantity("@settings.ProductId");
7367 });
73687369 MatrixUpdateQuantity = function (productId) {
7370 var currentMatrix = document.getElementById("VariantMatrixTable_" + productId);
7371 var allQtyFields = currentMatrix.getElementsByClassName("js-qty");
73727373 var qtyRowArr = [];
7374 var qtyColumnArr = [];
73757376 var totalQty = 0;
73777378 for (var i = 0; i < allQtyFields.length; i++) {
7379 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] = 0;
7380 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] = 0;
7381 }
73827383 for (var i = 0; i < allQtyFields.length; i++) {
7384 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] += parseFloat(allQtyFields[i].value);
7385 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] += parseFloat(allQtyFields[i].value);
7386 totalQty += parseFloat(allQtyFields[i].value);
7387 }
73887389 //Update row counters
7390 for (var i = 0; i < qtyRowArr.length; i++) {
7391 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0];
73927393 if (qtyRowArr[i] != undefined && qtyCounter != null) {
7394 var currentCount = qtyCounter.innerHTML;
7395 qtyCounter.innerHTML = qtyRowArr[i];
73967397 if (currentCount != qtyCounter.innerHTML) {
7398 qtyCounter.classList.add("qty-field--active");
7399 }
7400 }
74017402 }
74037404 //Update column counters
7405 for (var i = 0; i < qtyColumnArr.length; i++) {
7406 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0];
74077408 if (qtyColumnArr[i] != undefined && qtyCounter != null) {
7409 var currentCount = qtyCounter.innerHTML;
7410 qtyCounter.innerHTML = qtyColumnArr[i];
74117412 if (currentCount != qtyCounter.innerHTML) {
7413 qtyCounter.classList.add("qty-field--active");
7414 }
7415 }
7416 }
74177418 if (document.getElementById("TotalQtyCount_" + productId)) {
7419 document.getElementById("TotalQtyCount_" + productId).innerHTML = totalQty;
7420 }
74217422 //Clean up animations
7423 setTimeout(function () {
7424 for (var i = 0; i < qtyRowArr.length; i++) {
7425 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0];
7426 if (qtyCounter != null) {
7427 qtyCounter.classList.remove("qty-field--active");
7428 }
7429 }
7430 for (var i = 0; i < qtyColumnArr.length; i++) {
7431 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0];
7432 if (qtyCounter != null) {
7433 qtyCounter.classList.remove("qty-field--active");
7434 }
7435 }
7436 }, 1000);
7437 }
7438 </script>
7439 }
7440 }
74417442 @helper RenderVariantMatrixQuantityField(string variantId, VariantMatrix settings, int productLoopCounter, int rowCount, int columnCount)
7443 {
7444 string loopCount = productLoopCounter.ToString();
74457446 bool combinationFound = false;
7447 double stock = 0;
7448 double quantityValue = 0;
7449 string note = "";
74507451 VariantProduct variantProduct = null;
74527453 if (settings.GetVariantProducts().TryGetValue(variantId, out variantProduct))
7454 {
7455 stock = variantProduct.Stock;
7456 quantityValue = variantProduct.Quantity;
7457 combinationFound = true;
7458 }
74597460 if (combinationFound)
7461 {
7462 <input type="hidden" name="ProductLoopCounter@(loopCount)" value="@loopCount" />
7463 <input type="hidden" name="ProductID@(loopCount)" value="@settings.ProductId" />
7464 <input type="hidden" name="VariantID@(loopCount)" value="@variantId" />
7465 <input type="hidden" name="CurrentNote@(loopCount)" id="CurrentNote_@(settings.ProductId)_@variantId" value="@note" />
7466 <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">
74677468 if (stock != 0)
7469 {
7470 <small>@Translate("Stock") @stock</small>
7471 }
74727473 <script>
7474 var variants = '{ "ProductId" :' + '"@settings.ProductId"' + ', "VariantId": ' + '"@variantId"' +'}';
7475 variantsCollection.push(variants);
7476 document.getElementById("Quantity_@(settings.ProductId)_@variantId").closest(".js-variants-matrix").setAttribute("data-variants-collection", "[" + variantsCollection + "]" );
7477 </script>
7478 }
7479 else
7480 {
7481 <div class="use-btn-height" style="background-color: #a8a8a8"></div>
7482 }
7483 }
7484 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
74857486 @* Component *@
74877488 @helper RenderAddToCart(AddToCart settings)
7489 {
7490 //set Id for quantity selector to get it's value from button
7491 if (settings.QuantitySelector != null)
7492 {
7493 if (string.IsNullOrEmpty(settings.QuantitySelector.Id))
7494 {
7495 settings.QuantitySelector.Id = Guid.NewGuid().ToString("N");
7496 }
74977498 settings.AddButton.QuantitySelectorId = settings.QuantitySelector.Id;
74997500 if (settings.Disabled)
7501 {
7502 settings.QuantitySelector.Disabled = true;
7503 }
75047505 if (string.IsNullOrEmpty(settings.QuantitySelector.Name))
7506 {
7507 settings.QuantitySelector.Name = settings.QuantitySelector.Id;
7508 }
7509 }
75107511 if (settings.Disabled)
7512 {
7513 settings.AddButton.Disabled = true;
7514 }
75157516 settings.AddButton.CssClass += " btn--condensed";
75177518 //unitsSelector
7519 if (settings.UnitSelector != null)
7520 {
7521 if (settings.Disabled)
7522 {
7523 settings.QuantitySelector.Disabled = true;
7524 }
7525 }
75267527 <div class="buttons-collection @settings.WrapperCssClass" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
7528 @if (settings.UnitSelector != null)
7529 {
7530 @Render(settings.UnitSelector)
7531 }
7532 @if (settings.QuantitySelector != null)
7533 {
7534 @Render(settings.QuantitySelector)
7535 }
7536 @Render(settings.AddButton)
7537 </div>
7538 }
7539 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
75407541 @* Component *@
75427543 @helper RenderAddToCartButton(AddToCartButton settings)
7544 {
7545 if (!settings.HideTitle)
7546 {
7547 if (string.IsNullOrEmpty(settings.Title))
7548 {
7549 if (settings.BuyForPoints)
7550 {
7551 settings.Title = Translate("Buy with points");
7552 }
7553 else
7554 {
7555 settings.Title = Translate("Add to cart");
7556 }
7557 }
7558 }
7559 else
7560 {
7561 settings.Title = "";
7562 }
75637564 if (settings.Icon == null)
7565 {
7566 settings.Icon = new Icon();
7567 settings.Icon.LabelPosition = Dynamicweb.Rapido.Blocks.Components.General.IconLabelPosition.After;
7568 }
75697570 if (string.IsNullOrEmpty(settings.Icon.Name))
7571 {
7572 settings.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue;
7573 }
75747575 settings.OnClick = "Cart.AddToCart(event, { " +
7576 "id: '" + settings.ProductId + "'," +
7577 (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") +
7578 (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") +
7579 (settings.BuyForPoints ? "buyForPoints: true," : "") +
7580 (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") +
7581 "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value)") +
7582 "});" + settings.OnClick;
75837584 @RenderButton(settings)
7585 }
7586 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
75877588 @* Component *@
75897590 @helper RenderUnitSelector(UnitSelector settings)
7591 {
7592 if (string.IsNullOrEmpty(settings.Id))
7593 {
7594 settings.Id = Guid.NewGuid().ToString("N");
7595 }
7596 var disabledClass = settings.Disabled ? "disabled" : "";
75977598 <input type="checkbox" id="@settings.Id" class="dropdown-trigger" />
7599 <div class="dropdown unit-selector @settings.CssClass @disabledClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
7600 <label class="dropdown__header dropdown__btn dropdown__btn--unit-selector dw-mod" for="@settings.Id">@settings.SelectedOption</label>
7601 <div class="dropdown__content dw-mod">
7602 @settings.OptionsContent
7603 </div>
7604 <label class="dropdown-trigger-off" for="@settings.Id"></label>
7605 </div>
7606 }
7607 @using System.Reflection
7608 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
76097610 @* Component *@
76117612 @helper RenderQuantitySelector(QuantitySelector settings)
7613 {
7614 var attributes = new Dictionary<string, string>();
76157616 /*base settings*/
7617 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
7618 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
7619 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
7620 if (settings.Disabled) { attributes.Add("disabled", "true"); }
7621 if (settings.Required) { attributes.Add("required", "true"); }
7622 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
7623 /*end*/
76247625 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
7626 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
7627 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
7628 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
7629 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); }
7630 if (settings.Min == null) { settings.Min = 1; }
7631 attributes.Add("min", settings.Min.ToString());
7632 if (settings.Step != null && !string.IsNullOrEmpty(settings.Step.ToString())) { attributes.Add("step", settings.Step.ToString()); }
7633 if (settings.Value == null) { settings.Value = 1; }
7634 attributes.Add("value", settings.Value.ToString());
7635 attributes.Add("type", "number");
76367637 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
76387639 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
7640 }
7641 @using Dynamicweb.Rapido.Blocks.Components
76427643 @using Dynamicweb.Frontend
7644 @using Dynamicweb.Frontend.Devices
7645 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
7646 @using Dynamicweb.Rapido.Blocks.Components.General
7647 @using System.Collections.Generic;
76487649 @* Component *@
76507651 @helper RenderCustomerCenterList(CustomerCenterList settings)
7652 {
7653 bool isTouchDevice = Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet" ? true : false;
7654 string hideActions = isTouchDevice ? "u-block" : "";
76557656 <table class="table data-list dw-mod">
7657 @if (settings.GetHeaders().Length > 0) {
7658 <thead>
7659 <tr class="u-bold">
7660 @foreach (CustomerCenterListHeaderItem header in settings.GetHeaders())
7661 {
7662 var attributes = new Dictionary<string, string>();
7663 if (!string.IsNullOrEmpty(header.Id)) { attributes.Add("id", header.Id); }
7664 if (!string.IsNullOrEmpty(header.CssClass)) { attributes.Add("class", header.CssClass); }
7665 attributes.Add("align", header.Align.ToString());
7666 attributes = attributes.Concat(header.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
76677668 <td @ComponentMethods.AddAttributes(attributes)>@header.Title</td>
7669 }
7670 </tr>
7671 </thead>
7672 }
7673 @foreach (CustomerCenterListItem listItem in settings.GetItems())
7674 {
7675 int columnCount = 0;
7676 int totalColumns = listItem.GetInfoItems().Length;
7677 string rowHasActions = listItem.GetActions().Length > 0 ? "data-list__item--has-actions" : "";
7678 listItem.Id = !string.IsNullOrEmpty(listItem.Id) ? listItem.Id : Guid.NewGuid().ToString("N");
76797680 var attributes = new Dictionary<string, string>();
7681 if (!string.IsNullOrEmpty(listItem.Title)) { attributes.Add("title", listItem.Title); };
76827683 attributes = attributes.Concat(listItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
7684 <tbody class="data-list__item @rowHasActions @listItem.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes)>
7685 <tr>
7686 @if (!string.IsNullOrEmpty(listItem.Title) || !string.IsNullOrEmpty(listItem.Description)) {
7687 string onClick = !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : "";
76887689 <td rowspan="2" @onClick class="data-list__main-item dw-mod">
7690 @if (!string.IsNullOrEmpty(listItem.Title)) {
7691 <div class="u-bold">@listItem.Title</div>
7692 }
7693 @if (!string.IsNullOrEmpty(listItem.Description)) {
7694 <div>@listItem.Description</div>
7695 }
7696 </td>
7697 }
76987699 @foreach (CustomerCenterListInfoItem infoItem in listItem.GetInfoItems())
7700 {
7701 var infoAttributes = new Dictionary<string, string>();
7702 if (!string.IsNullOrEmpty(infoItem.Id)) { infoAttributes.Add("id", infoItem.Id); };
7703 if (!string.IsNullOrEmpty(infoItem.OnClick)) { infoAttributes.Add("onclick", infoItem.OnClick); };
7704 infoAttributes.Add("align", infoItem.Align.ToString());
77057706 infoAttributes = infoAttributes.Concat(infoItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
7707 string columnClick = columnCount < (totalColumns-1) && !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : "";
77087709 <td @ComponentMethods.AddAttributes(infoAttributes) @columnClick class="data-list__info-item dw-mod">
7710 @if (!string.IsNullOrEmpty(infoItem.Title)) {
7711 <div>@infoItem.Title</div>
7712 }
7713 @if (!string.IsNullOrEmpty(infoItem.Subtitle)) {
7714 <div><small>@infoItem.Subtitle</small></div>
7715 }
7716 </td>
77177718 columnCount++;
7719 }
7720 </tr>
7721 <tr>
7722 <td colspan="7" align="right" class="u-va-bottom u-no-border">
7723 <div class="data-list__actions @hideActions dw-mod" id="ActionsMenu_@listItem.Id">
7724 @foreach (ButtonBase action in listItem.GetActions())
7725 {
7726 action.ButtonLayout = ButtonLayout.LinkClean;
7727 action.Icon.CssClass += " u-full-height";
7728 action.CssClass += " data-list__action-button link";
77297730 @Render(action)
7731 }
7732 </div>
7733 </td>
7734 </tr>
7735 </tbody>
7736 }
7737 </table>
7738 }
7739 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
77407741 @using System
7742 @using System.Web
7743 @using System.Collections.Generic
7744 @using Dynamicweb.Rapido.Blocks.Extensibility
7745 @using Dynamicweb.Rapido.Blocks
77467747 @{
7748 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master");
77497750 Block primaryBottomSnippets = new Block()
7751 {
7752 Id = "MasterJavascriptInitializers",
7753 SortId = 100,
7754 Template = RenderPrimaryBottomSnippets()
7755 };
7756 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets);
77577758 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed())
7759 {
7760 Block miniCartPageId = new Block
7761 {
7762 Id = "MiniCartPageId",
7763 Template = RenderMiniCartPageId()
7764 };
7765 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, miniCartPageId);
7766 }
7767 }
77687769 @helper RenderPrimaryBottomSnippets()
7770 {
7771 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode");
7772 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));
77737774 if (isWireframeMode)
7775 {
7776 <script>
7777 Wireframe.Init(true);
7778 </script>
7779 }
778077817782 if (useGoogleTagManager)
7783 {
7784 <script>
7785 document.addEventListener('addToCart', function(event) {
7786 var googleImpression = JSON.parse(event.detail.productInfo.googleImpression);
7787 if (typeof googleImpression == "string") {
7788 googleImpression = JSON.parse(event.detail.productInfo.googleImpression);
7789 }
7790 dataLayer.push({
7791 'event': 'addToCart',
7792 'ecommerce': {
7793 'currencyCode': googleImpression.currency,
7794 'add': {
7795 'products': [{
7796 'name': googleImpression.name,
7797 'id': googleImpression.id,
7798 'price': googleImpression.price,
7799 'brand': googleImpression.brand,
7800 'category': googleImpression.category,
7801 'variant': googleImpression.variant,
7802 'quantity': event.detail.quantity
7803 }]
7804 }
7805 }
7806 });
7807 });
7808 </script>
7809 }
78107811 //if digitalwarehouse
7812 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart"))
7813 {
7814 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]);
78157816 if (string.IsNullOrEmpty(cartContextId))
7817 {
7818 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2");
7819 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps);
7820 cartContextId = cartSettings.OrderContextID;
7821 HttpContext.Current.Application["DownloadCartContext"] = cartContextId;
7822 }
78237824 <script>
7825 let downloadCart = new DownloadCart({
7826 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"),
7827 contextId: "@cartContextId",
7828 addButtonText: "@Translate("Add")",
7829 removeButtonText: "@Translate("Remove")"
7830 });
7831 </script>
7832 }
78337834 <!--$$Javascripts-->
7835 }
78367837 @helper RenderMiniCartPageId()
7838 {
7839 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
7840 <script>
7841 window.cartId = "@miniCartFeedPageId";
7842 </script>
7843 }
7844 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
78457846 @using System
7847 @using System.Web
7848 @using System.Collections.Generic
7849 @using Dynamicweb.Rapido.Blocks
78507851 @{
7852 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master");
78537854 }
785578567857 @functions {
7858 public class ManifestIcon
7859 {
7860 public string src { get; set; }
7861 public string type { get; set; }
7862 public string sizes { get; set; }
7863 }
78647865 public class Manifest
7866 {
7867 public string name { get; set; }
7868 public string short_name { get; set; }
7869 public string start_url { get; set; }
7870 public string display { get; set; }
7871 public string background_color { get; set; }
7872 public string theme_color { get; set; }
7873 public List<ManifestIcon> icons { get; set; }
7874 }
7875 }
78767877 <!DOCTYPE html>
78787879 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName">
7880788178827883 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@
7884 @RenderBlockList(masterPage.BlocksRoot.BlocksList)
7885788678877888 @helper RenderMasterHead() {
7889 List<Block> subBlocks = this.masterPage.GetBlockListById("Head").OrderBy(item => item.SortId).ToList();
78907891 <head>
7892 <!-- Rapido version 3.4.2 -->
78937894 @RenderBlockList(subBlocks)
7895 </head>
7896 }
78977898 @helper RenderMasterMetadata() {
7899 var swatches = new Dynamicweb.Content.Items.ColorSwatchService();
7900 var brandColors = swatches.GetColorSwatch(1);
7901 string brandColorOne = brandColors.Palette["BrandColor1"];
79027903 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) {
7904 Manifest manifest = new Manifest
7905 {
7906 name = Model.Area.Item.GetItem("Settings").GetString("AppName"),
7907 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"),
7908 start_url = "/",
7909 display = "standalone",
7910 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"),
7911 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor")
7912 };
79137914 manifest.icons = new List<ManifestIcon> {
7915 new ManifestIcon {
7916 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,
7917 sizes = "192x192",
7918 type = "image/png"
7919 },
7920 new ManifestIcon {
7921 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,
7922 sizes = "512x512",
7923 type = "image/png"
7924 },
7925 new ManifestIcon {
7926 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,
7927 sizes = "1024x1024",
7928 type = "image/png"
7929 }
7930 };
79317932 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json");
7933 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest);
7934 string currentManifest = File.ReadAllText(manifestFilePath);
79357936 if (manifestJSON != currentManifest)
7937 {
7938 File.WriteAllText(manifestFilePath, manifestJSON);
7939 }
7940 }
79417942 <meta charset="utf-8" />
7943 <title>@Model.Title</title>
7944 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7945 <meta name="robots" content="index, follow">
7946 <meta name="theme-color" content="@brandColorOne" />
79477948 if (!Model.MetaTags.Contains("og:image")) {
7949 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")));
7950 }
79517952 if (!Model.MetaTags.Contains("og:description")) {
7953 Pageview.Meta.AddTag("og:description", Model.Description);
7954 }
79557956 Pageview.Meta.AddTag("og:title", Model.Title);
7957 Pageview.Meta.AddTag("og:site_name", Model.Name);
7958 Pageview.Meta.AddTag("og:url", HttpContext.Current.Request.Url.ToString());
7959 Pageview.Meta.AddTag("og:type", "Website");
79607961 if (!string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("FacebookAppID"))) {
7962 Pageview.Meta.AddTag("fb:app_id", Model.Area.Item.GetItem("Settings").GetString("FacebookAppID"));
7963 }
79647965 @Model.MetaTags
7966 }
79677968 @helper RenderMasterCss() {
7969 var fonts = new string[] {
7970 getFontFamily("Layout", "HeaderFont"),
7971 getFontFamily("Layout", "SubheaderFont"),
7972 getFontFamily("Layout", "TertiaryHeaderFont"),
7973 getFontFamily("Layout", "BodyText"),
7974 getFontFamily("Layout", "Header", "ToolsFont"),
7975 getFontFamily("Layout", "Header", "NavigationFont"),
7976 getFontFamily("Layout", "MobileNavigation", "Font"),
7977 getFontFamily("ProductList", "Facets", "HeaderFont"),
7978 getFontFamily("ProductPage", "PriceFontDesign"),
7979 getFontFamily("Ecommerce", "SaleSticker", "Font"),
7980 getFontFamily("Ecommerce", "NewSticker", "Font"),
7981 getFontFamily("Ecommerce", "CustomSticker", "Font")
7982 };
79837984 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks;
7985 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png";
7986 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro");
7987 string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css";
7988 if (useFontAwesomePro)
7989 {
7990 fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css";
7991 }
79927993 //Favicon
7994 <link href="@favicon" rel="icon" type="image/png">
79957996 //Base (Default, wireframe) styles
7997 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css">
79987999 //Rapido Css from Website Settings
8000 <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css">
80018002 //Ignite Css (Custom site specific styles)
8003 <link rel="stylesheet" id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css">
80048005 //Font awesome
8006 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css">
80078008 //Flag icon
8009 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css">
80108011 //Google fonts
8012 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)));
80138014 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet">
80158016 <!-- Flex CSS -->
8017 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/flex.css">
80188019802080218022 PushPromise(favicon);
8023 PushPromise(fontAwesomeCssLink);
8024 PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css");
8025 PushPromise(autoCssLink);
8026 PushPromise("/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css");
8027 PushPromise("/Files/Images/placeholder.gif");
8028 PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css");
8029 }
80308031 @helper RenderMasterManifest() {
8032 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")))
8033 {
8034 <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json">
8035 PushPromise("/Files/Templates/Designs/Rapido/manifest.json");
8036 }
8037 }
80388039 @helper RenderMasterBody() {
8040 List<Block> subBlocks = this.masterPage.GetBlockListById("Body").OrderBy(item => item.SortId).ToList();
8041 string designLayout = Model.PropertyItem.GetItem("CustomSettings") != null ? Model.PropertyItem.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.PropertyItem.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : "";
8042 if (!String.IsNullOrEmpty(designLayout)) {
8043 designLayout = "class=\"" + designLayout + "\"";
8044 }
80458046 <body @designLayout>
8047 @RenderBlockList(subBlocks)
8048 </body>
8049 }
80508051 @helper RenderMasterHeader()
8052 {
8053 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList();
8054 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop");
8055 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : "";
80568057 <header class="top-container @stickyTop dw-mod" id="Top">
8058 @RenderBlockList(subBlocks)
8059 </header>
8060 }
80618062 @helper RenderMain()
8063 {
8064 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList();
80658066 var pageBackground = "";
80678068 var pageBackgroundColor = Model.PropertyItem.GetString("PageBackgroundColor") != null ? Model.PropertyItem.GetString("PageBackgroundColor") : "";
8069807080718072 if ( Model.PropertyItem.GetFile("PageBackgroundImage") != null){
8073 pageBackground += "background-image:url(" + Model.PropertyItem.GetFile("PageBackgroundImage") + ")";
8074 }
80758076 else if ( pageBackgroundColor != ""){
8077 pageBackground += "background-color:" + pageBackgroundColor + ";background-image:none;";
8078 }
807980808081 <main style="@pageBackground" class="site dw-mod">
8082 @RenderBlockList(subBlocks)
8083 </main>
8084 }
80858086 @helper RenderPageContent()
8087 {
8088 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop");
8089 string pagePos = isNavigationStickyMenu ? "js-page-pos" : "";
80908091 <div id="Page" class="page @pagePos">
8092 <section class="center-container content-container dw-mod" id="content">
80938094 @RenderSnippet("Content")
8095 </section>
8096 </div>
8097 }
80988099 @* Hack to support nested helpers *@
8100 @SnippetStart("Content")
8101 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
810281038104 @using Dynamicweb.Extensibility
8105 @using Dynamicweb.Core
8106 @using Dynamicweb.Rapido.Blocks.Components
8107 @using Dynamicweb.Rapido.Blocks.Components.Articles
8108 @using Dynamicweb.Rapido.Blocks.Components.General
8109 @using Dynamicweb.Rapido.Blocks
8110 @using Dynamicweb.Content.Items
81118112 @functions {
8113 BlocksPage articlePage = BlocksPage.GetBlockPage("DynamicArticle");
81148115 public string GetParentSettingsItem(string systemName) {
8116 string item = null;
81178118 Dynamicweb.Content.Page current = Dynamicweb.Services.Pages.GetPage(Model.ID);
8119 while (current != null && current.Parent != current) {
8120 var temp = current.Item != null ? current.Item[systemName] : "";
81218122 if (temp != null) {
8123 item = temp.ToString();
81248125 if (!String.IsNullOrEmpty(item) && !String.Equals("default", item, StringComparison.OrdinalIgnoreCase)) {
8126 break;
8127 }
8128 }
81298130 current = current.Parent;
8131 }
81328133 return item;
8134 }
81358136 public string GetArticleCategory(int pageId)
8137 {
8138 string categoryName = null;
81398140 //Secure that the article is not in the root folder = Actual has a category
8141 if (Dynamicweb.Services.Pages.GetPage(pageId).Parent != null) {
8142 if (Dynamicweb.Services.Pages.GetPage(pageId).Parent.Parent != null) {
8143 if (!String.IsNullOrEmpty(Dynamicweb.Services.Pages.GetPage(pageId).Parent.Parent.ItemType))
8144 {
8145 categoryName = Dynamicweb.Services.Pages.GetPage(pageId).Parent.GetDisplayName();
8146 }
8147 }
8148 }
81498150 return categoryName;
8151 }
81528153 public string GetArticleCategoryColor(int pageId)
8154 {
8155 string categoryColor = "";
81568157 //Secure that the article is not in the root folder = Actual has a category
8158 if (Dynamicweb.Services.Pages.GetPage(pageId).Parent != null) {
8159 if (Dynamicweb.Services.Pages.GetPage(pageId).Parent.Parent != null) {
8160 if (!String.IsNullOrEmpty(Dynamicweb.Services.Pages.GetPage(pageId).Parent.Parent.ItemType))
8161 {
8162 if (Dynamicweb.Services.Pages.GetPage(pageId).Parent.Item["CategoryColor"] != null)
8163 {
8164 var service = new ColorSwatchService();
8165 categoryColor = Dynamicweb.Services.Pages.GetPage(pageId).Parent.Item["CategoryColor"].ToString();
81668167 if (!categoryColor.Contains("#")) {
8168 categoryColor = service.GetHexColor(Converter.ToInt32(Model.Area.ID), categoryColor);
8169 }
8170 }
8171 }
8172 }
8173 }
81748175 return categoryColor;
8176 }
8177 }
81788179 @{
8180 string listPageId = Converter.ToString(GetPageIdByNavigationTag("DynamicListFeed"));
8181 string parentPageId = Dynamicweb.Services.Pages.GetPage(Model.ID).Parent.ID.ToString();
8182 string topLayout = Model.Item.GetList("TopLayout") != null ? Model.Item.GetList("TopLayout").SelectedValue : "default";
8183 topLayout = topLayout == "default" && GetParentSettingsItem("ArticleTopLayout") != null ? GetParentSettingsItem("ArticleTopLayout").ToString().ToLower() : topLayout;
8184 string textLayout = Model.Item.GetList("TextLayout") != null ? Model.Item.GetList("TextLayout").SelectedValue : "default";
8185 textLayout = textLayout == "default" && GetParentSettingsItem("ArticleTextLayout") != null ? GetParentSettingsItem("ArticleTextLayout").ToString().ToLower() : textLayout;
8186 string imageLayout = Model.Item.GetList("ImageLayout") != null ? Model.Item.GetList("ImageLayout").SelectedValue : "default";
8187 imageLayout = imageLayout == "default" && GetParentSettingsItem("ArticleImageLayout") != null ? GetParentSettingsItem("ArticleImageLayout").ToString().ToLower() : imageLayout;
81888189 string imageColumns = imageLayout == "straight" && textLayout != "full" ? "8" : "12";
8190 string contentColumns = textLayout != "full" ? "8" : "12";
81918192 int externalParagraphId = Model.Item.GetItem("CTAParagraphLink") != null ? Model.Item.GetItem("CTAParagraphLink").ParagraphID : 0;
81938194 ArticleHeaderLayout headerLayout;
81958196 switch (topLayout)
8197 {
8198 case "default":
8199 headerLayout = ArticleHeaderLayout.Clean;
8200 break;
8201 case "split":
8202 headerLayout = ArticleHeaderLayout.Split;
8203 break;
8204 case "banner":
8205 headerLayout = ArticleHeaderLayout.Banner;
8206 break;
8207 case "overlay":
8208 headerLayout = ArticleHeaderLayout.Overlay;
8209 break;
8210 default:
8211 headerLayout = ArticleHeaderLayout.Clean;
8212 break;
8213 }
821482158216 Block articleContainer = new Block
8217 {
8218 Id = "ArticleContainer",
8219 SortId = 10,
8220 Design = new Design
8221 {
8222 RenderType = RenderType.Row
8223 },
8224 BlocksList = new List<Block> {
8225 new Block {
8226 Id = "ArticleBody",
8227 SortId = 30,
8228 Design = new Design {
8229 RenderType = RenderType.Column,
8230 Size = "12",
8231 HidePadding = true
8232 }
8233 }
8234 }
8235 };
8236 articlePage.Add(articleContainer);
82378238 ButtonLayout topBannerButtonLayout = ButtonLayout.Primary;
82398240 switch (Model.Item.GetString("ButtonDesign")) {
8241 case "primary":
8242 topBannerButtonLayout = ButtonLayout.Primary;
8243 break;
8244 case "secondary":
8245 topBannerButtonLayout = ButtonLayout.Secondary;
8246 break;
8247 case "teritary":
8248 topBannerButtonLayout = ButtonLayout.Tertiary;
8249 break;
8250 case "link":
8251 topBannerButtonLayout = ButtonLayout.Link;
8252 break;
8253 }
82548255 ArticleHeader topBanner = new ArticleHeader
8256 {
8257 Layout = headerLayout,
8258 Image = new Image { Path = Model.Item.GetFile("Image"), ImageDefault = new ImageSettings { Width = 1920, Height = 640 } },
8259 Heading = Model.Item.GetString("Title"),
8260 Subheading = Model.Item.GetString("Summary"),
8261 TextColor = "#fff",
8262 Author = Model.Item.GetString("Author"),
8263 Date = Model.Item.GetString("Date"),
8264 Category = GetArticleCategory(Model.ID),
8265 CategoryColor = GetArticleCategoryColor(Model.ID),
8266 Link = Model.Item.GetString("Link"),
8267 LinkText = Model.Item.GetString("LinkText"),
8268 ButtonLayout = topBannerButtonLayout,
8269 RatingScore = Model.Item.GetString("Rating") != null ? Converter.ToInt32(Model.Item.GetList("Rating").SelectedValue) : 0,
8270 RatingOutOf = Model.Item.GetString("Rating") != null ? Model.Item.GetList("Rating").Options.Count : 0,
8271 ExternalParagraphId = externalParagraphId
8272 };
82738274 Block articleTop = new Block
8275 {
8276 Id = "ArticleHead",
8277 SortId = 20,
8278 Component = topBanner,
8279 Design = new Design
8280 {
8281 RenderType = RenderType.Column,
8282 Size = "12",
8283 HidePadding = true,
8284 CssClass = "article-head"
8285 }
8286 };
8287 articlePage.Add("ArticleContainer", articleTop);
828882898290 Block articleBodyRow = new Block
8291 {
8292 Id = "ArticleBodyRow",
8293 SortId = 10,
8294 SkipRenderBlocksList = true
8295 };
8296 articlePage.Add("ArticleBody", articleBodyRow);
829782988299 if (Model.Item.GetString("Paragraphs") != null)
8300 {
8301 int count = 0;
8302 foreach (var paragraph in Model.Item.GetItems("Paragraphs"))
8303 {
8304 if (!paragraph.GetBoolean("RenderAsQuote"))
8305 {
8306 string enableDropCap = Model.Item.GetString("EnableDropCap") != null ? Model.Item.GetList("EnableDropCap").SelectedValue.ToLower() : "default";
8307 enableDropCap = enableDropCap == "default" && GetParentSettingsItem("EnableDropCap") != null ? GetParentSettingsItem("EnableDropCap").ToString().ToLower() : enableDropCap;
8308 string text = paragraph.GetString("Text") != null ? paragraph.GetString("Text") : "";
83098310 if (!String.IsNullOrEmpty(text) && enableDropCap == "true" && count == 0 && paragraph.GetString("Text").Substring(0, 3) == "<p>")
8311 {
8312 string firstLetter = paragraph.GetString("Text").Substring(3, 1);
8313 text = paragraph.GetString("Text").Remove(3, 1);
8314 text = text.Insert(3, "<span class=\"article__drop-cap\">" + firstLetter + "</span>");
8315 }
83168317 if (paragraph.GetFile("Image") != null)
8318 {
8319 string imageTitle = !string.IsNullOrEmpty(paragraph.GetString("Heading")) ? paragraph.GetString("Heading") : "";
83208321 Block articleParagraphImage = new Block
8322 {
8323 Id = "ArticleParagraph" + count + "Image",
8324 SortId = (count * 10),
8325 Design = new Design
8326 {
8327 RenderType = RenderType.Column,
8328 Size = imageColumns,
8329 CssClass = "u-color-light--bg u-padding--lg"
8330 }
8331 };
83328333 if (imageLayout == "banner")
8334 {
8335 ArticleBanner banner = new ArticleBanner
8336 {
8337 Image = new Image { Path = paragraph.GetFile("Image"), ImageDefault = new ImageSettings { Height = 650, Width = 1300 }, Caption = paragraph.GetString("ImageCaption") },
8338 Heading = imageTitle,
8339 UseFilters = false
8340 };
8341 articleParagraphImage.Component = banner;
8342 }
8343 else
8344 {
8345 ArticleImage image = new ArticleImage
8346 {
8347 Image = new Image
8348 {
8349 Path = paragraph.GetFile("Image"),
8350 Title = imageTitle,
8351 ImageDefault = new ImageSettings { Height = 650, Width = 1300 },
8352 Caption = paragraph.GetString("ImageCaption")
8353 }
8354 };
8355 articleParagraphImage.Component = image;
8356 }
83578358 articlePage.Add("ArticleBodyRow", articleParagraphImage);
8359 }
83608361 if (!String.IsNullOrEmpty(paragraph.GetString("VideoURL")))
8362 {
8363 Block articleParagraphVideo = new Block
8364 {
8365 Id = "ArticleParagraph" + count + "Video",
8366 SortId = (count * 10) + 1,
8367 Component = new ArticleVideo { Url = paragraph.GetString("VideoURL"), AutoPlay = "false" },
8368 Design = new Design
8369 {
8370 RenderType = RenderType.Column,
8371 Size = imageColumns,
8372 CssClass = "u-color-light--bg u-padding--lg"
8373 }
8374 };
8375 articlePage.Add("ArticleBodyRow", articleParagraphVideo);
8376 }
83778378 if (!String.IsNullOrEmpty(paragraph.GetString("Heading")))
8379 {
8380 Block articleParagraphHeader = new Block
8381 {
8382 Id = "ArticleParagraph" + count + "Heading",
8383 SortId = (count * 10) + 2,
8384 Component = new ArticleSubHeader { Title = paragraph.GetString("Heading") },
8385 Design = new Design
8386 {
8387 RenderType = RenderType.Column,
8388 Size = contentColumns,
8389 CssClass = "u-color-light--bg u-padding--lg"
8390 }
8391 };
8392 articlePage.Add("ArticleBodyRow", articleParagraphHeader);
8393 }
83948395 if (!String.IsNullOrEmpty(text))
8396 {
8397 Block articleParagraphText = new Block
8398 {
8399 Id = "ArticleParagraph" + count + "Text",
8400 SortId = (count * 10) + 3,
8401 Component = new ArticleText { Text = text },
8402 Design = new Design
8403 {
8404 RenderType = RenderType.Column,
8405 Size = contentColumns,
8406 CssClass = "u-color-light--bg u-padding--lg"
8407 }
8408 };
84098410 articlePage.Add("ArticleBodyRow", articleParagraphText);
8411 }
8412 }
8413 else
8414 {
8415 if (!String.IsNullOrEmpty(paragraph.GetString("Text")))
8416 {
8417 string quoteText = paragraph.GetString("Text") != null ? paragraph.GetString("Text") : "";
8418 string quoteAuthor = paragraph.GetString("Heading") != null ? paragraph.GetString("Heading") : "";
84198420 Block articleParagraphQuote = new Block
8421 {
8422 Id = "ArticleParagraph" + count + "Quote",
8423 SortId = (count * 10) + 3,
8424 Component = new ArticleQuote { Image = new Image { Path = paragraph.GetFile("Image") }, Text = quoteText, Author = quoteAuthor },
8425 Design = new Design
8426 {
8427 RenderType = RenderType.Column,
8428 Size = contentColumns,
8429 CssClass = "u-color-light--bg u-padding--lg"
8430 }
8431 };
8432 articlePage.Add("ArticleBodyRow", articleParagraphQuote);
8433 }
8434 }
84358436 count++;
8437 }
8438 }
84398440 articleBodyRow.Component = new ArticleBodyRow { SubBlocks = articleBodyRow.BlocksList, TopLayout = topLayout, TextLayout = textLayout };
844184428443 //Related
8444 string showRelatedArtices = Model.Item.GetString("ShowRelatedArticles") != null ? Model.Item.GetList("ShowRelatedArticles").SelectedValue.ToLower() : "default";
8445 showRelatedArtices = showRelatedArtices == "default" && GetParentSettingsItem("ShowRelatedArticles") != null ? GetParentSettingsItem("ShowRelatedArticles").ToString().ToLower() : showRelatedArtices;
84468447 if (showRelatedArtices == "true")
8448 {
8449 Block articleRelated = new Block
8450 {
8451 Id = "ArticleRelated",
8452 SortId = 30,
8453 Component = new ArticleRelated { Title = Translate("Related articles"), FeedPageId = listPageId, Query = "sourceType=Page&sourcePage=" + parentPageId, PageSize = 4, CurrentPageId = Model.ID.ToString() },
8454 Design = new Design
8455 {
8456 RenderType = RenderType.Column,
8457 Size = "12"
8458 }
8459 };
8460 articlePage.Add("ArticleContainer", articleRelated);
8461 }
8462 }
846384648465 @using System
8466 @using System.Web
8467 @using System.Collections.Generic
8468 @using Dynamicweb.Rapido.Blocks
84698470 @{
8471 BlocksPage dynamicArticleCustomBlocksPage = BlocksPage.GetBlockPage("DynamicArticle");
84728473 }
847484758476 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@
8477 @RenderBlockList(articlePage.BlocksRoot.BlocksList)
8478 @SnippetEnd("Content")
84798480 @helper RenderIosTabletFix() {
8481 if (Pageview.Device != Dynamicweb.Frontend.Devices.DeviceType.Tablet && Pageview.Platform != Dynamicweb.Frontend.Devices.PlatformType.Ios)
8482 {
8483 <script>
8484 let isIpadIOS = (/iPad/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) && !window.MSStream;
8485 if (isIpadIOS) {
8486 var separator = (window.location.href.indexOf("?") === -1) ? "?" : "&";
8487 window.location.href = window.location.href + separator + "DeviceType=Tablet&PlatformType=Ios";
8488 }
8489 </script>
8490 }
8491 }
84928493 </html>
84948495