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