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