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