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