Error executing template "Designs/Rapido/_parsed/BlogArticle.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at CompiledRazorTemplates.Dynamic.RazorEngine_04e32c99a9fb4e9f9f52e6265520b5fc.<RenderPageContent>b__152_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Nextech\papaellinas.staging.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 6638
at RazorEngine.Templating.TemplateWriter.ToString()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at CompiledRazorTemplates.Dynamic.RazorEngine_04e32c99a9fb4e9f9f52e6265520b5fc.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Nextech\papaellinas.staging.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 224
at CompiledRazorTemplates.Dynamic.RazorEngine_04e32c99a9fb4e9f9f52e6265520b5fc.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Nextech\papaellinas.staging.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 138
at CompiledRazorTemplates.Dynamic.RazorEngine_04e32c99a9fb4e9f9f52e6265520b5fc.<RenderMain>b__150_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Nextech\papaellinas.staging.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 6529
at RazorEngine.Templating.TemplateWriter.ToString()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at CompiledRazorTemplates.Dynamic.RazorEngine_04e32c99a9fb4e9f9f52e6265520b5fc.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Nextech\papaellinas.staging.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 224
at CompiledRazorTemplates.Dynamic.RazorEngine_04e32c99a9fb4e9f9f52e6265520b5fc.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Nextech\papaellinas.staging.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 138
at CompiledRazorTemplates.Dynamic.RazorEngine_04e32c99a9fb4e9f9f52e6265520b5fc.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Nextech\papaellinas.staging.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 246
at CompiledRazorTemplates.Dynamic.RazorEngine_04e32c99a9fb4e9f9f52e6265520b5fc.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Nextech\papaellinas.staging.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 138
at CompiledRazorTemplates.Dynamic.RazorEngine_04e32c99a9fb4e9f9f52e6265520b5fc.Execute() in D:\dynamicweb.net\Solutions\Nextech\papaellinas.staging.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 6508
at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
2
3 @using System.Web;
4 @using Dynamicweb.Frontend
5 @using Dynamicweb.Frontend.Devices
6 @using Dynamicweb.Extensibility
7 @using Dynamicweb.Content
8 @using Dynamicweb.Security
9 @using Dynamicweb.Core
10 @using System
11 @using System.Web
12 @using System.IO
13 @using Dynamicweb.Rapido.Blocks
14 @using System.Net
15
16
17
18 @functions {
19 BlocksPage masterPage = BlocksPage.GetBlockPage("Master");
20
21 string getFontFamily(params string[] items)
22 {
23 var itemParent = Pageview.AreaSettings;
24 foreach (var item in items)
25 {
26 itemParent = itemParent.GetItem(item);
27 if (itemParent == null)
28 {
29 return null;
30 }
31 }
32
33 var googleFont = itemParent.GetGoogleFont("FontFamily");
34 if (googleFont == null)
35 {
36 return null;
37 }
38 return googleFont.Family.Replace(" ", "+");
39 }
40 }
41
42 @{
43 //Font settings
44 var fonts = new string[] {
45 getFontFamily("Layout", "HeaderFont"),
46 getFontFamily("Layout", "SubheaderFont"),
47 getFontFamily("Layout", "TertiaryHeaderFont"),
48 getFontFamily("Layout", "BodyText"),
49 getFontFamily("Layout", "Header", "ToolsFont"),
50 getFontFamily("Layout", "Header", "NavigationFont"),
51 getFontFamily("Layout", "MobileNavigation", "Font"),
52 getFontFamily("ProductList", "Facets", "HeaderFont"),
53 getFontFamily("ProductPage", "PriceFontDesign"),
54 getFontFamily("Ecommerce", "SaleSticker", "Font"),
55 getFontFamily("Ecommerce", "NewSticker", "Font"),
56 getFontFamily("Ecommerce", "CustomSticker", "Font")
57 };
58
59 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks;
60 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png";
61 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro");
62 string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css";
63 if (useFontAwesomePro)
64 {
65 fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css";
66 }
67 }
68
69 @{
70 Block master = new Block()
71 {
72 Id = "Master",
73 BlocksList = new List<Block> {
74 new Block {
75 Id = "MasterTopSnippets",
76 SortId = 10
77 },
78 new Block {
79 Id = "MasterMain",
80 SortId = 20,
81 Template = RenderMain(),
82 SkipRenderBlocksList = true,
83 BlocksList = new List<Block> {
84 new Block {
85 Id = "MasterHeader",
86 SortId = 10,
87 Template = RenderMasterHeader(),
88 SkipRenderBlocksList = true
89 },
90 new Block {
91 Id = "MasterPageContent",
92 SortId = 20,
93 Template = RenderPageContent()
94 }
95 }
96 },
97 new Block {
98 Id = "MasterFooter",
99 SortId = 30
100 },
101 new Block {
102 Id = "MasterReferences",
103 SortId = 40
104 },
105 new Block {
106 Id = "MasterBottomSnippets",
107 SortId = 50
108 }
109 }
110 };
111
112 masterPage.Add(master);
113 }
114
115 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@
116 @using System.Text.RegularExpressions
117 @using System.Collections.Generic
118 @using System.Reflection
119 @using System.Web.UI.HtmlControls
120 @using Dynamicweb.Rapido.Blocks.Components
121 @using Dynamicweb.Rapido.Blocks.Components.Articles
122 @using Dynamicweb.Rapido.Blocks.Components.Documentation
123 @using Dynamicweb.Rapido.Blocks
124
125
126 @*--- START: Base block renderers ---*@
127
128 @helper RenderBlockList(List<Block> blocks)
129 {
130 blocks = blocks.OrderBy(item => item.SortId).ToList();
131
132 foreach (Block item in blocks)
133 {
134 <!-- START: @item.Id -->
135
136 if (item.Design == null)
137 {
138 @RenderBlock(item)
139 }
140 else if (item.Design.RenderType == RenderType.None) {
141 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : "";
142
143 <div class="@cssClass dw-mod">
144 @RenderBlock(item)
145 </div>
146 }
147 else if (item.Design.RenderType != RenderType.Hide)
148 {
149 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : "";
150
151 if (!item.SkipRenderBlocksList) {
152 if (item.Design.RenderType == RenderType.Row)
153 {
154 <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id">
155 @RenderBlock(item)
156 </div>
157 }
158
159 if (item.Design.RenderType == RenderType.Column)
160 {
161 string hidePadding = item.Design.HidePadding ? "u-no-padding" : "";
162 string size = item.Design.Size ?? "12";
163 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size;
164
165 <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">
166 @RenderBlock(item)
167 </div>
168 }
169
170 if (item.Design.RenderType == RenderType.Table)
171 {
172 <table class="table @cssClass dw-mod" id="Block__@item.Id">
173 @RenderBlock(item)
174 </table>
175 }
176
177 if (item.Design.RenderType == RenderType.TableRow)
178 {
179 <tr class="@cssClass dw-mod" id="Block__@item.Id">
180 @RenderBlock(item)
181 </tr>
182 }
183
184 if (item.Design.RenderType == RenderType.TableColumn)
185 {
186 <td class="@cssClass dw-mod" id="Block__@item.Id">
187 @RenderBlock(item)
188 </td>
189 }
190
191 if (item.Design.RenderType == RenderType.CardHeader)
192 {
193 <div class="card-header @cssClass dw-mod">
194 @RenderBlock(item)
195 </div>
196 }
197
198 if (item.Design.RenderType == RenderType.CardBody)
199 {
200 <div class="card @cssClass dw-mod">
201 @RenderBlock(item)
202 </div>
203 }
204
205 if (item.Design.RenderType == RenderType.CardFooter)
206 {
207 <div class="card-footer @cssClass dw-mod">
208 @RenderBlock(item)
209 </div>
210 }
211 }
212 else
213 {
214 @RenderBlock(item)
215 }
216 }
217
218 <!-- END: @item.Id -->
219 }
220 }
221
222 @helper RenderBlock(Block item)
223 {
224 if (item.Template != null)
225 {
226 @BlocksPage.RenderTemplate(item.Template)
227 }
228
229 if (item.Component != null)
230 {
231 string methodName = item.Component.HelperName;
232 dynamic[] methodParameters = new dynamic[1];
233 methodParameters[0] = item.Component;
234 Type methodType = this.GetType();
235 MethodInfo generalMethod = methodType.GetMethod(methodName);
236
237 if (generalMethod != null) {
238 @generalMethod.Invoke(this, methodParameters).ToString();
239 } else {
240 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked");
241 }
242 }
243
244 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList)
245 {
246 @RenderBlockList(item.BlocksList)
247 }
248 }
249
250 @*--- END: Base block renderers ---*@
251
252
253 @* Include the components *@
254 @using Dynamicweb.Rapido.Blocks.Components
255 @using Dynamicweb.Rapido.Blocks.Components.General
256 @using Dynamicweb.Rapido.Blocks
257
258
259 @* Components *@
260 @using System.Reflection
261 @using Dynamicweb.Rapido.Blocks.Components.General
262
263
264 @* Component *@
265
266 @helper RenderIcon(Icon settings) {
267 if (settings != null)
268 {
269 dynamic[] methodParameters = new dynamic[1];
270 methodParameters[0] = settings;
271 MethodInfo customMethod = this.GetType().GetMethod("RenderIconCustom");
272
273 if (customMethod != null)
274 {
275 @customMethod.Invoke(this, methodParameters).ToString();
276 } else {
277 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : "";
278
279 if (settings.Name != null)
280 {
281 if (String.IsNullOrEmpty(settings.Label)) {
282 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i>
283 } else {
284 if (settings.LabelPosition == IconLabelPosition.Before) {
285 <span>@settings.Label <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i></span>
286 } else {
287 <span><i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> @settings.Label</span>
288 }
289 }
290 }
291 }
292 }
293 }
294 @using System.Reflection
295 @using Dynamicweb.Rapido.Blocks.Components.General
296 @using Dynamicweb.Rapido.Blocks.Components
297
298
299 @* Component *@
300
301 @helper RenderButton(Button settings) {
302 dynamic[] methodParameters = new dynamic[1];
303 methodParameters[0] = settings;
304 MethodInfo customMethod = this.GetType().GetMethod("RenderButtonCustom");
305
306 if (customMethod != null)
307 {
308 @customMethod.Invoke(this, methodParameters).ToString();
309 }
310 else
311 {
312 string target;
313 string disabled = settings.Disabled ? "disabled" : "";
314 string buttonType = settings.ButtonType == ButtonType.Submit ? "submit" : "button";
315 buttonType = settings.ButtonType == ButtonType.Reset ? "reset" : buttonType;
316 string buttonLayout = settings.ButtonLayout.ToString().ToLower();
317
318 switch (settings.Target)
319 {
320 case LinkTargetType.Blank:
321 target = "_blank";
322 break;
323 case LinkTargetType.Parent:
324 target = "_parent";
325 break;
326 case LinkTargetType.Self:
327 target = "_self";
328 break;
329 case LinkTargetType.Top:
330 target = "_top";
331 break;
332 default:
333 target = "_self";
334 break;
335 }
336
337 string onClickAction = settings.OnClick != null ? settings.OnClick : "";
338 string noOpener = target == "_blank" ? "rel=\"noopener\"" : "";
339
340 if (!String.IsNullOrEmpty(settings.ConfirmText))
341 {
342 string modalId = settings.Id;
343 @RenderConfirmDialog(settings);
344 onClickAction = "document.getElementById('" + modalId + "ModalTrigger').checked = true";
345 }
346
347 if (settings.Icon != null)
348 {
349 if (settings.IconPosition == null) {
350 settings.Icon.LabelPosition = IconLabelPosition.After;
351 } else {
352 settings.Icon.LabelPosition = settings.IconPosition == IconPosition.Before ? IconLabelPosition.After : IconLabelPosition.Before;
353 }
354 if (settings.Icon.Label == null) {
355 settings.Icon.Label = settings.Title;
356 }
357 }
358 string content = settings.Icon == null ? settings.Title : Convert.ToString(RenderIcon(settings.Icon));
359
360 if (!String.IsNullOrEmpty(settings.Link) && String.IsNullOrEmpty(settings.ConfirmText))
361 {
362 <a href="@settings.Link" target="@target" @noOpener class="btn btn--@buttonLayout @settings.CssClass @disabled dw-mod" onclick="@onClickAction" @ComponentMethods.AddAttributes(settings.ExtraAttributes) @disabled>@content</a>
363 }
364 else
365 {
366 <button type="@buttonType" class="btn btn--@buttonLayout @settings.CssClass @disabled dw-mod" onclick="@onClickAction" @ComponentMethods.AddAttributes(settings.ExtraAttributes) @disabled>@content</button>
367 }
368 }
369 }
370
371
372 @helper RenderConfirmDialog(Button settings) {
373 dynamic[] methodParameters = new dynamic[1];
374 methodParameters[0] = settings;
375 MethodInfo customMethod = this.GetType().GetMethod("RenderConfirmDialogCustom");
376
377 if (customMethod != null)
378 {
379 @customMethod.Invoke(this, methodParameters).ToString();
380 } else {
381 string modalTriggerId = settings.Id + "ModalTrigger";
382
383 <!-- Trigger for the confirm modal -->
384 <input type="checkbox" id="@modalTriggerId" class="modal-trigger" />
385
386 <!-- Login modal -->
387 <div class="modal-container">
388 <label for="@modalTriggerId" class="modal-overlay"></label>
389 <div class="modal modal--xs">
390 <div class="modal__header">
391 <h2>@settings.ConfirmText</h2>
392 </div>
393 <div class="modal__body">
394 @RenderButton(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = settings.OnClick, CssClass = "u-full-width", Link = settings.Link })
395 </div>
396 </div>
397 </div>
398 }
399 }
400 @using System.Reflection
401 @using Dynamicweb.Rapido.Blocks.Components
402 @using Dynamicweb.Rapido.Blocks.Components.General
403 @using Dynamicweb.Rapido.Blocks
404
405
406 @* Component *@
407
408 @helper RenderRating(Rating settings)
409 {
410 dynamic[] methodParameters = new dynamic[1];
411 methodParameters[0] = settings;
412 MethodInfo customMethod = this.GetType().GetMethod("RenderRatingCustom");
413
414 if (customMethod != null)
415 {
416 @customMethod.Invoke(this, methodParameters).ToString();
417 } else {
418 if (settings.Score > 0)
419 {
420 int rating = settings.Score;
421 string iconType = "fa-star";
422
423 switch (settings.Type.ToString()) {
424 case "Stars":
425 iconType = "fa-star";
426 break;
427 case "Hearts":
428 iconType = "fa-heart";
429 break;
430 case "Lemons":
431 iconType = "fa-lemon";
432 break;
433 case "Bombs":
434 iconType = "fa-bomb";
435 break;
436 }
437
438 <div class="u-ta-right">
439 @for (int i = 0; i < settings.OutOf; i++)
440 {
441 <i class="@(rating > i ? "fas" : "far") @iconType"></i>
442 }
443 </div>
444 }
445 }
446 }
447 @using System.Reflection
448 @using Dynamicweb.Rapido.Blocks.Components.General
449 @using Dynamicweb.Rapido.Blocks.Components
450
451
452 @* Component *@
453
454 @helper RenderFieldListOption(FieldListOption settings) {
455 dynamic[] methodParameters = new dynamic[1];
456 methodParameters[0] = settings;
457 MethodInfo customMethod = this.GetType().GetMethod("RenderFieldListOptionCustom");
458
459 if (customMethod != null)
460 {
461 @customMethod.Invoke(this, methodParameters).ToString();
462 } else {
463 string disabled = settings.Disabled ? "disabled" : "";
464 string selected = settings.Checked ? "checked" : "";
465
466 if (settings.Type.ToString() == "RadioButton")
467 {
468 <input class="form__control @disabled dw-mod" onchange="@settings.OnChange" onclick="@settings.OnClick" type="radio" name="@settings.Name" id="@settings.Id" value="@settings.Value" @selected @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes) />
469 <label for="@settings.Id" class="u-inline @disabled dw-mod">@settings.Label</label>
470 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage })
471 }
472
473 if (settings.Type.ToString() == "Checkbox")
474 {
475 @RenderCheckboxField(settings)
476 }
477
478 if (settings.Type.ToString() == "SelectOption")
479 {
480 <option value="@settings.Value" id="@settings.Id" onclick="@settings.OnClick" class="@disabled" @disabled @selected @ComponentMethods.AddAttributes(settings.ExtraAttributes) >@settings.Name</option>
481 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage })
482 }
483 }
484 }
485
486 @using System.Reflection
487 @using Dynamicweb.Rapido.Blocks.Components.General
488 @using Dynamicweb.Rapido.Blocks.Components
489
490
491 @* Component *@
492
493 @helper RenderNavigation(Navigation settings) {
494 dynamic[] methodParameters = new dynamic[1];
495 methodParameters[0] = settings;
496 MethodInfo customMethod = this.GetType().GetMethod("RenderNavigationCustom");
497
498 if (customMethod != null)
499 {
500 @customMethod.Invoke(this, methodParameters).ToString();
501 } else {
502 @RenderNavigation(new
503 {
504 id = settings.Id,
505 cssclass = settings.CssClass,
506 startLevel = settings.StartLevel,
507 endlevel = settings.EndLevel,
508 expandmode = settings.Expandmode,
509 template = settings.Template
510 })
511 }
512 }
513 @using System.Reflection
514 @using Dynamicweb.Rapido.Blocks.Components.General
515 @using Dynamicweb.Rapido.Blocks.Components
516
517
518 @* Component *@
519
520 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) {
521 dynamic[] methodParameters = new dynamic[1];
522 methodParameters[0] = settings;
523 MethodInfo customMethod = this.GetType().GetMethod("RenderBreadcrumbNavigationCustom");
524
525 if (customMethod != null)
526 {
527 @customMethod.Invoke(this, methodParameters).ToString();
528 } else {
529 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id;
530 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template;
531 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel;
532 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel;
533 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode;
534
535 @RenderNavigation(settings)
536 }
537 }
538 @using System.Reflection
539 @using Dynamicweb.Rapido.Blocks.Components.General
540
541
542 @* Component *@
543
544 @helper RenderHeading(Heading settings) {
545 dynamic[] methodParameters = new dynamic[1];
546 methodParameters[0] = settings;
547 MethodInfo customMethod = this.GetType().GetMethod("RenderHeadingCustom");
548
549 if (customMethod != null)
550 {
551 @customMethod.Invoke(this, methodParameters).ToString();
552 } else {
553 string startTag = "<h" + settings.Level.ToString() + " class=\"" + settings.CssClass + "\">";
554 string endTag = "</h" + settings.Level.ToString() + "\">";
555
556 if (settings.Icon != null)
557 {
558 if (settings.IconPosition == null) {
559 settings.Icon.LabelPosition = IconLabelPosition.After;
560 } else {
561 settings.Icon.LabelPosition = settings.IconPosition == IconPosition.Before ? IconLabelPosition.After : IconLabelPosition.Before;
562 }
563 if (settings.Icon.Label == null) {
564 settings.Icon.Label = settings.Title;
565 }
566
567 @startTag@RenderIcon(settings.Icon)@endTag
568 } else {
569 @startTag@settings.Title@endTag
570 }
571 }
572 }
573 @using System.Reflection
574 @using Dynamicweb.Rapido.Blocks.Components
575 @using Dynamicweb.Rapido.Blocks.Components.General
576 @using Dynamicweb.Rapido.Blocks
577
578
579 @* Component *@
580
581 @helper RenderImage(Image settings)
582 {
583 if (settings.Path != null)
584 {
585 dynamic[] methodParameters = new dynamic[1];
586 methodParameters[0] = settings;
587 MethodInfo customMethod = this.GetType().GetMethod("RenderImageCustom");
588
589 if (customMethod != null)
590 {
591 @customMethod.Invoke(this, methodParameters).ToString();
592 } else {
593 <div>
594 @if (settings.Link != null)
595 {
596 <a href="@settings.Link">
597 @RenderTheImage(settings);
598 </a>
599 }
600 else
601 {
602 @RenderTheImage(settings);
603 }
604 </div>
605 }
606 }
607 }
608
609 @functions {
610 string getImagePathFromSettings(ImageSettings settings)
611 {
612 string result = "";
613
614 if (settings != null)
615 {
616 result += settings.Width != 0 ? "Width=" + settings.Width + "&" : "";
617 result += settings.Height != 0 ? "Height=" + settings.Height + "&" : "";
618 result += "Crop=" + settings.Crop + "&";
619 result += "Compression=" + settings.Compression + "&";
620 result += "DoNotUpscale=" + settings.DoNotUpscale.ToString() + "&";
621 result += "FillCanvas=" + settings.FillCanvas.ToString() + "&";
622 }
623
624 return result;
625 }
626 }
627
628 @helper RenderTheImage(Image settings)
629 {
630 if (settings != null)
631 {
632 dynamic[] methodParameters = new dynamic[1];
633 methodParameters[0] = settings;
634 MethodInfo customMethod = this.GetType().GetMethod("RenderTheImageCustom");
635
636 if (customMethod != null)
637 {
638 @customMethod.Invoke(this, methodParameters).ToString();
639 } else {
640 string placeholderImage = "/Files/Images/placeholder.gif";
641 string imageEngine = "/Admin/Public/GetImage.ashx?";
642
643 string imageStyle = "";
644
645 switch (settings.Style)
646 {
647 case ImageStyle.Ball:
648 imageStyle = "grid__cell-img--ball";
649 break;
650 }
651
652 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle)
653 {
654 if (settings.ImageDefault != null)
655 {
656 settings.ImageDefault.Height = settings.ImageDefault.Width;
657 }
658 if (settings.ImageMedium != null)
659 {
660 settings.ImageMedium.Height = settings.ImageMedium.Width;
661 }
662 if (settings.ImageSmall != null)
663 {
664 settings.ImageSmall.Height = settings.ImageSmall.Width;
665 }
666 }
667
668 string defaultImage = imageEngine;
669 string imageSmall = "";
670 string imageMedium = "";
671
672 if (settings.DisableImageEngine) {
673 defaultImage = settings.Path;
674 } else {
675 if (settings.ImageDefault != null)
676 {
677 defaultImage += getImagePathFromSettings(settings.ImageDefault);
678
679 if (settings.Path.GetType() != typeof(string))
680 {
681 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
682 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
683 }
684 else
685 {
686 defaultImage += settings.Path != null ? "Image=" + settings.Path : "";
687 }
688 }
689
690 if (settings.ImageSmall != null)
691 {
692 imageSmall = "data-src-small=\"" + imageEngine;
693 imageSmall += getImagePathFromSettings(settings.ImageSmall);
694
695 if (settings.Path.GetType() != typeof(string))
696 {
697 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
698 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
699 }
700 else
701 {
702 imageSmall += settings.Path != null ? "Image=" + settings.Path : "";
703 }
704
705 imageSmall += "\"";
706 }
707
708 if (settings.ImageMedium != null)
709 {
710 imageMedium = "data-src-medium=\"" + imageEngine;
711 imageMedium += getImagePathFromSettings(settings.ImageMedium);
712
713 if (settings.Path.GetType() != typeof(string))
714 {
715 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
716 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
717 }
718 else
719 {
720 imageMedium += settings.Path != null ? "Image=" + settings.Path : "";
721 }
722
723 imageMedium += "\"";
724 }
725 }
726
727 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>();
728 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); }
729 if (!String.IsNullOrEmpty(settings.Title)) { optionalAttributes.Add("alt", settings.Title); }
730
731 if (settings.DisableLazyLoad) {
732 <img class="grid__cell-img @imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) />
733 } else {
734 <img class="grid__cell-img b-lazy @imageStyle @settings.CssClass dw-mod" src="@placeholderImage" data-src="@defaultImage" @imageSmall @imageMedium @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) />
735 }
736
737 if (settings.Caption != null)
738 {
739 <span class="image-caption dw-mod">@settings.Caption</span>
740 }
741 }
742 }
743 }
744 @using System.Reflection
745 @using Dynamicweb.Rapido.Blocks.Components.General
746 @using Dynamicweb.Rapido.Blocks.Components
747
748
749 @* Component *@
750
751 @helper RenderTextField(TextField settings) {
752 dynamic[] methodParameters = new dynamic[1];
753 methodParameters[0] = settings;
754 MethodInfo customMethod = this.GetType().GetMethod("RenderTextFieldCustom");
755
756 if (customMethod != null)
757 {
758 @customMethod.Invoke(this, methodParameters).ToString();
759 } else {
760 int maxLength = settings.MaxLength != 0 ? settings.MaxLength : 524288;
761 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>();
762 if (settings.Type == TextFieldType.Password) { optionalAttributes.Add("autocomplete", "off"); };
763 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); }
764 if (!String.IsNullOrEmpty(settings.Placeholder)) { optionalAttributes.Add("placeholder", settings.Placeholder); }
765 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); }
766 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); }
767 if (settings.MaxLength != 0) { optionalAttributes.Add("maxlength", settings.MaxLength.ToString()); }
768
769 <div class="form__field-group dw-mod">
770 @if (!String.IsNullOrEmpty(settings.Label))
771 {
772 <label for="@settings.Id">@settings.Label</label>
773 }
774
775 <input type="@settings.Type" class="u-full-width @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) />
776
777 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage })
778 </div>
779 }
780 }
781 @using System.Reflection
782 @using Dynamicweb.Rapido.Blocks.Components.General
783 @using Dynamicweb.Rapido.Blocks.Components
784
785
786 @* Component *@
787
788 @helper RenderNumberField(NumberField settings) {
789 dynamic[] methodParameters = new dynamic[1];
790 methodParameters[0] = settings;
791 MethodInfo customMethod = this.GetType().GetMethod("RenderNumberFieldCustom");
792
793 if (customMethod != null)
794 {
795 @customMethod.Invoke(this, methodParameters).ToString();
796 } else {
797 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>();
798 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); }
799 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); }
800 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); }
801 if (settings.Max != 0) { optionalAttributes.Add("max", settings.Max.ToString()); }
802 if (settings.Min != 0) { optionalAttributes.Add("min", settings.Min.ToString()); }
803 if (settings.Step != 0) { optionalAttributes.Add("step", settings.Step.ToString()); }
804
805 <div class="form__field-group dw-mod">
806 @if (!String.IsNullOrEmpty(settings.Label))
807 {
808 <div>
809 <label for="@settings.Id">@settings.Label</label>
810 </div>
811 }
812
813 <input type="Number" class="u-w70px @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) />
814
815 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage })
816 </div>
817 }
818 }
819 @using System.Reflection
820 @using Dynamicweb.Rapido.Blocks.Components.General
821 @using Dynamicweb.Rapido.Blocks.Components
822
823
824 @* Component *@
825
826 @helper RenderTextareaField(TextareaField settings) {
827 dynamic[] methodParameters = new dynamic[1];
828 methodParameters[0] = settings;
829 MethodInfo customMethod = this.GetType().GetMethod("RenderTextareaFieldCustom");
830
831 if (customMethod != null)
832 {
833 @customMethod.Invoke(this, methodParameters).ToString();
834 } else {
835 int maxLength = settings.MaxLength != 0 ? settings.MaxLength : 524288;
836 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>();
837 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); }
838 if (!String.IsNullOrEmpty(settings.Placeholder)) { optionalAttributes.Add("placeholder", settings.Placeholder); }
839 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); }
840 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); }
841 if (settings.MaxLength != 0) { optionalAttributes.Add("maxlength", settings.MaxLength.ToString()); }
842 if (settings.Rows != 0) { optionalAttributes.Add("rows", settings.Rows.ToString()); }
843
844 <div class="form__field-group dw-mod">
845 @if (!String.IsNullOrEmpty(@settings.Label))
846 {
847 <label for="@settings.Id">@settings.Label</label>
848 }
849
850 <textarea class="u-full-width @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)></textarea>
851
852 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage })
853 </div>
854 }
855 }
856 @using System.Reflection
857 @using Dynamicweb.Rapido.Blocks.Components.General
858 @using Dynamicweb.Rapido.Blocks.Components
859
860
861 @* Component *@
862
863 @helper RenderHiddenField(HiddenField settings) {
864 dynamic[] methodParameters = new dynamic[1];
865 methodParameters[0] = settings;
866 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom");
867
868 if (customMethod != null)
869 {
870 @customMethod.Invoke(this, methodParameters).ToString();
871 } else {
872 <input type="hidden" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(settings.ExtraAttributes)/>
873 }
874 }
875 @using System.Reflection
876 @using Dynamicweb.Rapido.Blocks.Components.General
877 @using Dynamicweb.Rapido.Blocks.Components
878
879
880 @* Component *@
881
882 @helper RenderCheckboxField(dynamic settings) {
883 dynamic[] methodParameters = new dynamic[1];
884 methodParameters[0] = settings;
885 MethodInfo customMethod = this.GetType().GetMethod("RenderCheckboxFieldCustom");
886
887 if (customMethod != null)
888 {
889 @customMethod.Invoke(this, methodParameters).ToString();
890 } else {
891 settings.Type = FieldListOptionType.Checkbox;
892 string disabled = settings.Disabled ? "disabled" : "";
893 string required = settings.Required ? "required" : "";
894 string checkedString = settings.Checked == true ? "checked" : "";
895 string id = settings.Id != null ? settings.Id : settings.Label.Replace(" ", "");
896
897 <div class="form__field-group dw-mod">
898 <input type="checkbox" class="form__control @settings.CssClass @disabled dw-mod" name="@settings.Name" id="@id" value="@settings.Value" onclick="@settings.OnClick" @disabled @required @checkedString @ComponentMethods.AddAttributes(settings.ExtraAttributes) />
899
900 @if (!String.IsNullOrEmpty(settings.Label))
901 {
902 <label for="@id" class="@disabled dw-mod">@settings.Label</label>
903 }
904
905 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage })
906 </div>
907 }
908 }
909 @using System.Reflection
910 @using Dynamicweb.Rapido.Blocks.Components.General
911 @using Dynamicweb.Rapido.Blocks.Components
912
913
914 @* Component *@
915
916 @helper RenderCheckboxListField(CheckboxListField settings) {
917 dynamic[] methodParameters = new dynamic[1];
918 methodParameters[0] = settings;
919 MethodInfo customMethod = this.GetType().GetMethod("RenderCheckboxListFieldCustom");
920
921 if (customMethod != null)
922 {
923 @customMethod.Invoke(this, methodParameters).ToString();
924 } else {
925 string disabled = settings.Disabled ? "disabled" : "";
926
927 <div class="form__field-group @settings.CssClass u-margin-bottom @disabled dw-mod" @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
928 @if (!String.IsNullOrEmpty(settings.Label))
929 {
930 <div class="u-bold u-margin-bottom">@settings.Label</div>
931 }
932
933 @foreach (var item in settings.Options)
934 {
935 item.Type = FieldListOptionType.Checkbox;
936 @RenderFieldListOption(item)
937 }
938
939 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage })
940 </div>
941 }
942 }
943
944 @using System.Reflection
945 @using Dynamicweb.Rapido.Blocks.Components.General
946 @using Dynamicweb.Rapido.Blocks.Components
947
948
949 @* Component *@
950
951 @helper RenderSelectField(SelectField settings) {
952 dynamic[] methodParameters = new dynamic[1];
953 methodParameters[0] = settings;
954 MethodInfo customMethod = this.GetType().GetMethod("RenderSelectFieldCustom");
955
956 if (customMethod != null)
957 {
958 @customMethod.Invoke(this, methodParameters).ToString();
959 } else {
960 string disabled = settings.Disabled ? "disabled" : "";
961 string required = settings.Required ? "required" : "";
962
963 if (settings.Default != null)
964 {
965 settings.Default.Type = FieldListOptionType.SelectOption;
966 }
967
968 <div class="form__field-group u-full-width dw-mod">
969 @if (!String.IsNullOrEmpty(settings.Label))
970 {
971 <label for="@settings.Id">@settings.Label</label>
972 }
973
974 <div class="form__field-combi u-no-margin dw-mod">
975 <select id="@settings.Id" class="u-full-width @settings.CssClass dw-mod" onchange="@settings.OnChange" @ComponentMethods.AddAttributes(settings.ExtraAttributes) >
976 @if (settings.Default.Value != null)
977 {
978 @RenderFieldListOption(settings.Default)
979 }
980
981 @foreach (var item in settings.Options)
982 {
983 item.Type = FieldListOptionType.SelectOption;
984 @RenderFieldListOption(item)
985 }
986 </select>
987 @if (settings.ActionButton.Link != null || settings.ActionButton.OnClick != null) {
988 settings.ActionButton.CssClass += " btn--condensed u-no-margin";
989 @RenderButton(settings.ActionButton);
990 }
991 </div>
992
993 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage })
994 </div>
995 }
996 }
997 @using System.Reflection
998 @using Dynamicweb.Rapido.Blocks.Components.General
999 @using Dynamicweb.Rapido.Blocks.Components
1000
1001
1002 @* Component *@
1003
1004 @helper RenderRadioButtonField(RadioButtonField settings) {
1005 dynamic[] methodParameters = new dynamic[1];
1006 methodParameters[0] = settings;
1007 MethodInfo customMethod = this.GetType().GetMethod("RenderRadioButtonFieldCustom");
1008
1009 if (customMethod != null)
1010 {
1011 @customMethod.Invoke(this, methodParameters).ToString();
1012 } else {
1013 string disabled = settings.Disabled ? "disabled" : "";
1014
1015 <div class="form__field-group @settings.CssClass u-margin-bottom @disabled" @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1016 @if (!String.IsNullOrEmpty(settings.Label))
1017 {
1018 <div class="u-bold u-margin-bottom">@settings.Label</div>
1019 }
1020
1021 @foreach (var item in settings.Options)
1022 {
1023 item.Type = FieldListOptionType.RadioButton;
1024
1025 if (settings.Name != null)
1026 {
1027 item.Name = settings.Name;
1028 }
1029
1030 if (settings.RenderOptionsInline)
1031 {
1032 @RenderFieldListOption(item)
1033 }
1034 else
1035 {
1036 <div>
1037 @RenderFieldListOption(item)
1038 </div>
1039 }
1040 }
1041
1042 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage })
1043 </div>
1044 }
1045 }
1046 @using System.Reflection
1047 @using Dynamicweb.Rapido.Blocks.Components.General
1048 @using Dynamicweb.Rapido.Blocks.Components
1049
1050
1051 @* Component *@
1052
1053 @helper RenderNotificationMessage(NotificationMessage settings) {
1054 dynamic[] methodParameters = new dynamic[1];
1055 methodParameters[0] = settings;
1056 MethodInfo customMethod = this.GetType().GetMethod("RenderNotificationMessageCustom");
1057
1058 if (customMethod != null)
1059 {
1060 @customMethod.Invoke(this, methodParameters).ToString();
1061 } else {
1062 if (!String.IsNullOrEmpty(settings.Message))
1063 {
1064 string messageTypeClass = settings.MessageType.ToString().ToLower();
1065 <div class="field-@messageTypeClass @settings.CssClass u-full-width dw-mod">@settings.Message</div>
1066 }
1067 }
1068 }
1069 @using System.Reflection
1070 @using Dynamicweb.Rapido.Blocks.Components.General
1071
1072
1073 @* Component *@
1074
1075 @helper RenderHandlebarsRoot(HandlebarsRoot settings) {
1076 dynamic[] methodParameters = new dynamic[1];
1077 methodParameters[0] = settings;
1078 MethodInfo customMethod = this.GetType().GetMethod("RenderHandlebarsRootCustom");
1079
1080 if (customMethod != null)
1081 {
1082 @customMethod.Invoke(this, methodParameters).ToString();
1083 } else {
1084 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : "";
1085
1086 <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>
1087 @if (settings.SubBlocks != null) {
1088 @RenderBlockList(settings.SubBlocks)
1089 }
1090 </div>
1091 }
1092 }
1093 @using System.Reflection
1094 @using Dynamicweb.Rapido.Blocks.Components.General
1095 @using Dynamicweb.Rapido.Blocks.Components
1096 @using System.Text.RegularExpressions
1097
1098
1099 @* Component *@
1100
1101 @helper RenderSticker(Sticker settings) {
1102 dynamic[] methodParameters = new dynamic[1];
1103 methodParameters[0] = settings;
1104 MethodInfo customMethod = this.GetType().GetMethod("RenderStickerCustom");
1105
1106 if (customMethod != null)
1107 {
1108 @customMethod.Invoke(this, methodParameters).ToString();
1109 }
1110 else
1111 {
1112 if (!String.IsNullOrEmpty(settings.Title)) {
1113 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : "";
1114 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : "";
1115
1116 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>();
1117 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) {
1118 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : "";
1119 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : "";
1120 optionalAttributes.Add("style", styleTag);
1121 }
1122
1123 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div>
1124 }
1125 }
1126 }
1127
1128 @using System.Reflection
1129 @using Dynamicweb.Rapido.Blocks.Components.General
1130 @using Dynamicweb.Rapido.Blocks.Components
1131
1132
1133 @* Component *@
1134
1135 @helper RenderStickersCollection(StickersCollection settings) {
1136 dynamic[] methodParameters = new dynamic[1];
1137 methodParameters[0] = settings;
1138 MethodInfo customMethod = this.GetType().GetMethod("RenderStickersCollectionCustom");
1139
1140 if (customMethod != null)
1141 {
1142 @customMethod.Invoke(this, methodParameters).ToString();
1143 }
1144 else
1145 {
1146 if (settings.Stickers.Count > 0) {
1147 string position = settings.Position != null ? "" + "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower() : "";
1148
1149 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1150 @foreach (Sticker sticker in settings.Stickers)
1151 {
1152 @RenderSticker(sticker)
1153 }
1154 </div>
1155 }
1156 }
1157 }
1158
1159 @using System.Reflection
1160 @using Dynamicweb.Rapido.Blocks.Components.General
1161 @using Dynamicweb.Rapido.Blocks.Components
1162
1163
1164
1165 @* Component *@
1166
1167 @helper RenderField(Field settings) {
1168 dynamic[] methodParameters = new dynamic[1];
1169 methodParameters[0] = settings;
1170 MethodInfo customMethod = this.GetType().GetMethod("RenderFieldCustom");
1171
1172 if (customMethod != null)
1173 {
1174 @customMethod.Invoke(this, methodParameters).ToString();
1175 } else {
1176 switch (settings.FieldType)
1177 {
1178 case FieldType.Checkbox:
1179 CheckboxField checkbox = new CheckboxField
1180 {
1181 Label = settings.Label,
1182 Id = settings.Id,
1183 Name = settings.Label.Replace(" ", ""),
1184 Value = settings.Value,
1185 Checked = Convert.ToBoolean(settings.Placeholder),
1186 OnClick = settings.OnClick,
1187 Disabled = settings.Disabled,
1188 Required = settings.Required,
1189 CssClass = settings.CssClass,
1190 ExtraAttributes = settings.ExtraAttributes,
1191 ErrorMessage = settings.ErrorMessage
1192 };
1193
1194 @RenderCheckboxField(checkbox)
1195 break;
1196 case FieldType.Email:
1197 TextField emailField = new TextField
1198 {
1199 Label = settings.Label != null ? settings.Label : Translate("Email"),
1200 Id = settings.Id,
1201 Value = settings.Value,
1202 OnClick = settings.OnClick,
1203 Disabled = settings.Disabled,
1204 Required = settings.Required,
1205 CssClass = settings.CssClass,
1206 ExtraAttributes = settings.ExtraAttributes,
1207 ErrorMessage = settings.ErrorMessage,
1208 Placeholder = settings.Placeholder,
1209 Type = TextFieldType.Email
1210 };
1211
1212 @RenderTextField(emailField)
1213 break;
1214 case FieldType.Hidden:
1215 HiddenField hiddenField = new HiddenField
1216 {
1217 Label = settings.Label,
1218 Id = settings.Id,
1219 Value = settings.Value,
1220 Disabled = settings.Disabled,
1221 Required = settings.Required,
1222 CssClass = settings.CssClass,
1223 ExtraAttributes = settings.ExtraAttributes,
1224 ErrorMessage = settings.ErrorMessage
1225 };
1226
1227 @RenderHiddenField(hiddenField)
1228 break;
1229 case FieldType.Integer:
1230 NumberField numberField = new NumberField
1231 {
1232 Label = settings.Label,
1233 Id = settings.Id,
1234 Value = settings.Value.GetType() == typeof(int) ? Convert.ToInt32(settings.Value) : 1,
1235 OnClick = settings.OnClick,
1236 Disabled = settings.Disabled,
1237 Required = settings.Required,
1238 CssClass = settings.CssClass,
1239 ExtraAttributes = settings.ExtraAttributes,
1240 ErrorMessage = settings.ErrorMessage,
1241 Step = 1
1242 };
1243
1244 @RenderNumberField(numberField)
1245 break;
1246 case FieldType.Password:
1247 TextField passwordField = new TextField
1248 {
1249 Label = settings.Label != null ? settings.Label : Translate("Password"),
1250 Id = settings.Id,
1251 Value = settings.Value,
1252 OnClick = settings.OnClick,
1253 Disabled = settings.Disabled,
1254 Required = settings.Required,
1255 CssClass = settings.CssClass,
1256 ExtraAttributes = settings.ExtraAttributes,
1257 ErrorMessage = settings.ErrorMessage,
1258 Placeholder = settings.Placeholder,
1259 Type = TextFieldType.Password
1260 };
1261
1262 @RenderTextField(passwordField)
1263 break;
1264 case FieldType.Reset:
1265 Button resetField = new Button
1266 {
1267 Title = settings.Label != null ? settings.Label : Translate("Reset"),
1268 Id = settings.Id,
1269 OnClick = settings.OnClick,
1270 Disabled = settings.Disabled,
1271 CssClass = settings.CssClass,
1272 ExtraAttributes = settings.ExtraAttributes,
1273 ButtonLayout = ButtonLayout.Secondary,
1274 ButtonType = ButtonType.Reset
1275 };
1276
1277 @RenderButton(resetField)
1278 break;
1279 case FieldType.Submit:
1280 Button submitField = new Button
1281 {
1282 Title = settings.Label != null ? settings.Label : Translate("Submit"),
1283 Id = settings.Id,
1284 OnClick = settings.OnClick,
1285 Disabled = settings.Disabled,
1286 CssClass = settings.CssClass,
1287 ExtraAttributes = settings.ExtraAttributes,
1288 ButtonLayout = ButtonLayout.Primary,
1289 ButtonType = ButtonType.Submit
1290 };
1291
1292 @RenderButton(submitField)
1293 break;
1294 case FieldType.Tel:
1295 TextField telField = new TextField
1296 {
1297 Label = settings.Label != null ? settings.Label : Translate("Phone"),
1298 Id = settings.Id,
1299 Value = settings.Value,
1300 OnClick = settings.OnClick,
1301 Disabled = settings.Disabled,
1302 Required = settings.Required,
1303 CssClass = settings.CssClass,
1304 ExtraAttributes = settings.ExtraAttributes,
1305 ErrorMessage = settings.ErrorMessage,
1306 Placeholder = settings.Placeholder,
1307 Type = TextFieldType.Tel
1308 };
1309
1310 @RenderTextField(telField)
1311 break;
1312 case FieldType.Text:
1313 TextField textField = new TextField
1314 {
1315 Label = settings.Label,
1316 Id = settings.Id,
1317 Value = settings.Value,
1318 OnClick = settings.OnClick,
1319 Disabled = settings.Disabled,
1320 Required = settings.Required,
1321 CssClass = settings.CssClass,
1322 ExtraAttributes = settings.ExtraAttributes,
1323 ErrorMessage = settings.ErrorMessage,
1324 Placeholder = settings.Placeholder,
1325 Type = TextFieldType.Text
1326 };
1327
1328 @RenderTextField(textField)
1329 break;
1330 case FieldType.Textarea:
1331 TextareaField textareaField = new TextareaField
1332 {
1333 Label = settings.Label,
1334 Id = settings.Id,
1335 Value = settings.Value,
1336 OnClick = settings.OnClick,
1337 Disabled = settings.Disabled,
1338 Required = settings.Required,
1339 CssClass = settings.CssClass,
1340 ExtraAttributes = settings.ExtraAttributes,
1341 ErrorMessage = settings.ErrorMessage,
1342 Placeholder = settings.Placeholder
1343 };
1344
1345 @RenderTextareaField(textareaField)
1346 break;
1347 default:
1348 TextField defaultField = new TextField
1349 {
1350 Label = settings.Label,
1351 Id = settings.Id,
1352 Value = settings.Value,
1353 OnClick = settings.OnClick,
1354 Disabled = settings.Disabled,
1355 Required = settings.Required,
1356 CssClass = settings.CssClass,
1357 ExtraAttributes = settings.ExtraAttributes,
1358 ErrorMessage = settings.ErrorMessage,
1359 Placeholder = settings.Placeholder,
1360 Type = TextFieldType.Text
1361 };
1362
1363 @RenderTextField(defaultField)
1364 break;
1365 }
1366 }
1367 }
1368
1369
1370 @using Dynamicweb.Frontend
1371 @using System.Reflection
1372 @using Dynamicweb.Content.Items
1373 @using System.Web.UI.HtmlControls
1374 @using Dynamicweb.Rapido.Blocks.Components
1375 @using Dynamicweb.Rapido.Blocks
1376
1377
1378 @* Components for the articles *@
1379 @using System.Reflection
1380 @using Dynamicweb.Rapido.Blocks.Components.Articles
1381
1382
1383 @* Component for the articles *@
1384
1385 @helper RenderArticleBanner(dynamic settings) {
1386 dynamic[] methodParameters = new dynamic[1];
1387 methodParameters[0] = settings;
1388 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerCustom");
1389
1390 if (customMethod != null)
1391 {
1392 @customMethod.Invoke(this, methodParameters).ToString();
1393 } else {
1394 string filterClasses = "image-filter image-filter--darken";
1395 settings.Layout = ArticleHeaderLayout.Banner;
1396
1397 if (settings.Image != null)
1398 {
1399 if (settings.Image.Path != null)
1400 {
1401 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width">
1402 <div class="background-image @filterClasses dw-mod">
1403 <div class="background-image__wrapper @filterClasses dw-mod">
1404 @{
1405 settings.Image.CssClass += "background-image__cover dw-mod";
1406 }
1407 @RenderImage(settings.Image)
1408 </div>
1409 </div>
1410 <div class="center-container dw-mod">
1411 <div class="grid">
1412 <div class="grid__col-md-8 grid__col-xs-12 paragraph-container paragraph-container--height-lg">
1413 <div class="u-left-middle">
1414 <div>
1415 @if (!String.IsNullOrEmpty(settings.Heading))
1416 {
1417 <h1 class="article__header article__header--giant dw-mod" style="color: @settings.TextColor">@settings.Heading</h1>
1418 }
1419 @if (!String.IsNullOrEmpty(settings.Subheading))
1420 {
1421 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div>
1422 }
1423 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
1424 {
1425 <small class="article__post-info u-margin-bottom--lg dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small>
1426 }
1427 @if (!String.IsNullOrEmpty(settings.Link)) {
1428 <div class="grid__cell">
1429 @RenderButton(new Button { Link= settings.Link, Title= settings.LinkText, ButtonLayout= settings.ButtonLayout })
1430 </div>
1431 }
1432 </div>
1433 </div>
1434 </div>
1435 @if (settings.ExternalParagraphId != 0)
1436 {
1437 <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod">
1438 <div class="u-color-light-gray--bg u-color-dark dw-mod">
1439 @RenderParagraphContent(settings.ExternalParagraphId)
1440 </div>
1441 </div>
1442 }
1443 </div>
1444 </div>
1445 </section>
1446 }
1447 else
1448 {
1449 settings.Layout = ArticleHeaderLayout.Clean;
1450 @RenderArticleCleanHeader(settings);
1451 }
1452 }
1453 else
1454 {
1455 settings.Layout = ArticleHeaderLayout.Clean;
1456 @RenderArticleCleanHeader(settings);
1457 }
1458 }
1459 }
1460 @using System.Reflection
1461 @using Dynamicweb.Rapido.Blocks.Components
1462 @using Dynamicweb.Rapido.Blocks.Components.General
1463 @using Dynamicweb.Rapido.Blocks.Components.Articles
1464 @using Dynamicweb.Rapido.Blocks
1465
1466
1467 @* Component for the articles *@
1468
1469 @helper RenderArticleHeader(ArticleHeader settings) {
1470 dynamic[] methodParameters = new dynamic[1];
1471 methodParameters[0] = settings;
1472 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleHeaderCustom");
1473
1474 if (customMethod != null)
1475 {
1476 @customMethod.Invoke(this, methodParameters).ToString();
1477 } else {
1478 switch (settings.Layout)
1479 {
1480 case ArticleHeaderLayout.Clean:
1481 @RenderArticleCleanHeader(settings);
1482 break;
1483 case ArticleHeaderLayout.Split:
1484 @RenderArticleSplitHeader(settings);
1485 break;
1486 case ArticleHeaderLayout.Banner:
1487 @RenderArticleBannerHeader(settings);
1488 break;
1489 case ArticleHeaderLayout.Overlay:
1490 @RenderArticleOverlayHeader(settings);
1491 break;
1492 default:
1493 @RenderArticleCleanHeader(settings);
1494 break;
1495 }
1496 }
1497 }
1498
1499 @helper RenderArticleCleanHeader(ArticleHeader settings) {
1500 dynamic[] methodParameters = new dynamic[1];
1501 methodParameters[0] = settings;
1502 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom");
1503
1504 if (customMethod != null)
1505 {
1506 @customMethod.Invoke(this, methodParameters).ToString();
1507 }
1508 else
1509 {
1510 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12";
1511
1512 <div class="grid grid--align-content-start grid--justify-start">
1513 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod">
1514 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0)
1515 {
1516 <div class="u-border-bottom u-padding-bottom">
1517 @if (!String.IsNullOrEmpty(settings.Category))
1518 {
1519 <div class="u-pull--left">
1520 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div>
1521 </div>
1522 }
1523 <div class="u-pull--right">
1524 @*CS NT Hide date 20220411
1525 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
1526 {
1527 <small class="article__post-info dw-mod">@settings.Author @settings.Date</small>
1528 }
1529 *@
1530 @if (settings.RatingOutOf != 0)
1531 {
1532 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })
1533 }
1534 </div>
1535 </div>
1536 }
1537
1538 <div class="grid__cell">
1539 @if (!String.IsNullOrEmpty(settings.Heading))
1540 {
1541 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1>
1542 }
1543 @if (settings.Image != null)
1544 {
1545 if (settings.Image.Path != null)
1546 {
1547 <div class="u-padding-bottom--lg">
1548 @RenderImage(settings.Image)
1549 </div>
1550 }
1551 }
1552 @if (!String.IsNullOrEmpty(settings.Subheading))
1553 {
1554 <div class="article__leadtext dw-mod">@settings.Subheading</div>
1555 }
1556 @if (!String.IsNullOrEmpty(settings.Link))
1557 {
1558 <div class="grid__cell">
1559 @RenderButton(new Button { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
1560 </div>
1561 }
1562 </div>
1563 </div>
1564 @if (settings.ExternalParagraphId != 0)
1565 {
1566 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod">
1567 @RenderParagraphContent(settings.ExternalParagraphId)
1568 </div>
1569 }
1570 </div>
1571 }
1572 }
1573
1574 @helper RenderArticleSplitHeader(ArticleHeader settings) {
1575 dynamic[] methodParameters = new dynamic[1];
1576 methodParameters[0] = settings;
1577 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSplitHeaderCustom");
1578
1579 if (customMethod != null)
1580 {
1581 @customMethod.Invoke(this, methodParameters).ToString();
1582 }
1583 else
1584 {
1585 string headerColumnWidth = settings.ExternalParagraphId != 0 ? "4" : "6";
1586
1587 if (settings.Image != null)
1588 {
1589 if (settings.Image.Path != null)
1590 {
1591 <section class="multiple-paragraphs-container paragraph-container--full-width">
1592 <div class="grid">
1593 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod">
1594 <div class="u-left-middle u-padding--lg">
1595 <div>
1596 @if (!String.IsNullOrEmpty(settings.Category))
1597 {
1598 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div>
1599 }
1600 @if (!String.IsNullOrEmpty(settings.Heading))
1601 {
1602 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1>
1603 }
1604 @if (!String.IsNullOrEmpty(settings.Subheading))
1605 {
1606 <div class="article__leadtext dw-mod">@settings.Subheading</div>
1607 }
1608 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
1609 {
1610 <small class="article__post-info u-pull--left dw-mod">@settings.Author @settings.Date</small>
1611 }
1612 @if (settings.RatingOutOf != 0)
1613 {
1614 <div class="u-pull--right">
1615 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })
1616 </div>
1617 }
1618 @if (!String.IsNullOrEmpty(settings.Link)) {
1619 @RenderButton(new Button { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
1620 }
1621 </div>
1622 </div>
1623 </div>
1624 <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>
1625 @if (settings.ExternalParagraphId != 0)
1626 {
1627 <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">
1628 @RenderParagraphContent(settings.ExternalParagraphId)
1629 </div>
1630 }
1631 </div>
1632 </section>
1633 }
1634 }
1635 else
1636 {
1637 @RenderArticleCleanHeader(settings);
1638 }
1639 }
1640 }
1641
1642 @helper RenderArticleOverlayHeader(ArticleHeader settings) {
1643 dynamic[] methodParameters = new dynamic[1];
1644 methodParameters[0] = settings;
1645 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleOverlayHeaderCustom");
1646
1647 if (customMethod != null)
1648 {
1649 @customMethod.Invoke(this, methodParameters).ToString();
1650 }
1651 else
1652 {
1653 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12";
1654 string contentAlignment = settings.TextLayout == ArticleHeaderTextLayout.Center ? "grid--justify-center" : "";
1655
1656 if (settings.Image != null)
1657 {
1658 if (settings.Image.Path != null)
1659 {
1660 if (settings.ExternalParagraphId == 0)
1661 {
1662 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width">
1663 <div class="background-image image-filter image-filter--darken dw-mod">
1664 <div class="background-image__wrapper image-filter image-filter--darken dw-mod">
1665 @{
1666 settings.Image.CssClass += "background-image__cover dw-mod";
1667 }
1668 @RenderImage(settings.Image)
1669 </div>
1670 </div>
1671 <div class="center-container dw-mod">
1672 <div class="grid @contentAlignment">
1673 <div class="grid__col-md-@contentColumns grid__col-xs-12 paragraph-container paragraph-container--height-xl u-no-padding dw-mod">
1674 @if (!String.IsNullOrEmpty(settings.Heading))
1675 {
1676 <h1 class="article__header article__header--giant u-padding-top--lg dw-mod" style="color: @settings.TextColor">@settings.Heading</h1>
1677 }
1678 @if (!String.IsNullOrEmpty(settings.Subheading))
1679 {
1680 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div>
1681 }
1682 <div class="u-margin-top">
1683 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
1684 {
1685 <small class="article__post-info u-pull--left dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small>
1686 }
1687 @if (settings.RatingOutOf != 0)
1688 {
1689 <div class="u-pull--right">
1690 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })
1691 </div>
1692 }
1693 </div>
1694 @if (!String.IsNullOrEmpty(settings.Link))
1695 {
1696 <div class="grid__cell">
1697 @RenderButton(new Button { Link= settings.Link, Title= settings.LinkText, ButtonLayout= settings.ButtonLayout })
1698 </div>
1699 }
1700 </div>
1701 </div>
1702 </div>
1703 </section>
1704 }
1705 else
1706 {
1707 @RenderArticleBanner(settings);
1708 }
1709 }
1710 }
1711 else
1712 {
1713 @RenderArticleCleanHeader(settings);
1714 }
1715 }
1716 }
1717
1718 @helper RenderArticleBannerHeader(dynamic settings) {
1719 dynamic[] methodParameters = new dynamic[1];
1720 methodParameters[0] = settings;
1721 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerHeaderCustom");
1722
1723 if (customMethod != null)
1724 {
1725 @customMethod.Invoke(this, methodParameters).ToString();
1726 }
1727 else
1728 {
1729 @RenderArticleBanner(settings);
1730 }
1731 }
1732 @using System.Reflection
1733 @using System.Text.RegularExpressions;
1734 @using Dynamicweb.Frontend
1735 @using Dynamicweb.Content.Items
1736 @using Dynamicweb.Rapido.Blocks.Components
1737 @using Dynamicweb.Rapido.Blocks.Components.Articles
1738 @using Dynamicweb.Rapido.Blocks
1739
1740 @* Component for the articles *@
1741
1742 @helper RenderArticleBodyRow(ArticleBodyRow settings)
1743 {
1744 dynamic[] methodParameters = new dynamic[1];
1745 methodParameters[0] = settings;
1746 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBodyRowCustom");
1747
1748 if (customMethod != null)
1749 {
1750 @customMethod.Invoke(this, methodParameters).ToString();
1751 } else {
1752 string position = settings.TopLayout == "overlay" ? "article__overlay-offset" : "";
1753 string contentAlignment = settings.TextLayout == "center" ? "grid--justify-center" : "";
1754
1755 <div class="grid grid--align-content-start @contentAlignment @position dw-mod">
1756 @RenderBlockList(settings.SubBlocks)
1757 </div>
1758 }
1759 }
1760 @using System.Reflection
1761 @using Dynamicweb.Rapido.Blocks.Components
1762 @using Dynamicweb.Rapido.Blocks.Components.General
1763 @using Dynamicweb.Rapido.Blocks.Components.Articles
1764 @using Dynamicweb.Rapido.Blocks
1765
1766 @* Component for the articles *@
1767
1768 @helper RenderArticleImage(ArticleImage settings)
1769 {
1770 dynamic[] methodParameters = new dynamic[1];
1771 methodParameters[0] = settings;
1772 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleImageCustom");
1773
1774 if (customMethod != null)
1775 {
1776 @customMethod.Invoke(this, methodParameters).ToString();
1777 }
1778 else
1779 {
1780 if (settings.Image != null)
1781 {
1782 if (settings.Image.Path != null)
1783 {
1784 <div class="u-margin-bottom--lg">
1785 @RenderImage(settings.Image)
1786 </div>
1787 }
1788 }
1789 }
1790 }
1791 @using System.Reflection
1792 @using Dynamicweb.Rapido.Blocks.Components
1793 @using Dynamicweb.Rapido.Blocks.Components.Articles
1794
1795
1796 @* Component for the articles *@
1797
1798 @helper RenderArticleSubHeader(ArticleSubHeader settings)
1799 {
1800 dynamic[] methodParameters = new dynamic[1];
1801 methodParameters[0] = settings;
1802 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSubHeaderCustom");
1803
1804 if (customMethod != null)
1805 {
1806 @customMethod.Invoke(this, methodParameters).ToString();
1807 } else {
1808 if (!String.IsNullOrEmpty(settings.Title))
1809 {
1810 <h2 class="article__header">@settings.Title</h2>
1811 }
1812 }
1813 }
1814 @using System.Reflection
1815 @using Dynamicweb.Rapido.Blocks.Components
1816 @using Dynamicweb.Rapido.Blocks.Components.Articles
1817 @using Dynamicweb.Rapido.Blocks
1818
1819
1820 @* Component for the articles *@
1821
1822 @helper RenderArticleText(ArticleText settings)
1823 {
1824 dynamic[] methodParameters = new dynamic[1];
1825 methodParameters[0] = settings;
1826 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleTextCustom");
1827
1828 if (customMethod != null)
1829 {
1830 @customMethod.Invoke(this, methodParameters).ToString();
1831 } else {
1832 if (!String.IsNullOrEmpty(settings.Text))
1833 {
1834 string greatTextClass = settings.EnableLargeText == true ? "article__paragraph--great-text" : "";
1835
1836 <div class="article__paragraph @greatTextClass">
1837 @settings.Text
1838 </div>
1839 }
1840 }
1841 }
1842 @using System.Reflection
1843 @using Dynamicweb.Rapido.Blocks.Components
1844 @using Dynamicweb.Rapido.Blocks.Components.Articles
1845 @using Dynamicweb.Rapido.Blocks
1846
1847
1848 @* Component for the articles *@
1849
1850 @helper RenderArticleQuote(ArticleQuote settings)
1851 {
1852 dynamic[] methodParameters = new dynamic[1];
1853 methodParameters[0] = settings;
1854 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleQuoteCustom");
1855
1856 if (customMethod != null)
1857 {
1858 @customMethod.Invoke(this, methodParameters).ToString();
1859 } else {
1860 string text = Regex.Replace(settings.Text, "<.*?>", String.Empty);
1861
1862 <div class="grid u-padding-bottom--lg">
1863 @if (settings.Image != null)
1864 {
1865 if (settings.Image.Path != null) {
1866 <div class="grid__col-3">
1867 <div class="grid__cell-img">
1868 @{
1869 settings.Image.Title = !String.IsNullOrEmpty(settings.Image.Title) ? settings.Image.Title : settings.Author;
1870 settings.Image.CssClass += " article__image article__image--ball";
1871 settings.Image.ImageDefault.Width = 200;
1872 settings.Image.ImageDefault.Height = 200;
1873 }
1874 @RenderImage(settings.Image)
1875 </div>
1876 </div>
1877 }
1878 }
1879 <div class="grid__col-auto">
1880 @if (!String.IsNullOrEmpty(settings.Text))
1881 {
1882 <div class="article__quote dw-mod">
1883 <i class="fas fa-quote-right u-margin-bottom--lg"></i>
1884 @settings.Text
1885 <i class="fas fa-quote-right"></i>
1886 </div>
1887 }
1888 @if (!String.IsNullOrEmpty(settings.Author))
1889 {
1890 <div class="article__quote-author dw-mod">
1891 - @settings.Author
1892 </div>
1893 }
1894 </div>
1895 </div>
1896 }
1897 }
1898 @using System.Reflection
1899 @using Dynamicweb.Rapido.Blocks.Components
1900 @using Dynamicweb.Rapido.Blocks.Components.Articles
1901 @using Dynamicweb.Rapido.Blocks
1902
1903 @* Component for the articles *@
1904
1905 @helper RenderArticleInfoTable(ArticleInfoTable settings)
1906 {
1907 dynamic[] methodParameters = new dynamic[1];
1908 methodParameters[0] = settings;
1909 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleInfoTableCustom");
1910
1911 if (customMethod != null)
1912 {
1913 @customMethod.Invoke(this, methodParameters).ToString();
1914 } else {
1915 <table class="table table--clean">
1916 @foreach (var row in settings.Rows)
1917 {
1918 string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two";
1919
1920 <tr>
1921 @if (!String.IsNullOrEmpty(row.Icon))
1922 {
1923 <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td>
1924 }
1925 <td class="u-no-margin-on-p-elements">
1926 <div class="u-bold">@row.Title</div>
1927 @if (!String.IsNullOrEmpty(row.SubTitle))
1928 {
1929 if (row.Link == null)
1930 {
1931 <div>@row.SubTitle</div>
1932 }
1933 else
1934 {
1935 <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a>
1936 }
1937 }
1938 </td>
1939 </tr>
1940 }
1941 </table>
1942 }
1943 }
1944 @using System.Reflection
1945 @using Dynamicweb.Rapido.Blocks.Components
1946 @using Dynamicweb.Rapido.Blocks.Components.Articles
1947 @using Dynamicweb.Rapido.Blocks
1948
1949 @* Component for the articles *@
1950
1951 @helper RenderArticleGalleryModal(ArticleGalleryModal settings)
1952 {
1953 dynamic[] methodParameters = new dynamic[1];
1954 methodParameters[0] = settings;
1955 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom");
1956
1957 if (customMethod != null)
1958 {
1959 @customMethod.Invoke(this, methodParameters).ToString();
1960 }
1961 else
1962 {
1963 <input type="checkbox" id="ParagraphGalleryModalTrigger" class="modal-trigger" />
1964 <div class="modal-container">
1965 <label for="ParagraphGalleryModalTrigger" id="ParagraphGalleryModalOverlay" class="modal-overlay"></label>
1966 <div class="modal modal--full" id="ParagraphGalleryModal">
1967 <div class="modal__body modal__body--full">
1968 <div class="modal__image-min-size-wrapper">
1969 <img src="/Files/Images/placeholder.gif" id="ParagraphGallery" class="modal--full__img dw-mod" alt="">
1970 </div>
1971 <div class="modal__images-counter" id="ParagraphGallery_counter"></div>
1972 <button class="modal__prev-btn dw-mod" id="ParagraphGallery_prev" onclick="Gallery.prevImage('ParagraphGallery')" type="button">
1973 <i class="far fa-angle-left"></i>
1974 </button>
1975 <button class="modal__next-btn dw-mod" id="ParagraphGallery_next" onclick="Gallery.nextImage('ParagraphGallery')" type="button">
1976 <i class="far fa-angle-right"></i>
1977 </button>
1978 </div>
1979 <label class="modal__close-btn" for="ParagraphGalleryModalTrigger"></label>
1980 </div>
1981 </div>
1982 }
1983 }
1984 @using System.Reflection
1985 @using Dynamicweb.Rapido.Blocks.Components
1986 @using Dynamicweb.Rapido.Blocks.Components.Articles
1987 @using Dynamicweb.Rapido.Blocks
1988
1989
1990 @* Component for the articles *@
1991
1992 @helper RenderArticleRelated(ArticleRelated settings)
1993 {
1994 string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : "";
1995 string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : "";
1996
1997 <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width">
1998 <div class="center-container dw-mod">
1999 <div class="grid u-padding">
2000 <div class="grid__col-md-12 grid__col-xs-12">
2001 <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2>
2002 </div>
2003 </div>
2004
2005 <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>
2006
2007 <script id="RelatedSimpleTemplate" type="text/x-template">
2008 {{#.}}
2009 <div class="grid u-padding-bottom--lg">
2010 {{#Cases}}
2011 <div class="grid__col-3 image-hover--zoom dw-mod">
2012 <a href="{{link}}" class="u-full-height u-color-light--bg">
2013 {{#if image}}
2014 <div class="u-color-light--bg u-no-padding dw-mod">
2015 <div class="flex-img image-hover__wrapper">
2016 <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}}" />
2017 </div>
2018 </div>
2019 {{/if}}
2020
2021 <div class="card u-color-light--bg dw-mod">
2022 <h3 class="article-list__item-header u-truncate-text dw-mod">{{title}}</h3>
2023 <p class="article__short-summary dw-mod">{{summary}}</p>
2024 </div>
2025 </a>
2026 </div>
2027 {{/Cases}}
2028 </div>
2029 {{/.}}
2030 </script>
2031 </div>
2032 </section>
2033 }
2034 @using System.Reflection
2035 @using Dynamicweb.Rapido.Blocks.Components
2036 @using Dynamicweb.Rapido.Blocks.Components.Articles
2037 @using Dynamicweb.Rapido.Blocks
2038
2039
2040 @* Component for the articles *@
2041
2042 @helper RenderArticleMenu(ArticleMenu settings)
2043 {
2044 dynamic[] methodParameters = new dynamic[1];
2045 methodParameters[0] = settings;
2046 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleMenuCustom");
2047
2048 if (customMethod != null)
2049 {
2050 @customMethod.Invoke(this, methodParameters).ToString();
2051 } else {
2052 if (!String.IsNullOrEmpty(settings.Title)) {
2053 <div class="u-margin u-border-bottom">
2054 <h3 class="u-no-margin">@settings.Title</h3>
2055 </div>
2056 }
2057
2058 <ul class="menu-left u-margin-bottom dw-mod">
2059 @foreach (var item in settings.Items)
2060 {
2061 @RenderArticleMenuItem(item)
2062 }
2063 </ul>
2064 }
2065 }
2066
2067 @helper RenderArticleMenuItem(ArticleMenuItem settings)
2068 {
2069 dynamic[] methodParameters = new dynamic[1];
2070 methodParameters[0] = settings;
2071 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleMenuItemCustom");
2072
2073 if (customMethod != null)
2074 {
2075 @customMethod.Invoke(this, methodParameters).ToString();
2076 } else {
2077 string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#";
2078
2079 if (!String.IsNullOrEmpty(settings.Title)) {
2080 <li class="menu-left__item dw-mod">
2081 <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a>
2082 </li>
2083 }
2084 }
2085 }
2086 @using System.Reflection
2087 @using Dynamicweb.Rapido.Blocks.Components
2088 @using Dynamicweb.Rapido.Blocks.Components.Articles
2089 @using Dynamicweb.Rapido.Blocks
2090
2091 @* Component for the articles *@
2092
2093 @helper RenderArticleList(ArticleList settings)
2094 {
2095 dynamic[] methodParameters = new dynamic[1];
2096 methodParameters[0] = settings;
2097 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListCustom");
2098
2099 if (customMethod != null)
2100 {
2101 @customMethod.Invoke(this, methodParameters).ToString();
2102 } else {
2103 if (Pageview != null)
2104 {
2105 bool isParagraph = Pageview.CurrentParagraph != null ? true : false;
2106 string[] sortArticlesListBy = new string[2];
2107
2108 if (isParagraph) {
2109 sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" };
2110 }
2111 else {
2112 sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" };
2113 }
2114
2115 string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString();
2116
2117 @RenderItemList(new
2118 {
2119 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle",
2120 ListSourceType = settings.SourceType,
2121 ListSourcePage = sourcePage,
2122 ItemFieldsList = "*",
2123 Filter = settings.Filter,
2124 ListOrderBy = sortArticlesListBy[0],
2125 ListOrderByDirection = sortArticlesListBy[1],
2126 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date",
2127 ListSecondOrderByDirection = "ASC",
2128 IncludeAllChildItems = true,
2129 ListTemplate = settings.Template,
2130 ListPageSize = settings.PageSize.ToString()
2131 });
2132 }
2133 }
2134 }
2135 @using System.Reflection
2136 @using Dynamicweb.Rapido.Blocks.Components.Articles
2137
2138
2139 @* Component for the articles *@
2140
2141 @helper RenderArticleSummary(ArticleSummary settings)
2142 {
2143 dynamic[] methodParameters = new dynamic[1];
2144 methodParameters[0] = settings;
2145 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSummaryCustom");
2146
2147 if (customMethod != null)
2148 {
2149 @customMethod.Invoke(this, methodParameters).ToString();
2150 } else {
2151 if (!String.IsNullOrEmpty(settings.Text))
2152 {
2153 <div class="article__summary dw-mod">@settings.Text</div>
2154 }
2155 }
2156 }
2157 @using System.Reflection
2158 @using Dynamicweb.Rapido.Blocks.Components
2159 @using Dynamicweb.Rapido.Blocks.Components.Articles
2160 @using Dynamicweb.Rapido.Blocks
2161
2162 @* Component for the articles *@
2163
2164 @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings)
2165 {
2166 dynamic[] methodParameters = new dynamic[1];
2167 methodParameters[0] = settings;
2168 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListCategoryFilterCustom");
2169
2170 if (customMethod != null)
2171 {
2172 @customMethod.Invoke(this, methodParameters).ToString();
2173 } else {
2174 string pageId = Pageview.ID.ToString();
2175 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All");
2176 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString());
2177
2178 foreach (var option in settings.Categories)
2179 {
2180 selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter;
2181 }
2182
2183 if (selectedFilter == pageId)
2184 {
2185 selectedFilter = Translate("All");
2186 }
2187
2188 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
2189 {
2190 <div class="u-pull--right u-margin-left">
2191 <div class="collection u-no-margin">
2192 <h5>@Translate("Category")</h5>
2193 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" />
2194 <div class="dropdown u-w180px dw-mod">
2195 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label>
2196 <div class="dropdown__content dw-mod">
2197 @foreach (var option in settings.Categories)
2198 {
2199 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div>
2200 }
2201 </div>
2202 <label class="dropdown-trigger-off" for="CategorySelector"></label>
2203 </div>
2204 </div>
2205 </div>
2206 }
2207 else
2208 {
2209 <div class="u-full-width u-margin-bottom">
2210 <h5 class="u-no-margin">@Translate("Category")</h5>
2211 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" />
2212 <div class="dropdown u-full-width dw-mod">
2213 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label>
2214 <div class="dropdown__content dw-mod">
2215 @foreach (var option in settings.Categories)
2216 {
2217 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div>
2218 }
2219 </div>
2220 <label class="dropdown-trigger-off" for="CategorySelector"></label>
2221 </div>
2222 </div>
2223 }
2224 }
2225 }
2226 @using System.Reflection
2227 @using Dynamicweb.Rapido.Blocks.Components
2228 @using Dynamicweb.Rapido.Blocks.Components.Articles
2229 @using Dynamicweb.Rapido.Blocks
2230
2231 @* Component for the articles *@
2232
2233 @helper RenderArticleListFilter(ArticleListFilter settings)
2234 {
2235 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All");
2236 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString());
2237
2238 if (settings.Options != null)
2239 {
2240 foreach (var option in settings.Options)
2241 {
2242 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter;
2243 }
2244
2245 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
2246 {
2247 <div class="u-pull--right u-margin-left">
2248 <div class="collection u-no-margin">
2249 <h5>@settings.Label</h5>
2250 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" />
2251 <div class="dropdown u-w180px dw-mod">
2252 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label>
2253 <div class="dropdown__content dw-mod">
2254 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div>
2255 @foreach (var option in settings.Options)
2256 {
2257 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div>
2258 }
2259 </div>
2260 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label>
2261 </div>
2262 </div>
2263 </div>
2264 }
2265 else
2266 {
2267 <div class="u-full-width u-margin-bottom">
2268 <h5 class="u-no-margin">@settings.Label</h5>
2269 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" />
2270 <div class="dropdown u-full-width w-mod">
2271 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label>
2272 <div class="dropdown__content dw-mod">
2273 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div>
2274 @foreach (var option in settings.Options)
2275 {
2276 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div>
2277 }
2278 </div>
2279 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label>
2280 </div>
2281 </div>
2282 }
2283 }
2284 }
2285 @using System.Reflection
2286 @using Dynamicweb.Rapido.Blocks.Components
2287 @using Dynamicweb.Rapido.Blocks.Components.Articles
2288 @using Dynamicweb.Rapido.Blocks
2289
2290 @* Component for the articles *@
2291
2292 @helper RenderArticleListSearch(ArticleListSearch settings)
2293 {
2294 dynamic[] methodParameters = new dynamic[1];
2295 methodParameters[0] = settings;
2296 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListSearchCustom");
2297
2298 if (customMethod != null)
2299 {
2300 @customMethod.Invoke(this, methodParameters).ToString();
2301 } else {
2302 string searchString = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("Title")) ? HttpContext.Current.Request.QueryString.Get("Title").Trim('*') : "";
2303 string className = "u-w340px u-pull--right u-margin-left";
2304
2305 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet")
2306 {
2307 className = "u-full-width";
2308 }
2309
2310 <div class="typeahead u-color-inherit u-margin-bottom dw-mod @className">
2311 <input type="text" class="typeahead-search-field u-no-margin dw-mod" placeholder="@Translate("Search in list")" value="@searchString" id="ArticleListSearchInput" onchange="QueryArray.setParameterInCurrentURL('Title', '*' + document.getElementById('ArticleListSearchInput').value + '*')">
2312 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button>
2313 </div>
2314 }
2315 }
2316 @using System.Reflection
2317 @using Dynamicweb.Rapido.Blocks.Components
2318 @using Dynamicweb.Rapido.Blocks.Components.Articles
2319 @using Dynamicweb.Rapido.Blocks
2320
2321 @* Component for the articles *@
2322
2323 @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings)
2324 {
2325 dynamic[] methodParameters = new dynamic[1];
2326 methodParameters[0] = settings;
2327 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListNoResultsInfoCustom");
2328
2329 if (customMethod != null)
2330 {
2331 @customMethod.Invoke(this, methodParameters).ToString();
2332 } else {
2333 <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div>
2334 }
2335 }
2336 @using System.Reflection
2337 @using Dynamicweb.Rapido.Blocks.Components
2338 @using Dynamicweb.Rapido.Blocks.Components.General
2339 @using Dynamicweb.Rapido.Blocks.Components.Articles
2340 @using Dynamicweb.Rapido.Blocks
2341 @using System.Text.RegularExpressions
2342
2343 @* Component for the articles *@
2344
2345 @helper RenderArticleListItem(ArticleListItem settings)
2346 {
2347 switch (settings.Type) {
2348 case ArticleListItemType.Card:
2349 @RenderArticleListItemCard(settings);
2350 break;
2351 case ArticleListItemType.List:
2352 @RenderArticleListItemList(settings);
2353 break;
2354 case ArticleListItemType.Simple:
2355 @RenderArticleListItemSimple(settings);
2356 break;
2357 default:
2358 @RenderArticleListItemCard(settings);
2359 break;
2360 }
2361 }
2362
2363 @helper RenderArticleListItemCard(ArticleListItem settings) {
2364 <a href="@settings.Link" class="u-full-height u-color-light--bg">
2365 <div class="u-color-light--bg u-no-padding dw-mod">
2366 @if (settings.Logo != null)
2367 {
2368 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;" : "";
2369 settings.Logo.ImageDefault.Crop = 5;
2370 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width;
2371 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height;
2372 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage">
2373 @if (settings.Stickers != null)
2374 {
2375 if (settings.Stickers.Position != StickersListPosition.Custom)
2376 {
2377 @RenderStickersCollection(settings.Stickers);
2378 }
2379 }
2380 @RenderImage(settings.Logo)
2381 </div>
2382 } else if (settings.Image != null)
2383 {
2384 <div class="flex-img image-hover__wrapper u-position-relative dw-mod">
2385 @if (settings.Stickers != null)
2386 {
2387 if (settings.Stickers.Position != StickersListPosition.Custom)
2388 {
2389 @RenderStickersCollection(settings.Stickers);
2390 }
2391 }
2392 @RenderImage(settings.Image)
2393 </div>
2394 }
2395 </div>
2396
2397 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary))
2398 {
2399 <div class="card u-color-light--bg dw-mod">
2400 @if (settings.Stickers != null)
2401 {
2402 if (settings.Stickers.Position == StickersListPosition.Custom)
2403 {
2404 @RenderStickersCollection(settings.Stickers);
2405 }
2406 }
2407 @if (!String.IsNullOrEmpty(settings.Title))
2408 {
2409 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3>
2410 }
2411 @if (!String.IsNullOrEmpty(settings.SubTitle))
2412 {
2413 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>
2414 }
2415 @if (!String.IsNullOrEmpty(settings.Summary))
2416 {
2417 <p class="article__short-summary dw-mod">@settings.Summary</p>
2418 }
2419 </div>
2420 }
2421 </a>
2422 }
2423
2424 @helper RenderArticleListItemList(ArticleListItem settings) {
2425 <a href="@settings.Link">
2426 <div class="grid u-color-light--bg u-no-padding dw-mod">
2427 <div class="grid__col-md-3">
2428 <div class="u-color-light--bg u-no-padding dw-mod">
2429 @if (settings.Logo != null)
2430 {
2431 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;" : "";
2432 settings.Logo.ImageDefault.Crop = 5;
2433 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width;
2434 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height;
2435 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage">
2436 @if (settings.Stickers != null)
2437 {
2438 if (settings.Stickers.Position != StickersListPosition.Custom)
2439 {
2440 @RenderStickersCollection(settings.Stickers);
2441 }
2442 }
2443 @RenderImage(settings.Logo)
2444 </div>
2445 } else if (settings.Image != null)
2446 {
2447 <div class="flex-img image-hover__wrapper dw-mod">
2448 @if (settings.Stickers != null)
2449 {
2450 if (settings.Stickers.Position != StickersListPosition.Custom)
2451 {
2452 @RenderStickersCollection(settings.Stickers);
2453 }
2454 }
2455 @RenderImage(settings.Image)
2456 </div>
2457 }
2458 </div>
2459 </div>
2460
2461 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary))
2462 {
2463 <div class="grid__col-md-9">
2464 @if (!String.IsNullOrEmpty(settings.Title))
2465 {
2466 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3>
2467 }
2468 @if (settings.Stickers != null)
2469 {
2470 if (settings.Stickers.Position == StickersListPosition.Custom)
2471 {
2472 @RenderStickersCollection(settings.Stickers);
2473 }
2474 }
2475 @if (!String.IsNullOrEmpty(settings.SubTitle))
2476 {
2477 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>
2478 }
2479 @if (!String.IsNullOrEmpty(settings.Summary))
2480 {
2481 <p class="article__short-summary dw-mod">@settings.Summary</p>
2482 }
2483 </div>
2484 }
2485 </div>
2486 </a>
2487 }
2488
2489 @helper RenderArticleListItemSimple(ArticleListItem settings) {
2490 <a href="@settings.Link" class="u-color-inherit">
2491 <div class="grid u-color-light--bg u-no-padding dw-mod">
2492 <div class="grid__col-md-12">
2493 @if (!String.IsNullOrEmpty(settings.Title))
2494 {
2495 <div class="article-list-item__header u-truncate-text u-no-margin dw-mod">@settings.Title</div>
2496 }
2497 @if (!String.IsNullOrEmpty(settings.SubTitle))
2498 {
2499 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>
2500 }
2501 </div>
2502 </div>
2503 </a>
2504 }
2505 @using System.Reflection
2506 @using Dynamicweb.Rapido.Blocks.Components.Articles
2507
2508
2509 @* Component for the articles *@
2510
2511 @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings)
2512 {
2513 dynamic[] methodParameters = new dynamic[1];
2514 methodParameters[0] = settings;
2515 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleAuthorAndDateCustom");
2516
2517 if (customMethod != null)
2518 {
2519 @customMethod.Invoke(this, methodParameters).ToString();
2520 } else {
2521 <small class="article__subscription">
2522 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date)))
2523 {
2524 <text>@Translate("Written")</text>
2525 }
2526 @if (!string.IsNullOrWhiteSpace(settings.Author))
2527 {
2528 <text>@Translate("by") @settings.Author</text>
2529 }
2530 @if (!string.IsNullOrWhiteSpace(settings.Date))
2531 {
2532 <text>@Translate("on") @settings.Date</text>
2533 }
2534 </small>
2535 }
2536 }
2537 @using System.Reflection
2538 @using Dynamicweb.Rapido.Blocks.Components.Articles
2539
2540
2541 @* Component for the articles *@
2542
2543 @helper RenderArticleLink(ArticleLink settings)
2544 {
2545 dynamic[] methodParameters = new dynamic[1];
2546 methodParameters[0] = settings;
2547 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleLinkCustom");
2548
2549 if (customMethod != null)
2550 {
2551 @customMethod.Invoke(this, methodParameters).ToString();
2552 } else {
2553 if (!String.IsNullOrEmpty(settings.Title))
2554 {
2555 <div class="grid__cell">
2556 @RenderButton(settings)
2557 </div>
2558 }
2559 }
2560 }
2561 @using System.Reflection
2562 @using Dynamicweb.Rapido.Blocks
2563 @using Dynamicweb.Rapido.Blocks.Components.Articles
2564 @using Dynamicweb.Rapido.Blocks.Components.General
2565
2566
2567 @* Component for the articles *@
2568
2569 @helper RenderArticleCarousel(ArticleCarousel settings)
2570 {
2571 dynamic[] methodParameters = new dynamic[1];
2572 methodParameters[0] = settings;
2573 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom");
2574
2575 if (customMethod != null)
2576 {
2577 @customMethod.Invoke(this, methodParameters).ToString();
2578 } else {
2579 <div class="grid">
2580 <div class="grid__col-12">
2581 <div class="carousel" id="carousel_@settings.Id">
2582 <div class="carousel__container js-carousel-slides dw-mod">
2583 @RenderBlockList(settings.SubBlocks)
2584 </div>
2585 </div>
2586 </div>
2587 </div>
2588
2589 <script>
2590 document.addEventListener("DOMContentLoaded", function () {
2591 new CarouselModule("#carousel_@settings.Id", {
2592 slideTime: 0,
2593 dots: true
2594 });
2595 });
2596 </script>
2597 }
2598 }
2599
2600 @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings)
2601 {
2602 dynamic[] methodParameters = new dynamic[1];
2603 methodParameters[0] = settings;
2604 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom");
2605
2606 if (customMethod != null)
2607 {
2608 @customMethod.Invoke(this, methodParameters).ToString();
2609 }
2610 else
2611 {
2612 string imageEngine = "/Admin/Public/GetImage.ashx?";
2613
2614 string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image;
2615 if (settings.ImageSettings != null)
2616 {
2617 defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : "";
2618 defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : "";
2619 defaultImage += "Crop=" + settings.ImageSettings.Crop + "&";
2620 defaultImage += "Compression=" + settings.ImageSettings.Compression + "&";
2621 defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&";
2622 defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&";
2623 }
2624 defaultImage += "&Image=" + settings.Image;
2625
2626 <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')">
2627 <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title">
2628 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2>
2629 <div class="article-list__item-info">
2630 @if (settings.Stickers != null)
2631 {
2632 settings.Stickers.Position = StickersListPosition.Custom;
2633 @RenderStickersCollection(settings.Stickers);
2634 }
2635
2636 <small class="u-margin-top--lg u-color-light">
2637 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date)))
2638 {
2639 <text>@Translate("Written")</text>
2640 }
2641 @if (!string.IsNullOrWhiteSpace(settings.Author))
2642 {
2643 <text>@Translate("by") @settings.Author</text>
2644 }
2645 @if (!string.IsNullOrWhiteSpace(settings.Date))
2646 {
2647 <text>@Translate("on") @settings.Date</text>
2648 }
2649 </small>
2650 </div>
2651
2652 <h3 class="article__short-summary u-color-light">@settings.Summary</h3>
2653 </a>
2654 @if (settings.UseFilters == true)
2655 {
2656 <div class="background-image image-filter image-filter--darken dw-mod"></div>
2657 }
2658 </div>
2659 }
2660 }
2661 @using System.Text.RegularExpressions
2662 @using Dynamicweb.Rapido.Blocks.Components
2663 @using Dynamicweb.Rapido.Blocks.Components.General
2664 @using Dynamicweb.Rapido.Blocks.Components.Articles
2665 @using Dynamicweb.Rapido.Blocks
2666
2667 @* Component for the articles *@
2668
2669 @helper RenderArticleVideo(ArticleVideo settings)
2670 {
2671 dynamic[] methodParameters = new dynamic[1];
2672 methodParameters[0] = settings;
2673 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleTextCustom");
2674
2675 if (customMethod != null)
2676 {
2677 @customMethod.Invoke(this, methodParameters).ToString();
2678 } else {
2679 if (settings.Url != null)
2680 {
2681 //getting video ID from youtube URL
2682 string videoCode = settings.Url;
2683 Regex regex = new Regex(@".be\/(.[^?]*)");
2684 Match match = regex.Match(videoCode);
2685 string videoId = "";
2686 if (match.Success)
2687 {
2688 videoId = match.Groups[1].Value;
2689 }
2690 else
2691 {
2692 regex = new Regex(@"v=([^&]+)");
2693 match = regex.Match(videoCode);
2694 if (match.Success)
2695 {
2696 videoId = match.Groups[1].Value;
2697 }
2698 }
2699
2700 int autoPlay = settings.AutoPlay == "true" ? 1 : 0;
2701
2702 <div class="video-wrapper">
2703 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div>
2704 </div>
2705 }
2706 }
2707 }
2708
2709
2710
2711 @* Simple helpers *@
2712
2713 @*Requires the Gallery ItemType that comes with Rapido*@
2714 @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) {
2715 if (gallery != null && gallery.Count > 0)
2716 {
2717 int count = 1;
2718
2719 foreach (var item in gallery)
2720 {
2721 if (item.GetFile("ImagePath") != null)
2722 {
2723 string image = item.GetFile("ImagePath").PathUrlEncoded;
2724 string imagePrefix = "/Admin/Public/GetImage.ashx?width=1200&height=820&crop=5&Compression=75&DoNotUpscale=1&image=";
2725 int imagesCount = gallery.Count;
2726
2727 if (count == 1)
2728 {
2729 <label class="gallery" for="ParagraphGalleryModalTrigger" onclick="Gallery.openImage(this.querySelector('.js-gallery'))">
2730 <span class="gallery__main-image">
2731 <img src="/Admin/Public/GetImage.ashx?width=992&height=760&crop=0&Compression=75&DoNotUpscale=1&image=@image" class="flex-img js-gallery" alt="" data-for="ParagraphGallery" data-image="@imagePrefix@image" />
2732 </span>
2733 <span class="gallery__image-counter">
2734 <i class="fas fa-camera fa-2x"></i> <span class="gallery__image-counter__number">@imagesCount</span>
2735 <span class="gallery__image-counter__text">@Translate("See all") <i class="fas fa-angle-right"></i></span>
2736 </span>
2737 </label>
2738 }
2739 else
2740 {
2741 <div class="u-hidden js-gallery" data-for="ParagraphGallery" data-image="@imagePrefix@image"></div>
2742 }
2743
2744 count++;
2745 }
2746 }
2747 @RenderArticleGalleryModal(new ArticleGalleryModal())
2748 }
2749 }
2750
2751 @helper RenderMobileFilters(List<Block> subBlocks)
2752 {
2753 if (subBlocks.Count > 0)
2754 {
2755 <div class="grid__col-12">
2756 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" />
2757 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters">
2758 @RenderBlockList(subBlocks)
2759 </div>
2760 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label>
2761 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label>
2762 </div>
2763 }
2764 }
2765
2766 @if (File.Exists(HttpContext.Current.Server.MapPath("/Components/Custom/Custom__Components.cshtml")))
2767 {
2768 <text>@using Dynamicweb.Rapido.Blocks.Components.General
2769 </text>
2770 }
2771
2772
2773 @* Include the Blocks for the page *@
2774 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
2775
2776 @using System
2777 @using System.Web
2778 @using System.Collections.Generic
2779 @using Dynamicweb.Rapido.Blocks.Extensibility
2780 @using Dynamicweb.Rapido.Blocks
2781
2782 @{
2783 BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master");
2784
2785 Block tagManager = new Block()
2786 {
2787 Id = "TagManager",
2788 SortId = 1,
2789 Template = RenderGoogleTagManager()
2790 };
2791
2792 Block facebookPixel = new Block()
2793 {
2794 Id = "FacebookPixel",
2795 SortId = 2,
2796 Template = RenderFacebookPixel()
2797 };
2798
2799 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManager);
2800 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel);
2801 }
2802
2803 @helper RenderGoogleTagManager() {
2804 string GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID");
2805
2806 if (!string.IsNullOrWhiteSpace(GoogleTagManagerID))
2807 {
2808 <script>
2809 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
2810 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
2811 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
2812 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
2813 })(window,document,'script','dataLayer','@GoogleTagManagerID');
2814 </script>
2815 <!-- Google Tag Manager (noscript) -->
2816 <noscript>
2817 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID"
2818 height="0" width="0" style="display:none;visibility:hidden"></iframe>
2819 </noscript>
2820 <!-- End Google Tag Manager (noscript) -->
2821 }
2822 }
2823
2824 @helper RenderFacebookPixel() {
2825 string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID");
2826 bool DoNotTrackForURL = false;
2827 string currentURL = HttpContext.Current.Request.Url.AbsoluteUri;
2828 //Logger.Instance.Log(ErrorLevel.DebugInfo,"TopSnippets.cshtml URL: " + currentURL);
2829 if (currentURL.Contains("create-user-profile") || currentURL.Contains("existing-customer") || currentURL.Contains("UserManagementForm") || currentURL.Contains("customer")
2830 || currentURL.Contains("FirstName") || currentURL.Contains("First Name")
2831 || currentURL.Contains("LastName") || currentURL.Contains("Last Name")
2832 || currentURL.Contains("DateOfBirth") || currentURL.Contains("Form_Email")
2833 || currentURL.Contains("ID=59") || currentURL.Contains("ID=2227")
2834 || currentURL.Contains("ID=2319") || currentURL.Contains("ID=2320")
2835 || currentURL.Contains("ID=2321") || currentURL.Contains("ID=2322")
2836 || currentURL.Contains("ID=2323") || currentURL.Contains("ID=2324")
2837 || currentURL.Contains("ID=2335") || currentURL.Contains("ID=2336")
2838 || currentURL.Contains("ID=2337") || currentURL.Contains("ID=2338")
2839 || currentURL.Contains("ID=2339") || currentURL.Contains("ID=2340")
2840 || currentURL.Contains("ID=2341") || currentURL.Contains("ID=2342")
2841 || currentURL.Contains("ID=2343") || currentURL.Contains("ID=2344")
2842 || currentURL.Contains("ID=2345") || currentURL.Contains("ID=2346")
2843 || currentURL.Contains("ID=2347") || currentURL.Contains("ID=2348"))
2844 {
2845 DoNotTrackForURL = true;
2846 }
2847
2848 if (!string.IsNullOrWhiteSpace(FacebookPixelID) && !DoNotTrackForURL)
2849 {
2850 <!-- Facebook Pixel Code -->
2851 <script>
2852 !function(f,b,e,v,n,t,s)
2853 {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
2854 n.callMethod.apply(n,arguments):n.queue.push(arguments)};
2855 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
2856 n.queue=[];t=b.createElement(e);t.async=!0;
2857 t.src=v;s=b.getElementsByTagName(e)[0];
2858 s.parentNode.insertBefore(t,s)}(window, document,'script',
2859 'https://connect.facebook.net/en_US/fbevents.js');
2860 fbq('init', '@FacebookPixelID');
2861 fbq('track', 'PageView');
2862 </script>
2863 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript>
2864 }
2865 }
2866 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
2867
2868 @using System
2869 @using System.Web
2870 @using System.Collections.Generic
2871 @using Dynamicweb.Rapido.Blocks
2872 @using Dynamicweb.Rapido.Blocks.Extensibility
2873 @using Dynamicweb.Security.UserManagement
2874 @using Dynamicweb.Security.UserManagement.ExternalAuthentication
2875 @{
2876 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master");
2877
2878 Block loginModal = new Block()
2879 {
2880 Id = "LoginModal",
2881 SortId = 10,
2882 Template = LoginModal()
2883 };
2884
2885 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal);
2886 }
2887
2888 @helper LoginModal() {
2889 int pageId = Model.TopPage.ID;
2890 pageId = 3;//CS NT Test for rredirect
2891 string userSignedInError = !Model.LogOnFailed ? "" : "checked";
2892 string userSignedInErrorText = "";
2893 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
2894 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery";
2895 //CS NT int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");
2896 int createAccountPageId = GetPageIdByNavigationTag("CreateECommerceAccount");
2897
2898 if (Model.LogOnFailed) {
2899 switch (Model.LogOnFailedReason)
2900 {
2901 case LogOnFailedReason.PasswordLengthInvalid:
2902 userSignedInErrorText = Translate("Password length is invalid");
2903 break;
2904 case LogOnFailedReason.IncorrectLogin:
2905 userSignedInErrorText = Translate("Invalid email or password");
2906 break;
2907 case LogOnFailedReason.ExceededFailedLogOnLimit:
2908 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked");
2909 break;
2910 case LogOnFailedReason.LoginLocked:
2911 userSignedInErrorText = Translate("The user account is temporarily locked");
2912 break;
2913 case LogOnFailedReason.PasswordExpired:
2914 userSignedInErrorText = Translate("The password has expired and needs to be renewed");
2915 break;
2916 default:
2917 userSignedInErrorText = Translate("An unknown error occured");
2918 break;
2919 }
2920 }
2921
2922 <!-- Trigger for the login modal -->
2923 <!--CS NT Hide Pop up sign in -->
2924 if (Pageview.Device.ToString() != "Desktop")
2925 {
2926 <input type="checkbox" id="SignInModalTrigger" class="modal-trigger" @userSignedInError />
2927 }
2928
2929 <!-- Login modal -->
2930 <div class="modal-container">
2931 <label for="SignInModalTrigger" id="SignInModalOverlay" class="modal-overlay"></label>
2932 <div class="modal modal--xs" id="SignInModal">
2933 <div class="modal__header">
2934 <h2>@Translate("Sign in")</h2>
2935 </div>
2936 <div class="modal__body">
2937 <form method="post" id="LoginForm" class="u-no-margin">
2938 <input type="hidden" name="ID" value="@pageId" />
2939 <input type="hidden" name="DWExtranetUsernameRemember" value="True" />
2940 <input type="hidden" name="DWExtranetPasswordRemember" value="True" />
2941 <input type="text" class="u-full-width" id="LoginUsername" name="username" placeholder="@Translate("Email")" />
2942 <input type="password" class="u-full-width" id="LoginPassword" name="password" placeholder="@Translate("Password")" />
2943 <div class="field-error dw-mod">@userSignedInErrorText</div>
2944
2945 <div class="form__field-group dw-mod">
2946 <input type="checkbox" id="LoginRememberMe" name="Autologin" checked="checked" value="True" class="form__control">
2947 <label for="LoginRememberMe">
2948 @Translate("Remember me", "Remember me")
2949 </label>
2950 </div>
2951
2952 <button type="submit" class="btn btn--primary btn--full dw-mod" name="LoginAction" value="Login" onclick="Buttons.LockButton(event)">@Translate("Sign in")</button>
2953 @{
2954 ProviderCollection providers = Provider.GetActiveProviders();
2955 }
2956
2957 @foreach(Provider LoginProvider in providers)
2958 {
2959 var ProviderName = LoginProvider.Name.ToLower();
2960 <a href="/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=@LoginProvider.ID" title="@LoginProvider.Name" class="btn btn--clean btn--condensed u-color-@ProviderName dw-mod"><i class="fab fa-@ProviderName fa-1_5x"></i></a>
2961 }
2962
2963 <a class="btn btn--link-clean dw-mod" href="@forgotPasswordPageLink">@Translate("Forgot your password?", "Forgot your password?")</a>
2964
2965 <!-- CS NT<a class="btn btn--link-clean dw-mod" href="/default.aspx?ID=@createAccountPageId">@Translate("Create account")?</a> -->
2966 <a class="btn btn--link-clean dw-mod" href="/default.aspx?ID=@createAccountPageId">@Translate("Create account")?</a>
2967 </form>
2968 </div>
2969 </div>
2970 </div>
2971 }
2972
2973 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet")
2974 {
2975 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
2976
2977 @using System
2978 @using System.Web
2979 @using System.Collections.Generic
2980 @using Dynamicweb.Rapido.Blocks.Extensibility
2981 @using Dynamicweb.Rapido.Blocks
2982
2983
2984 @functions {
2985 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master");
2986 }
2987
2988 @{
2989 bool mobileOnlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("mobileOnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0;
2990 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";
2991 bool mobileHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");
2992 bool mobileHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart") || mobileOnlyPreview;
2993
2994 Block topBannerNT = new Block()
2995 {
2996 Id = "TopBannerNT",
2997 SortId = 9,
2998 Template = RendertopBannerNT(),
2999 SkipRenderBlocksList = true
3000 };
3001 headerBlocksPage.Add("MasterHeader", topBannerNT);
3002
3003 Block mobileHeader = new Block()
3004 {
3005 Id = "MobileTop",
3006 SortId = 10,
3007 Template = RenderMobileTop(),
3008 SkipRenderBlocksList = true
3009 };
3010 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader);
3011
3012 Block mobileHeaderNavigation = new Block()
3013 {
3014 Id = "MobileHeaderNavigation",
3015 SortId = 10,
3016 Template = RenderMobileHeaderNavigation(),
3017 SkipRenderBlocksList = true,
3018 BlocksList = new List<Block> {
3019 new Block {
3020 Id = "MobileHeaderNavigationTrigger",
3021 SortId = 10,
3022 Template = RenderMobileHeaderNavigationTrigger()
3023 }
3024 }
3025 };
3026 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation);
3027
3028 Block mobileHeaderLogo = new Block()
3029 {
3030 Id = "MobileHeaderLogo",
3031 SortId = 20,
3032 Template = RenderMobileHeaderLogo(),
3033 SkipRenderBlocksList = true
3034 };
3035 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo);
3036
3037 Block mobileHeaderActions = new Block()
3038 {
3039 Id = "MobileHeaderActions",
3040 SortId = 30,
3041 Template = RenderMobileTopActions(),
3042 SkipRenderBlocksList = true
3043 };
3044 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions);
3045
3046 if (mobileHideSearch == false)
3047 {
3048 Block mobileHeaderSearch = new Block
3049 {
3050 Id = "MobileHeaderSearch",
3051 SortId = 10,
3052 Template = RenderMobileTopSearch()
3053 };
3054 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch);
3055 }
3056
3057 Block mobileHeaderMiniCart;
3058
3059 if (!mobileHideCart)
3060 {
3061 mobileHeaderMiniCart = new Block
3062 {
3063 Id = "MobileHeaderMiniCart",
3064 SortId = 20,
3065 Template = RenderMobileTopMiniCart()
3066 };
3067
3068 Block miniCartCounterScriptTemplate = new Block
3069 {
3070 Id = "MiniCartCounterScriptTemplate",
3071 Template = RenderMobileMiniCartCounterContent()
3072 };
3073 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate);
3074 }
3075 else
3076 {
3077 mobileHeaderMiniCart = new Block
3078 {
3079 Id = "MobileHeaderMiniCart",
3080 SortId = 20
3081 };
3082 }
3083
3084 if (!mobileHideSearch)
3085 {
3086 Block mobileHeaderSearchBar = new Block()
3087 {
3088 Id = "MobileHeaderSearchBar",
3089 SortId = 30,
3090 Template = RenderMobileTopSearchBar()
3091 };
3092 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar);
3093 }
3094
3095 switch (mobileTopLayout)
3096 {
3097 case "nav-left":
3098 mobileHeaderNavigation.SortId = 10;
3099 mobileHeaderLogo.SortId = 20;
3100 mobileHeaderActions.SortId = 30;
3101 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart);
3102 break;
3103 case "nav-right":
3104 mobileHeaderLogo.SortId = 10;
3105 mobileHeaderActions.SortId = 20;
3106 mobileHeaderNavigation.SortId = 30;
3107 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart);
3108 break;
3109 case "nav-search-left":
3110 mobileHeaderNavigation.SortId = 10;
3111 mobileHeaderLogo.SortId = 20;
3112 mobileHeaderActions.SortId = 30;
3113 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart);
3114 break;
3115 case "search-left":
3116 mobileHeaderActions.SortId = 10;
3117 mobileHeaderLogo.SortId = 20;
3118 mobileHeaderNavigation.SortId = 30;
3119 mobileHeaderMiniCart.SortId = 0;
3120 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart);
3121 break;
3122 }
3123
3124 if (!mobileOnlyPreview)
3125 {
3126 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block {
3127 Id = "CartInitialization",
3128 Template = RenderMobileCartInitialization()
3129 });
3130 }
3131 }
3132
3133 @helper RenderMobileCartInitialization()
3134 {
3135 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
3136 <script>
3137 window.cartId = "@miniCartFeedPageId";
3138 </script>
3139 }
3140
3141 @helper RenderMobileTop() {
3142 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList();
3143
3144 <nav class="main-navigation-mobile dw-mod">
3145 <div class="center-container top-container__center-container dw-mod">
3146 <div class="grid grid--align-center">
3147 @RenderBlockList(subBlocks)
3148 </div>
3149 </div>
3150 </nav>
3151 }
3152
3153 @helper RenderMobileHeaderNavigation() {
3154 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList();
3155
3156 <div class="grid__col-auto-width">
3157 <ul class="menu dw-mod">
3158 @RenderBlockList(subBlocks)
3159 </ul>
3160 </div>
3161 }
3162
3163 @helper RenderMobileHeaderNavigationTrigger() {
3164 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">
3165 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label>
3166 </li>
3167 }
3168
3169 @helper RenderMobileHeaderLogo() {
3170 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList();
3171
3172 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";
3173 string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : "";
3174 string firstPageId = Model.Area.FirstActivePage.ID.ToString();
3175 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName");
3176
3177 string mobileLogo = "/Files/Images/logo-dynamicweb.png";
3178 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null)
3179 {
3180 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded;
3181 }
3182
3183 if (Path.GetExtension(mobileLogo).ToLower() != ".svg")
3184 {
3185 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&crop=5&Compression=75&image=" + mobileLogo;
3186 }
3187 else
3188 {
3189 mobileLogo = HttpUtility.UrlDecode(mobileLogo);
3190 }
3191
3192 <div class="grid__col-auto grid__col--bleed">
3193 <div class="grid__cell @centeredLogo">
3194 <a href="/Default.aspx?ID=@firstPageId" class="logo logo--mobile u-inline-block dw-mod">
3195 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" />
3196 </a>
3197 </div>
3198
3199 @RenderBlockList(subBlocks)
3200 </div>
3201 }
3202
3203 @helper RenderMobileTopActions() {
3204 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList();
3205
3206 <div class="grid__col-auto-width">
3207 <ul class="menu dw-mod">
3208 @RenderBlockList(subBlocks)
3209 </ul>
3210 </div>
3211 }
3212
3213 @helper RenderMobileTopSearch() {
3214 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">
3215 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod">
3216 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i>
3217 </label>
3218 </li>
3219 }
3220
3221 @helper RenderMobileTopMiniCart() {
3222 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
3223 int cartPageId = GetPageIdByNavigationTag("CartPage");
3224 double cartProductsCount = Model.Cart.TotalProductsCount;
3225
3226 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper">
3227 <div class="mini-cart dw-mod">
3228 <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">
3229 <div class="u-inline u-position-relative">
3230 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i>
3231 <div class="mini-cart__counter dw-mod">
3232 <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">
3233 <div class="js-mini-cart-counter-content" data-count="@cartProductsCount">
3234 @cartProductsCount
3235 </div>
3236 </div>
3237 </div>
3238 </div>
3239 </a>
3240 </div>
3241 </li>
3242 }
3243
3244 @helper RenderMobileTopSearchBar()
3245 {
3246 string searchFeedId = "";
3247 string searchSecondFeedId = "";
3248 int groupsFeedId;
3249 int productsPageId = GetPageIdByNavigationTag("ProductsPage");
3250 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;
3251 string resultPageLink;
3252 string searchPlaceholder;
3253 string searchType = "product-search";
3254 string searchTemplate;
3255 string searchContentTemplate = "";
3256 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? "";
3257 bool showGroups = true;
3258
3259 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch")
3260 {
3261 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true";
3262 resultPageLink = contentSearchPageLink;
3263 searchPlaceholder = Translate("Search page");
3264 groupsFeedId = 0;
3265 searchType = "content-search";
3266 searchTemplate = "SearchPagesTemplate";
3267 showGroups = false;
3268 }
3269 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch")
3270 {
3271 searchFeedId = productsPageId + "&feed=true";
3272 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true";
3273 resultPageLink = Converter.ToString(productsPageId);
3274 searchPlaceholder = Translate("Search products or pages");
3275 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed");
3276 searchType = "combined-search";
3277 searchTemplate = "SearchProductsTemplateWrap";
3278 searchContentTemplate = "SearchPagesTemplateWrap";
3279 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector");
3280 }
3281 else
3282 {
3283 resultPageLink = Converter.ToString(productsPageId);
3284 searchFeedId = productsPageId + "&feed=true";
3285 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed");
3286 searchPlaceholder = Translate("Search products");
3287 searchTemplate = "SearchProductsTemplate";
3288 searchType = "product-search";
3289 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector");
3290 }
3291
3292
3293 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" />
3294
3295 <div class="main-navigation-mobile typeahead-mobile dw-mod">
3296 <div class="center-container top-container__center-container dw-mod">
3297 <div class="grid">
3298 <div class="grid__col-auto">
3299 <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">
3300 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue">
3301 @if (string.IsNullOrEmpty(searchSecondFeedId))
3302 {
3303 <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>
3304 }
3305 else
3306 {
3307 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid">
3308 <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>
3309 <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>
3310 </div>
3311 }
3312 <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>
3313 </div>
3314 </div>
3315 <div class="grid__col-auto-width">
3316 <ul class="menu dw-mod">
3317 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">
3318 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod">
3319 <i class="fas fa-times fa-1_5x"></i>
3320 </label>
3321 </li>
3322 </ul>
3323 </div>
3324 </div>
3325 </div>
3326 </div>
3327 }
3328
3329 @helper RenderMobileMiniCartCounterContent()
3330 {
3331 <script id="MiniCartCounterContent" type="text/x-template">
3332 {{#.}}
3333 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}">
3334 {{numberofproducts}}
3335 </div>
3336 {{/.}}
3337 </script>
3338 }
3339
3340 </text>
3341 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
3342
3343 @using System
3344 @using System.Web
3345 @using System.Collections.Generic
3346 @using Dynamicweb.Rapido.Blocks.Extensibility
3347 @using Dynamicweb.Rapido.Blocks
3348
3349 @functions {
3350 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master");
3351 }
3352
3353 @{
3354 bool mobileNavigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn");
3355 bool mobileHideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");
3356 bool mobileHideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile");
3357 bool mobileHideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders");
3358 bool mobileHideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards");
3359 bool mobileHideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites");
3360
3361 Block mobileNavigation = new Block()
3362 {
3363 Id = "MobileNavigation",
3364 SortId = 10,
3365 Template = MobileNavigation(),
3366 SkipRenderBlocksList = true
3367 };
3368 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation);
3369
3370 if (Model.CurrentUser.ID > 0 && !mobileHideMyProfileLink)
3371 {
3372 Block mobileNavigationSignIn = new Block
3373 {
3374 Id = "MobileNavigationSignIn",
3375 SortId = 10,
3376 Template = RenderMobileNavigationSignIn()
3377 };
3378 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn);
3379 }
3380
3381 if (Model.CurrentUser.ID > 0)
3382 {
3383 Block mobileNavigationMenu = new Block
3384 {
3385 Id = "MobileNavigationMenu",////////////////////////////////////////////////////////////////////////////////
3386 SortId = 20,
3387 Template = RenderMobileNavigationMenu()
3388 };
3389 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu);
3390
3391 Block mobileNavigationActions = new Block
3392 {
3393 Id = "MobileNavigationActions", ////////////////////////////////////////////////////////////
3394 SortId = 30,
3395 Template = RenderMobileNavigationActions(),
3396 SkipRenderBlocksList = true
3397 };
3398 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions);
3399 }
3400 else
3401 {
3402 Block mobileNavigationMenu = new Block
3403 {
3404 Id = "MobileNavigationMenu",////////////////////////////////////////////////////////////////////////////////
3405 SortId = 30,
3406 Template = RenderMobileNavigationMenu()
3407 };
3408 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu);
3409
3410 Block mobileNavigationActions = new Block
3411 {
3412 Id = "MobileNavigationActions", ////////////////////////////////////////////////////////////
3413 SortId = 20,
3414 Template = RenderMobileNavigationActions(),
3415 SkipRenderBlocksList = true
3416 };
3417 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions);
3418 }
3419 if (!mobileNavigationItemsHideSignIn)
3420 {
3421 if (Model.CurrentUser.ID <= 0)
3422 {
3423 Block mobileNavigationSignInAction = new Block
3424 {
3425 Id = "MobileNavigationSignInAction",
3426 SortId = 10,
3427 Template = RenderMobileNavigationSignInAction()
3428 };
3429 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction);
3430
3431 if (!mobileHideCreateAccountLink)
3432 {
3433 Block mobileNavigationCreateAccountAction = new Block
3434 {
3435 Id = "MobileNavigationCreateAccountAction",
3436 SortId = 20,
3437 Template = RenderMobileNavigationCreateAccountAction()
3438 };
3439 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction);
3440 }
3441 }
3442 else
3443 {
3444 //CS NT Show 'My Account'
3445 Block mobileNavigationMyAccount = new Block
3446 {
3447 Id = "MobileNavigationMyAccount",
3448 SortId = 19,
3449 Template = RenderMobileNavigationMyAccount()
3450 };
3451 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationMyAccount);
3452
3453
3454 if (!mobileHideMyOrdersLink)
3455 {
3456 Block mobileNavigationOrdersAction = new Block
3457 {
3458 Id = "MobileNavigationOrdersAction",
3459 SortId = 20,
3460 Template = RenderMobileNavigationOrdersAction()
3461 };
3462 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction);
3463
3464
3465 Block mobileNavigationTrackOrdersAction = new Block
3466 {
3467 Id = "MobileNavigationTrackOrdersAction",
3468 SortId = 20,
3469 Template = RenderMobileNavigationTrackOrdersAction()
3470 };
3471 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationTrackOrdersAction);
3472 }
3473 if (!mobileHideMyFavoritesLink)
3474 {
3475 Block mobileNavigationFavoritesAction = new Block
3476 {
3477 Id = "MobileNavigationFavoritesAction",
3478 SortId = 30,
3479 Template = RenderMobileNavigationFavoritesAction()
3480 };
3481 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction);
3482 }
3483 if (!mobileHideMySavedCardsLink)
3484 {
3485 Block mobileNavigationSavedCardsAction = new Block
3486 {
3487 Id = "MobileNavigationFavoritesAction",
3488 SortId = 30,
3489 Template = RenderMobileNavigationSavedCardsAction()
3490 };
3491 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction);
3492 }
3493
3494 Block mobileNavigationSignOutAction = new Block
3495 {
3496 Id = "MobileNavigationSignOutAction",
3497 SortId = 40,
3498 Template = RenderMobileNavigationSignOutAction()
3499 };
3500 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction);
3501 }
3502 }
3503
3504 /*CS NT Hide for now*/
3505 if (Model.Languages.Count > 1)
3506 {
3507 Block mobileNavigationLanguagesAction = new Block
3508 {
3509 Id = "MobileNavigationLanguagesAction",
3510 SortId = 50,
3511 Template = RenderMobileNavigationLanguagesAction()
3512 };
3513 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction);
3514 }
3515
3516 }
3517
3518
3519 @helper MobileNavigation()
3520 {
3521 List<Block>
3522 subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList();
3523 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left";
3524 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right";
3525
3526 <!-- Trigger for mobile navigation -->
3527 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" />
3528
3529 <!-- Mobile navigation -->
3530 <nav class="mobile-navigation mobile-navigation--@position dw-mod">
3531 <div class="mobile-navigation__wrapper" id="mobileNavigationWrapper">
3532 @RenderBlockList(subBlocks)
3533 </div>
3534 </nav>
3535
3536 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label>
3537 }
3538
3539 @helper RenderMobileNavigationSignIn()
3540 {
3541 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
3542 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");
3543 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
3544 string myProfilePageLink = linkStart + myProfilePageId;
3545 string userName = Model.CurrentUser.FirstName ?? "";
3546 userName += " " + (Model.CurrentUser.LastName ?? "");
3547 userName += userName == "" && Model.CurrentUser.UserName != null ? Model.CurrentUser.UserName : "";
3548
3549 <ul class="menu menu-mobile">
3550 <li class="menu-mobile__item">
3551 <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>
3552 </li>
3553 </ul>
3554 }
3555
3556 @helper RenderMobileNavigationMenu()
3557 {
3558 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides";
3559 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt";
3560 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3";
3561 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");
3562 int startLevel = renderPagesInToolBar ? 1 : 0;
3563
3564 @RenderNavigation(new
3565 {
3566 id = "mobilenavigation",
3567 cssclass = "menu menu-mobile dwnavigation",
3568 startLevel = @startLevel,
3569 ecomStartLevel = @startLevel + 1,
3570 endlevel = @levels,
3571 expandmode = "all",
3572 template = @menuTemplate
3573 })
3574
3575
3576 if (isSlidesDesign)
3577 {
3578 <script>
3579 function goToLevel(level) {
3580 document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%";
3581 }
3582
3583 document.addEventListener('DOMContentLoaded', function () {
3584 goToLevel(document.getElementById('mobileNavigationWrapper').querySelectorAll('input[type=radio]:checked').length);
3585 });
3586 </script>
3587 }
3588
3589 if (renderPagesInToolBar)
3590 {
3591 @RenderNavigation(new
3592 {
3593 id = "topToolsMobileNavigation",
3594 cssclass = "menu menu-mobile dwnavigation",
3595 template = "ToolsMenuForMobile.xslt"
3596 })
3597 }
3598 }
3599
3600 @helper RenderMobileNavigationActions()
3601 {
3602 List<Block>
3603 subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ;
3604
3605 <ul class="menu menu-mobile">
3606 @RenderBlockList(subBlocks)
3607 </ul>
3608 }
3609
3610 @helper RenderMobileNavigationSignInAction()
3611 {
3612 <img class="mobile-img" src="Files/Images/HB_Mobile.png"></img>
3613 int signInPageId = GetPageIdByNavigationTag("SignInPage");
3614 string signInPageLink = "/default.aspx?ID=" + signInPageId;
3615 <li class="menu-mobile__item mobile-sign-in">
3616 <a class="menu-mobile__link dw-mod menu-mobile__link--highlighted mobile-sign-in-btn" href="@signInPageLink">@Translate("Sign in")</a>
3617 </li>
3618 @*CS NT Do not open modal, redirect to login page
3619 <li class="menu-mobile__item">
3620 <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>
3621 </li>
3622 *@
3623 }
3624
3625 @helper RenderMobileNavigationCreateAccountAction()
3626 {
3627 //CS NT int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");
3628 int createAccountPageId = GetPageIdByNavigationTag("CreateECommerceAccount");
3629
3630 <li class="menu-mobile__item mobile-create-account">
3631 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod mobile-create-account-btn" href="/Default.aspx?ID=@createAccountPageId">
3632 @*<i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i>*@
3633 @Translate("Create account")</a>
3634 </li>
3635 }
3636
3637 @helper RenderMobileNavigationProfileAction()
3638 {
3639 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
3640 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
3641 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");
3642 string myProfilePageLink = linkStart + myProfilePageId;
3643
3644 <li class="menu-mobile__item">
3645 <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>
3646 </li>
3647 }
3648
3649 @helper RenderMobileNavigationMyAccount()
3650 {
3651 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
3652 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
3653 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");
3654 string myProfilePageLink = linkStart + myProfilePageId;
3655
3656 <li class="menu-mobile__item">
3657 <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 Account")</a>
3658 </li>
3659 }
3660
3661 @helper RenderMobileNavigationOrdersAction()
3662 {
3663 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
3664 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
3665 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders");
3666 string myOrdersPageLink = linkStart + myOrdersPageId;
3667 string ordersIcon = "fas fa-list";
3668
3669 <li class="menu-mobile__item">
3670 <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>
3671 </li>
3672 }
3673 @helper RenderMobileNavigationTrackOrdersAction()
3674 {
3675 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
3676 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
3677 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders");
3678 string myOrdersPageLink = linkStart + myOrdersPageId;
3679 string ordersIcon = "fas fa-box";
3680
3681 <li class="menu-mobile__item">
3682 <a href="@myOrdersPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@ordersIcon menu-mobile__link-icon"></i> @Translate("Track your order")</a>
3683 </li>
3684 }
3685
3686 @helper RenderMobileNavigationFavoritesAction()
3687 {
3688 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
3689 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
3690 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");
3691 string myFavoritesPageLink = linkStart + myFavoritesPageId;
3692 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";
3693
3694
3695 <li class="menu-mobile__item">
3696 <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>
3697 </li>
3698 }
3699
3700 @helper RenderMobileNavigationSavedCardsAction()
3701 {
3702 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
3703 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
3704 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards");
3705 string mySavedCardsPageLink = linkStart + mySavedCardsPageId;
3706 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";
3707
3708 <li class="menu-mobile__item">
3709 <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>
3710 </li>
3711 }
3712
3713 @helper RenderMobileNavigationSignOutAction()
3714 {
3715 int pageId = Model.TopPage.ID;
3716 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";
3717
3718 <li class="menu-mobile__item">
3719 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId"><i class="@signOutIcon menu-mobile__link-icon"></i> @Translate("Sign out")</a>
3720 </li>
3721 }
3722
3723 @helper RenderMobileNavigationLanguagesAction()
3724 {
3725 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides";
3726
3727 string selectedLanguage = "";
3728 foreach (var lang in Model.Languages)
3729 {
3730 if (lang.IsCurrent)
3731 {
3732 selectedLanguage = lang.Name;
3733 }
3734 }
3735
3736 <li class="menu-mobile__item dw-mod">
3737 @if (isSlidesDesign)
3738 {
3739 <input id="MobileMenuCheck_Language" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(1);">
3740 }
3741 else
3742 {
3743 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger">
3744 }
3745 <div class="menu-mobile__link__wrap">
3746 <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>
3747 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label>
3748 </div>
3749 <ul class="menu-mobile menu-mobile__submenu expand-menu">
3750 @if (isSlidesDesign)
3751 {
3752 <li class="menu-mobile__item dw-mod">
3753 <div class="menu-mobile__link__wrap">
3754 <input id="MobileMenuCheck_Language_back" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(0);" />
3755 <label for="MobileMenuCheck_Language_back" class="menu-mobile__trigger menu-mobile__trigger--back"></label>
3756 <label for="MobileMenuCheck_Language_back" class="menu-mobile__link dw-mod ">@Translate("Back")</label>
3757 </div>
3758 </li>
3759 }
3760 @foreach (var lang in Model.Languages)
3761 {
3762 <li class="menu-mobile__item dw-mod">
3763 <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>
3764 </li>
3765 }
3766 </ul>
3767 </li>
3768 }
3769 </text>
3770 }
3771 else
3772 {
3773 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
3774
3775 @using System
3776 @using System.Web
3777 @using System.Collections.Generic
3778 @using Dynamicweb.Rapido.Blocks.Extensibility
3779 @using Dynamicweb.Rapido.Blocks
3780
3781 @functions {
3782 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master");
3783 }
3784
3785 @{
3786 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
3787 {
3788 Block topBannerNT = new Block()
3789 {
3790 Id = "TopBannerNT",
3791 SortId = 9,
3792 Template = RendertopBannerNT(),
3793 SkipRenderBlocksList = true
3794 };
3795 headerBlocksPage.Add("MasterHeader", topBannerNT);
3796
3797 Block masterTools = new Block()
3798 {
3799 Id = "MasterDesktopTools",
3800 SortId = 10,
3801 Template = RenderDesktopTools(),
3802 SkipRenderBlocksList = true,
3803 BlocksList = new List<Block>
3804 {
3805 new Block {
3806 Id = "MasterDesktopToolsText",
3807 SortId = 10,
3808 Template = RenderDesktopToolsText(),
3809 Design = new Design
3810 {
3811 Size = "auto",
3812 HidePadding = true,
3813 RenderType = RenderType.Column
3814 }
3815 },
3816 new Block {
3817 Id = "MasterDesktopToolsNavigation",
3818 SortId = 20,
3819 Template = RenderDesktopToolsNavigation(),
3820 Design = new Design
3821 {
3822 Size = "auto-width",
3823 HidePadding = true,
3824 RenderType = RenderType.Column
3825 }
3826 }
3827 }
3828 };
3829 headerBlocksPage.Add("MasterHeader", masterTools);
3830 }
3831
3832 Block masterDesktopExtra = new Block()
3833 {
3834 Id = "MasterDesktopExtra",
3835 SortId = 10,
3836 Template = RenderDesktopExtra(),
3837 SkipRenderBlocksList = true
3838 };
3839 headerBlocksPage.Add("MasterHeader", masterDesktopExtra);
3840
3841 Block masterDesktopNavigation = new Block()
3842 {
3843 Id = "MasterDesktopNavigation",
3844 SortId = 20,
3845 Template = RenderDesktopNavigation(),
3846 SkipRenderBlocksList = true
3847 };
3848 headerBlocksPage.Add("MasterHeader", masterDesktopNavigation);
3849 }
3850
3851
3852 @*Include the Blocks for the page *@
3853 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
3854
3855 @using System
3856 @using System.Web
3857 @using Dynamicweb.Rapido.Blocks.Extensibility
3858 @using Dynamicweb.Rapido.Blocks
3859
3860 @{
3861 Block masterDesktopLogo = new Block
3862 {
3863 Id = "MasterDesktopLogo",
3864 SortId = 10,
3865 Template = RenderDesktopLogo(),
3866 Design = new Design
3867 {
3868 Size = "auto-width",
3869 HidePadding = true,
3870 RenderType = RenderType.Column,
3871 CssClass = "grid--align-self-center"
3872 }
3873 };
3874
3875 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo);
3876 }
3877
3878
3879 @helper RenderDesktopLogo()
3880 {
3881 string firstPageId = Model.Area.FirstActivePage.ID.ToString();
3882 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
3883 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : "";
3884 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png";
3885 if (Path.GetExtension(logo).ToLower() != ".svg")
3886 {
3887 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight");
3888 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40;
3889 logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&crop=5&Compression=75&image=" + logo;
3890 }
3891 else
3892 {
3893 logo = HttpUtility.UrlDecode(logo);
3894 }
3895
3896 <div class="logo @alignClass dw-mod">
3897 <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block">
3898 <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" />
3899 </a>
3900 </div>
3901 }
3902 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
3903
3904 @using System
3905 @using System.Web
3906 @using Dynamicweb.Rapido.Blocks.Extensibility
3907 @using Dynamicweb.Rapido.Blocks
3908
3909 @functions {
3910 bool isMegaMenu;
3911 }
3912
3913 @{
3914 isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false;
3915 Block masterDesktopMenu = new Block
3916 {
3917 Id = "MasterDesktopMenu",
3918 SortId = 10,
3919 Template = RenderDesktopMenu(),
3920 Design = new Design
3921 {
3922 Size = "auto",
3923 HidePadding = true,
3924 RenderType = RenderType.Column
3925 }
3926 };
3927
3928 if (isMegaMenu)
3929 {
3930 masterDesktopMenu.Design.CssClass = "u-reset-position";
3931 }
3932
3933 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu);
3934 }
3935
3936 @helper RenderDesktopMenu()
3937 {
3938 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
3939 string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : "";
3940 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : "";
3941 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");
3942 bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders");
3943 int startLevel = renderPagesInToolBar ? 1 : 0;
3944
3945 string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink");
3946
3947 <div class="grid__cell u-flex @(isMegaMenu ? "u-reset-position" : "") @menuAlignment">
3948 @if (!isMegaMenu)
3949 {
3950 @RenderNavigation(new
3951 {
3952 id = "topnavigation",
3953 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap",
3954 startLevel = startLevel,
3955 ecomStartLevel = startLevel + 1,
3956 endlevel = 5,
3957 expandmode = "all",
3958 template = "BaseMenuWithDropdown.xslt"
3959 });
3960 }
3961 else
3962 {
3963 @RenderNavigation(new
3964 {
3965 id = "topnavigation",
3966 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap",
3967 startLevel = startLevel,
3968 ecomStartLevel = startLevel + 1,
3969 endlevel = 5,
3970 promotionImage = megamenuPromotionImage,
3971 promotionLink = promotionLink,
3972 expandmode = "all",
3973 showOnlyHeaders = showOnlyHeaders.ToString().ToLower(),
3974 template = "BaseMegaMenu.xslt"
3975 });
3976 }
3977 </div>
3978 }
3979
3980
3981 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
3982
3983 @using System
3984 @using System.Web
3985 @using Dynamicweb.Rapido.Blocks.Extensibility
3986 @using Dynamicweb.Rapido.Blocks
3987
3988 @{
3989 Block masterDesktopActionsMenu = new Block
3990 {
3991 Id = "MasterDesktopActionsMenu",
3992 SortId = 10,
3993 Template = RenderDesktopActionsMenu(),
3994 Design = new Design
3995 {
3996 CssClass = "u-flex"
3997 },
3998 SkipRenderBlocksList = true
3999
4000 };
4001 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu);
4002
4003 //CS NT..
4004 Block masterDesktopActionsHeaderButtonRewards = new Block
4005 {
4006 Id = "MasterDesktopActionsHeaderButtonRewards",
4007 SortId = 1,
4008 Template = RenderHeaderButtonRewards()
4009 };
4010 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButtonRewards);
4011 //..CS NT
4012
4013 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink")))
4014 {
4015 Block masterDesktopActionsHeaderButton = new Block
4016 {
4017 Id = "MasterDesktopActionsHeaderButton",
4018 SortId = 60,
4019 Template = RenderHeaderButton()
4020 };
4021 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton);
4022 }
4023
4024
4025 }
4026
4027 @helper RenderDesktopActionsMenu()
4028 {
4029 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList();
4030
4031 <ul class="menu u-flex dw-mod">
4032 @RenderBlockList(subBlocks)
4033 </ul>
4034 }
4035
4036 @helper RenderHeaderButton()
4037 {
4038 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText");
4039 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink");
4040 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : "";
4041
4042 <li class="menu__item menu__item--horizontal menu--clean dw-mod">
4043 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-top u-margin-left" href="@headerButtonLink">@headerButtonText</a>
4044 </li>
4045 }
4046 @helper RenderHeaderButtonRewards()
4047 {
4048 @*
4049 <div class="header-menu__link header-menu__link--icon dw-mod">
4050 <a href="/benefits-loyalty-scheme" class="u-color-inherit">
4051 <i class="fas fa-gift fa-1_5x"></i>
4052 </a>
4053 </div>
4054 *@
4055 <!-- Stores Icon -->
4056 <li class="menu__item menu__item--horizontal menu--clean menu__item--icon dw-mod">
4057 <a href="@Translate("/contact-us")" class="header-menu__link header-menu__link--icon dw-mod">
4058 <i class="far fa-location-dot fa-1_5x"></i>
4059 </a>
4060 </li>
4061
4062 <!-- Rewards Icon - Live link is different-->
4063 <li class="menu__item menu__item--horizontal menu--clean menu__item--icon dw-mod">
4064 <a href="@Translate("/mybenefits-card")" class="header-menu__link header-menu__link--icon dw-mod">
4065 <i class="far fa-gift fa-1_5x"></i>
4066 </a>
4067 </li>
4068
4069
4070 }
4071
4072 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4073
4074 @using System
4075 @using System.Web
4076 @using Dynamicweb.Core;
4077 @using System.Text.RegularExpressions
4078 @using Dynamicweb.Rapido.Blocks.Extensibility
4079 @using Dynamicweb.Rapido.Blocks
4080
4081 @{
4082 /*CS NT Hide this for now 20210303*/
4083 Block masterDesktopActionsMenuLanguageSelector = new Block
4084 {
4085 Id = "MasterDesktopActionsMenuLanguageSelector",
4086 SortId = 40,
4087 Template = RenderLanguageSelector()
4088 };
4089
4090 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector);
4091
4092 }
4093
4094 @helper RenderLanguageSelector()
4095 {
4096 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4097 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
4098 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
4099 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() : "";
4100
4101 if (Model.Languages.Count > 1)
4102 {
4103 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod">
4104 <div class="@menuLinkClass dw-mod">
4105 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i>
4106 </div>
4107 <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell">
4108 @foreach (var lang in Model.Languages)
4109 {
4110 string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty);
4111 cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1);
4112 string countryCodeNT = Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() == "cy" ? "gr" : Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower();
4113 string langInfo = "<span class=\"flag-icon flag-icon-" + countryCodeNT + " u-margin-right\"></span>" + lang.Name;
4114
4115 if (languageViewType == "flag-culture")
4116 {
4117 langInfo = "<span class=\"flag-icon cstest1 flag-icon-" + countryCodeNT + " \"></span> " + cultureName;
4118 }
4119
4120 if (languageViewType == "flag")
4121 {
4122 langInfo = "<span class=\"flag-icon cstest2 flag-icon-" + countryCodeNT + " \"></span>";
4123 }
4124
4125 if (languageViewType == "name")
4126 {
4127 langInfo = lang.Name;
4128 }
4129
4130 if (languageViewType == "culture")
4131 {
4132 langInfo = cultureName;
4133 }
4134
4135 <div class="menu__item dw-mod menu__item--fixed-width">
4136 <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__link dw-mod">@langInfo</a>
4137 </div>
4138 }
4139 </div>
4140 </li>
4141 }
4142 }
4143 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4144
4145 @using System
4146 @using System.Web
4147 @using Dynamicweb.Rapido.Blocks.Extensibility
4148 @using Dynamicweb.Rapido.Blocks
4149
4150 @{
4151 Block masterDesktopActionsMenuSignIn = new Block
4152 {
4153 Id = "MasterDesktopActionsMenuSignIn",
4154 SortId = 20,
4155 Template = RenderSignIn()
4156 };
4157
4158 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuSignIn);
4159 }
4160
4161 @helper RenderSignIn()
4162 {
4163 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn");
4164 string userInitials = "";
4165 int pageId = Model.TopPage.ID;
4166 //CS NT int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");
4167 int createAccountPageId = GetPageIdByNavigationTag("CreateECommerceAccount");
4168 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard");
4169 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");
4170 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders");
4171 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");
4172 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards");
4173 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4174 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");
4175 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile");
4176 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders");
4177 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards");
4178 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites");
4179 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink");
4180
4181 string linkStart = "/Default.aspx?ID=";
4182 if (Model.CurrentUser.ID <= 0)
4183 {
4184 linkStart += signInProfilePageId + "&RedirectPageId=";
4185 }
4186
4187
4188 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery";
4189 string myProfilePageLink = linkStart + myProfilePageId;
4190 string myOrdersPageLink = linkStart + myOrdersPageId;
4191 string myFavoritesPageLink = linkStart + myFavoritesPageId;
4192 string mySavedCardsPageLink = linkStart + mySavedCardsPageId;
4193
4194 string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user";
4195 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";
4196
4197 if (Model.CurrentUser.ID != 0)
4198 {
4199 if (!String.IsNullOrEmpty(Model.CurrentUser.Name))
4200 {
4201 string[] names = Model.CurrentUser.Name.Trim().Split(' ');
4202 userInitials += Model.CurrentUser.Name.Substring(0, 1);
4203
4204 if (names.Length > 1)
4205 {
4206 userInitials += names[names.Length - 1].Substring(0, 1);
4207 }
4208 }
4209 else
4210 {
4211 userInitials += Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName != "" ? Model.CurrentUser.FirstName.Substring(0, 1) : "";
4212 userInitials += Model.CurrentUser.LastName != null && Model.CurrentUser.LastName != "" ? Model.CurrentUser.LastName.Substring(0, 1) : "";
4213 userInitials += userInitials.Length == 1 && Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName.Length > 1 ? Model.CurrentUser.FirstName.Substring(1, 2) : "";
4214 userInitials += userInitials == "" && Model.CurrentUser.Email != null && Model.CurrentUser.Email.Length > 1 ? Model.CurrentUser.Email.Substring(0, 2) : "";
4215 userInitials += userInitials == "" ? Model.CurrentUser.UserName.Substring(0, 2) : "";
4216 }
4217 }
4218
4219 if (!navigationItemsHideSignIn)
4220 {
4221 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4222 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean";
4223 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
4224
4225 <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod">
4226 <div class="@menuLinkClass dw-mod">
4227 @if (Model.CurrentUser.ID <= 0)
4228 {
4229 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x"></i>
4230 }
4231 else
4232 {
4233 <!--<a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a>-->
4234 <a href="/@myProfilePageLink" class="u-color-inherit"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a>
4235 }
4236 </div>
4237 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod">
4238 <ul class="list list--clean dw-mod">
4239 @if (Model.CurrentUser.ID <= 0)
4240 {
4241 <li>
4242 <a class="btn btn--primary btn--full u-no-margin sign-in-modal-trigger-button dw-mod" href="/createecommerceaccount">@Translate("Sign in")</a>
4243 <!--Commented out by CS NT and added the line above <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>-->
4244 </li>
4245
4246 if (!hideCreateAccountLink)
4247 {
4248 @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account"));
4249 }
4250 if (!hideForgotPasswordLink)
4251 {
4252 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?"))
4253 }
4254 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink)
4255 {
4256 @RenderSeparator()
4257 }
4258 }
4259 @if (!hideMyProfileLink)
4260 {
4261 @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon)
4262 }
4263 @if (!hideMyOrdersLink)
4264 {
4265 @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list")
4266 }
4267 @if (!hideMyFavoritesLink)
4268 {
4269 @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon)
4270 }
4271 @if (!hideMySavedCardsLink)
4272 {
4273 @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card")
4274 }
4275 @if (Model.CurrentUser.ID > 0)
4276 {
4277 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink)
4278 {
4279 @RenderSeparator()
4280 }
4281
4282 @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out"))
4283 }
4284 </ul>
4285 </div>
4286 </li>
4287 }
4288 }
4289
4290 @helper RenderListItem(string link, string text, string icon = null) {
4291 <li>
4292 <a href="@link" class="list__link dw-mod">
4293 @if (!string.IsNullOrEmpty(icon))
4294 {
4295 <i class="@icon u-margin-right"></i>
4296 }
4297 @text
4298 </a>
4299 </li>
4300 }
4301
4302 @helper RenderSeparator()
4303 {
4304 <li class="list__seperator dw-mod"></li>
4305 }
4306 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4307
4308 @using System
4309 @using System.Web
4310 @using Dynamicweb.Rapido.Blocks.Extensibility
4311 @using Dynamicweb.Rapido.Blocks
4312
4313 @{
4314 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites");
4315
4316 Block masterDesktopActionsMenuFavorites = new Block
4317 {
4318 Id = "MasterDesktopActionsMenuFavorites",
4319 SortId = 30,
4320 Template = RenderFavorites()
4321 };
4322
4323 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0)
4324 {
4325 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites);
4326 }
4327 }
4328
4329 @helper RenderFavorites()
4330 {
4331 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");
4332 string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId;
4333
4334 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4335 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
4336 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
4337
4338 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod">
4339 <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod">
4340 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i>
4341 </a>
4342 </li>
4343 }
4344 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4345
4346 @using System
4347 @using System.Web
4348 @using Dynamicweb.Rapido.Blocks.Extensibility
4349 @using Dynamicweb.Rapido.Blocks
4350
4351 @{
4352 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0;
4353 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart");
4354 string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown";
4355
4356 if (!onlyPreview && !hideCart)
4357 {
4358 Block masterDesktopActionsMenuMiniCart = new Block
4359 {
4360 Id = "MasterDesktopActionsMenuMiniCart",
4361 SortId = 50,
4362 Template = RenderMiniCart(miniCartLayout == "dropdown"),
4363 SkipRenderBlocksList = true,
4364 BlocksList = new List<Block>()
4365 };
4366
4367 Block miniCartCounterScriptTemplate = new Block
4368 {
4369 Id = "MiniCartCounterScriptTemplate",
4370 Template = RenderMiniCartCounterContent()
4371 };
4372
4373 //dropdown layout is default
4374 RazorEngine.Templating.TemplateWriter layoutTemplate = RenderMiniCartDropdownLayout();
4375 RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate = RenderMiniCartTriggerLink();
4376
4377 switch (miniCartLayout)
4378 {
4379 case "panel":
4380 layoutTemplate = RenderMiniCartPanelLayout();
4381 miniCartTriggerTemplate = RenderMiniCartTriggerLabel();
4382 break;
4383 case "modal":
4384 layoutTemplate = RenderMiniCartModalLayout();
4385 miniCartTriggerTemplate = RenderMiniCartTriggerLabel();
4386 break;
4387 }
4388
4389 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block
4390 {
4391 Id = "MiniCartTrigger",
4392 Template = miniCartTriggerTemplate
4393 });
4394
4395 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
4396 {
4397 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block
4398 {
4399 Id = "MiniCartLayout",
4400 Template = layoutTemplate
4401 });
4402 }
4403
4404 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuMiniCart);
4405 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate);
4406 }
4407 }
4408
4409 @helper RenderMiniCart(bool hasMouseEnterEvent)
4410 {
4411 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterDesktopActionsMenuMiniCart").OrderBy(item => item.SortId).ToList();
4412 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4413 string liClasses = topLayout != "normal" ? "menu__item--top-level" : "menu--clean";
4414 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
4415 string mouseEvent = "";
4416 string id = "MiniCart";
4417 if (hasMouseEnterEvent)
4418 {
4419 mouseEvent = "onmouseenter=\"Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=" + miniCartFeedPageId + "&feedType=MiniCart')\"";
4420 id = "miniCartTrigger";
4421 }
4422 <li class="menu__item menu__item--horizontal menu__item--icon @liClasses dw-mod" id="@id" @mouseEvent>
4423 @RenderBlockList(subBlocks)
4424 </li>
4425 }
4426
4427 @helper RenderMiniCartTriggerLabel()
4428 {
4429 int cartPageId = GetPageIdByNavigationTag("CartPage");
4430 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart";
4431 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4432 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
4433 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
4434
4435 <div class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')">
4436 <div class="u-inline u-position-relative">
4437 <i class="@cartIcon fa-1_5x"></i>
4438 @RenderMiniCartCounter()
4439 </div>
4440 </div>
4441 }
4442
4443 @helper RenderMiniCartTriggerLink()
4444 {
4445 int cartPageId = GetPageIdByNavigationTag("CartPage");
4446 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart";
4447 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4448 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
4449
4450 <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button">
4451 <div class="u-inline u-position-relative">
4452 <i class="@cartIcon fa-1_5x"></i>
4453 @RenderMiniCartCounter()
4454 </div>
4455 </a>
4456 }
4457
4458 @helper RenderMiniCartCounter()
4459 {
4460 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
4461 string cartProductsCount = Model.Cart.TotalProductsCount.ToString();
4462 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";
4463 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice");
4464 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : "";
4465 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : "";
4466
4467 if (showPrice && counterPosition == "right")
4468 {
4469 cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")";
4470 }
4471
4472 <div class="mini-cart__counter dw-mod">
4473 <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">
4474 <div class="js-mini-cart-counter-content" data-count="@Model.Cart.TotalProductsCount.ToString()">
4475 @cartProductsCount
4476 @cartProductsTotalPrice
4477 </div>
4478 </div>
4479 </div>
4480 }
4481
4482 @helper RenderMiniCartCounterContent()
4483 {
4484 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice");
4485 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";
4486 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice;
4487
4488 <script id="MiniCartCounterContent" type="text/x-template">
4489 {{#.}}
4490 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}">
4491 @if (showPriceInMiniCartCounter)
4492 {
4493 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text>
4494 }
4495 else
4496 {
4497 <text>{{numberofproducts}}</text>
4498 }
4499 </div>
4500 {{/.}}
4501 </script>
4502 }
4503
4504 @helper RenderMiniCartDropdownLayout()
4505 {
4506 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
4507 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");
4508
4509 <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">
4510 <div class="mini-cart-dropdown__inner dw-mod">
4511 <h3 class="u-ta-center dw-mod">@Translate("Shopping cart")</h3>
4512 <div class="mini-cart-dropdown__body u-flex dw-mod">
4513 <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>
4514 </div>
4515 </div>
4516 </div>
4517 }
4518
4519 @helper RenderMiniCartPanelLayout()
4520 {
4521 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
4522 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");
4523
4524 <div class="mini-cart grid__cell dw-mod">
4525 <input type="checkbox" id="miniCartTrigger" class="panel-trigger" />
4526 <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">
4527 <label for="miniCartTrigger" class="panel__close-btn" title="@Translate("Close panel")"><i class="fas fa-times"></i></label>
4528 <div class="panel__content u-full-width dw-mod">
4529 <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3>
4530 <div class="panel__content-body panel__content-body--cart dw-mod">
4531 <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>
4532 </div>
4533 </div>
4534 </div>
4535 </div>
4536 }
4537
4538 @helper RenderMiniCartModalLayout()
4539 {
4540 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
4541 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");
4542
4543 <div class="mini-cart grid__cell dw-mod">
4544 <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" />
4545 <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink">
4546 <label for="miniCartTrigger" class="modal-overlay"></label>
4547 <div class="modal modal--top-right dw-mod">
4548 <div class="modal__body u-flex grid--direction-column dw-mod">
4549 <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3>
4550 <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>
4551 </div>
4552 <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label>
4553 </div>
4554 </div>
4555 </div>
4556 }
4557 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4558
4559 @using System
4560 @using System.Web
4561 @using Dynamicweb.Rapido.Blocks.Extensibility
4562 @using Dynamicweb.Rapido.Blocks
4563
4564 @{
4565 bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart");
4566
4567 Block masterDesktopActionsMenuDownloadCart = new Block
4568 {
4569 Id = "MasterDesktopActionsMenuDownloadCart",
4570 SortId = 35,
4571 Template = RenderDownloadCart()
4572 };
4573
4574 if (showDownloadCartLink && Model.CurrentUser.ID > 0)
4575 {
4576 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuDownloadCart);
4577 }
4578 }
4579
4580 @helper RenderDownloadCart()
4581 {
4582 int downloadCartPageId = GetPageIdByNavigationTag("DownloadCart");
4583 string downloadCartPageLink = "/Default.aspx?ID=" + downloadCartPageId;
4584
4585 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4586 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
4587 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
4588
4589 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod">
4590 <a href="@downloadCartPageLink" class="@menuLinkClass dw-mod">
4591 <i class="fas fa-cart-arrow-down fa-1_5x"></i>
4592 </a>
4593 </li>
4594 }
4595 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4596
4597 @using System
4598 @using System.Web
4599 @using Dynamicweb.Rapido.Blocks.Extensibility
4600 @using Dynamicweb.Rapido.Blocks
4601
4602 @functions {
4603 public class SearchConfiguration
4604 {
4605 public string searchFeedId { get; set; }
4606 public string searchSecondFeedId { get; set; }
4607 public int groupsFeedId { get; set; }
4608 public string resultPageLink { get; set; }
4609 public string searchPlaceholder { get; set; }
4610 public string searchType { get; set; }
4611 public string searchTemplate { get; set; }
4612 public string searchContentTemplate { get; set; }
4613 public string searchValue { get; set; }
4614 public bool showGroups { get; set; }
4615
4616 public SearchConfiguration()
4617 {
4618 searchFeedId = "";
4619 searchSecondFeedId = "";
4620 searchType = "product-search";
4621 searchContentTemplate = "";
4622 showGroups = true;
4623 }
4624 }
4625 }
4626 @{
4627 Block masterSearchBar = new Block
4628 {
4629 Id = "MasterSearchBar",
4630 SortId = 40,
4631 Template = RenderSearch("bar"),
4632 Design = new Design
4633 {
4634 Size = "auto",
4635 HidePadding = true,
4636 RenderType = RenderType.Column
4637 }
4638 };
4639
4640 Block masterSearchAction = new Block
4641 {
4642 Id = "MasterDesktopActionsMenuSearch",
4643 SortId = 10,
4644 Template = RenderSearch()
4645 };
4646
4647 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar);
4648 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction);
4649 }
4650
4651 @helper RenderSearch(string type = "mini-search")
4652 {
4653 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage"));
4654 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;
4655 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch";
4656
4657 SearchConfiguration searchConfiguration = null;
4658
4659 switch (searchType) {
4660 case "contentSearch":
4661 searchConfiguration = new SearchConfiguration() {
4662 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true",
4663 resultPageLink = contentSearchPageLink,
4664 searchPlaceholder = Translate("Search page"),
4665 groupsFeedId = 0,
4666 searchType = "content-search",
4667 searchTemplate = "SearchPagesTemplate",
4668 showGroups = false
4669 };
4670 break;
4671 case "combinedSearch":
4672 searchConfiguration = new SearchConfiguration() {
4673 searchFeedId = productsPageId + "&feed=true",
4674 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true",
4675 resultPageLink = Converter.ToString(productsPageId),
4676 searchPlaceholder = Translate("Search products or pages"),
4677 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"),
4678 searchType = "combined-search",
4679 searchTemplate = "SearchProductsTemplateWrap",
4680 searchContentTemplate = "SearchPagesTemplateWrap",
4681 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector")
4682 };
4683 break;
4684 default: //productSearch
4685 searchConfiguration = new SearchConfiguration() {
4686 resultPageLink = Converter.ToString(productsPageId),
4687 searchFeedId = productsPageId + "&feed=true",
4688 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"),
4689 searchPlaceholder = Translate("Search products"),
4690 searchTemplate = "SearchProductsTemplate",
4691 searchType = "product-search",
4692 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector")
4693 };
4694 break;
4695 }
4696 searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? "";
4697
4698 if (type == "mini-search") {
4699 @RenderMiniSearch(searchConfiguration)
4700 } else {
4701 @RenderSearchBar(searchConfiguration)
4702 }
4703 }
4704
4705 @helper RenderSearchBar(SearchConfiguration options)
4706 {
4707 <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar"
4708 data-page-size="7"
4709 data-search-feed-id="@options.searchFeedId"
4710 data-search-second-feed-id="@options.searchSecondFeedId"
4711 data-result-page-id="@options.resultPageLink"
4712 data-groups-page-id="@options.groupsFeedId"
4713 data-search-type="@options.searchType">
4714 @if (options.showGroups)
4715 {
4716 <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>
4717 <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>
4718 }
4719 <div class="typeahead-search-field">
4720 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue">
4721 @if (string.IsNullOrEmpty(options.searchSecondFeedId))
4722 {
4723 <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>
4724 }
4725 else
4726 {
4727 <div class="dropdown dropdown--absolute-position dropdown--combined grid">
4728 <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>
4729 <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>
4730 </div>
4731 }
4732 </div>
4733 <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>
4734 </div>
4735 }
4736
4737 @helper RenderMiniSearch(SearchConfiguration options)
4738 {
4739 <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" onmouseover="document.getElementById('headerSearch').focus()">
4740 <div class="menu__link menu__link--icon dw-mod">
4741 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i>
4742 </div>
4743 <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod">
4744 <div class="typeahead js-typeahead" id="ProductSearchBar"
4745 data-page-size="7"
4746 data-search-feed-id="@options.searchFeedId"
4747 data-search-second-feed-id="@options.searchSecondFeedId"
4748 data-result-page-id="@options.resultPageLink"
4749 data-search-type="@options.searchType">
4750 <div class="typeahead-search-field">
4751 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue">
4752 @if (string.IsNullOrEmpty(options.searchSecondFeedId))
4753 {
4754 <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>
4755 }
4756 else
4757 {
4758 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned">
4759 <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>
4760 <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>
4761 </div>
4762 }
4763 </div>
4764 </div>
4765 </div>
4766 </li>
4767 }
4768 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4769
4770 @using System
4771 @using System.Web
4772 @using Dynamicweb.Rapido.Blocks.Extensibility
4773 @using Dynamicweb.Rapido.Blocks
4774
4775 @{
4776 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4777 bool hideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");
4778
4779 BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master");
4780
4781 Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo");
4782 headerConfigurationPage.RemoveBlock(configDesktopLogo);
4783
4784 Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu");
4785 headerConfigurationPage.RemoveBlock(configDesktopMenu);
4786
4787 Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar");
4788 headerConfigurationPage.RemoveBlock(configSearchBar);
4789
4790 Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch");
4791 headerConfigurationPage.RemoveBlock(configSearchAction);
4792
4793 Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu");
4794 headerConfigurationPage.RemoveBlock(configDesktopActionsMenu);
4795
4796 Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra");
4797
4798 switch (topLayout)
4799 {
4800 case "condensed": //2
4801 configDesktopLogo.Design.Size = "auto-width";
4802 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
4803
4804 configDesktopMenu.SortId = 20;
4805 configDesktopMenu.Design.Size = "auto";
4806 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
4807
4808 configDesktopActionsMenu.SortId = 30;
4809 configDesktopActionsMenu.Design.Size = "auto-width";
4810 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
4811
4812 if (!hideSearch)
4813 {
4814 configSearchBar.SortId = 40;
4815 configSearchBar.Design.Size = "12";
4816 configDesktopExtra.SortId = 50;
4817 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);
4818 }
4819 break;
4820 case "splitted": //3
4821 configDesktopLogo.Design.Size = "auto";
4822 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
4823
4824 if (!hideSearch)
4825 {
4826 configSearchBar.SortId = 20;
4827 configSearchBar.Design.Size = "auto";
4828 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);
4829 }
4830
4831 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
4832
4833 configDesktopActionsMenu.SortId = 20;
4834 configDesktopActionsMenu.Design.Size = "auto-width";
4835 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
4836 break;
4837 case "minimal": //4
4838 configDesktopLogo.Design.Size = "auto-width";
4839 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
4840
4841 configDesktopMenu.Design.Size = "auto";
4842 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
4843
4844 configDesktopActionsMenu.SortId = 20;
4845 configDesktopActionsMenu.Design.Size = "auto-width";
4846 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
4847
4848 if (!hideSearch)
4849 {
4850 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
4851 }
4852 break;
4853 case "minimal-right": //5
4854 configDesktopLogo.Design.Size = "auto-width";
4855 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
4856
4857 configDesktopMenu.Design.Size = "auto";
4858 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
4859
4860 configDesktopActionsMenu.SortId = 20;
4861 configDesktopActionsMenu.Design.Size = "auto-width";
4862 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
4863
4864 if (!hideSearch)
4865 {
4866 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
4867 }
4868 break;
4869 case "two-lines": //6
4870 configDesktopLogo.Design.Size = "auto";
4871 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
4872
4873 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
4874
4875 configDesktopActionsMenu.SortId = 20;
4876 configDesktopActionsMenu.Design.Size = "auto-width";
4877 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
4878
4879 if (!hideSearch)
4880 {
4881 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
4882 }
4883 break;
4884 case "two-lines-centered": //7
4885 configDesktopLogo.Design.Size = "auto";
4886 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
4887
4888 configDesktopMenu.Design.Size = "auto-width";
4889 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
4890
4891 configDesktopActionsMenu.SortId = 20;
4892 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
4893
4894 if (!hideSearch)
4895 {
4896 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
4897 }
4898 break;
4899 case "normal": //1
4900 default:
4901 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
4902
4903 if (!hideSearch)
4904 {
4905 configSearchBar.SortId = 20;
4906 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);
4907 }
4908
4909 configDesktopActionsMenu.SortId = 30;
4910 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu);
4911
4912 configDesktopActionsMenu.Design.Size = "auto-width";
4913 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
4914 break;
4915 }
4916 }
4917 @if (File.Exists(HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/MasterBlocks/HeaderBlocks/Custom__Blocks.cshtml")))
4918 {
4919 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4920
4921 @using System
4922 @using System.Web
4923 @using Dynamicweb.Rapido.Blocks.Extensibility
4924 @using Dynamicweb.Rapido.Blocks
4925
4926 @{
4927
4928 }
4929
4930
4931 @helper RendertopBannerNT()
4932 {
4933
4934 bool enableTopBanner = true;//set to false to hide or true to show
4935 if(enableTopBanner)
4936 {
4937 <style>
4938 .widebar-style
4939 {
4940 height:45px;
4941 padding-top: 15px;
4942 text-align: center;
4943 }
4944 .GeneralParagrah
4945 {
4946 color:#fff;
4947 font-weight:700;
4948 font-size: 14px;
4949 --font-family-helvetica: helvetica,arial,verdana,tahoma,sans-serif;
4950 }
4951 .secondParagraph
4952 {
4953 margin-left:5px;
4954 background-color:#ffffffe0;
4955 color:red;
4956 padding:3px;
4957 }
4958 .timerInParagraph
4959 {
4960 color:#fff;
4961 font-weight:700;
4962 background-color:#262627c4;
4963 padding:3px;
4964 }
4965 @@media screen and (max-width: 480px) {
4966 .GeneralParagrah
4967 {
4968 font-size: 15px;
4969 }
4970 .widebar-style
4971 {
4972 padding-top: 3%;
4973 }
4974 }
4975 </style>
4976
4977
4978 <div style="background-color:#018476;" class="widebar-style widebar-style paragraph-container--full-width dw-mod">
4979 <a href="https://papaellinas.cloud.dynamicweb-cms.com/products/offers/more-offers/50-off-aug-2024">
4980 <span class="GeneralParagrah">@Translate("👉 50% off on selected products! ⭐") </span>
4981 </a>
4982 </div>
4983
4984 }
4985 }</text>
4986 }
4987
4988
4989 @helper RenderDesktopTools()
4990 {
4991 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList();
4992
4993
4994
4995 <div class="tools-navigation dw-mod">
4996 <div class="center-container grid top-container__center-container dw-mod">
4997 @RenderBlockList(subBlocks)
4998 </div>
4999 </div>
5000 }
5001
5002 @helper RenderDesktopToolsText()
5003 {
5004 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText");
5005 if (!string.IsNullOrEmpty(toolsText))
5006 {
5007 <div class="u-margin-top u-margin-bottom">@toolsText</div>
5008 }
5009 }
5010
5011 @helper RenderDesktopToolsNavigation()
5012 {
5013 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");
5014
5015 if (renderPagesInToolBar)
5016 {
5017 @RenderNavigation(new
5018 {
5019 id = "topToolsNavigation",
5020 cssclass = "menu menu-tools dw-mod dwnavigation",
5021 template = "TopMenu.xslt"
5022 })
5023 }
5024 }
5025
5026 @helper RenderDesktopNavigation()
5027 {
5028 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList();
5029 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5030 string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : "";
5031 <nav class="main-navigation dw-mod">
5032 <div class="center-container top-container__center-container grid @alignClass dw-mod">
5033 @RenderBlockList(subBlocks)
5034
5035 </div>
5036 </nav>
5037 }
5038
5039 @helper RenderDesktopExtra()
5040 {
5041 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList();
5042
5043 if (subBlocks.Count > 0)
5044 {
5045 <div class="header header-top dw-mod">
5046 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod">
5047 @RenderBlockList(subBlocks)
5048 </div>
5049 </div>
5050 }
5051 }</text>
5052 }
5053
5054 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5055
5056 @using System
5057 @using System.Web
5058 @using Dynamicweb.Rapido.Blocks.Extensibility
5059 @using Dynamicweb.Rapido.Blocks
5060
5061 @{
5062 Block impersonationBar = new Block
5063 {
5064 Id = "ImpersonationBar",
5065 SortId = 50,
5066 Template = RenderImpersonationBar(),
5067 Design = new Design
5068 {
5069 Size = "auto-width",
5070 HidePadding = true,
5071 RenderType = RenderType.Column
5072 }
5073 };
5074
5075 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0)
5076 {
5077 BlocksPage.GetBlockPage("Master").Add("MasterHeader", impersonationBar);
5078 }
5079 }
5080
5081 @helper RenderImpersonationBar()
5082 {
5083 int impersonationPageId = GetPageIdByNavigationTag("Impersonation");
5084
5085 <div class="u-color-warning--bg">
5086 <div class="center-container top-container__center-container dw-mod">
5087 @*Impersonation*@
5088 <div class="grid">
5089 <div class="grid--align-self-center grid__col-x">
5090 @if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0)
5091 {
5092 string stopImpersonateTranslation = Translate("Stop impersonation");
5093 string username = "";
5094 if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.FirstName) && !string.IsNullOrEmpty(Model.CurrentSecondaryUser.LastName))
5095 {
5096 username = Model.CurrentSecondaryUser.FirstName + " " + Model.CurrentSecondaryUser.LastName;
5097 }
5098 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Name))
5099 {
5100 username = Model.CurrentSecondaryUser.Name;
5101 }
5102 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Email))
5103 {
5104 username = Model.CurrentSecondaryUser.Email;
5105 }
5106 else
5107 {
5108 username = Model.CurrentSecondaryUser.UserName;
5109 }
5110 <div class="grid-cell">
5111 <div class="u-pull--left u-bold u-margin-top">
5112 <i class="fas fa-user-secret"></i>
5113 @Pageview.User.UserName<text> </text>@Translate("is impersonating")<text> </text>@username
5114 </div>
5115 <form method="post" class="u-pull--right u-no-margin">
5116 <input type="submit" class="btn btn--secondary dw-mod u-no-margin" name="DwExtranetRemoveSecondaryUser" value="@stopImpersonateTranslation">
5117 </form>
5118 </div>
5119 }
5120 else
5121 {
5122 string viewListTranslation = Translate("View the list of users you can impersonate");
5123 <div class="grid-cell u-bold">
5124 <i class="fas fa-user-secret"></i>
5125 <a href="/Default.aspx?ID=@impersonationPageId" title="@viewListTranslation" class="u-color-font-black">@viewListTranslation</a>
5126 </div>
5127 }
5128 </div>
5129 </div>
5130 </div>
5131 </div>
5132 }
5133 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5134
5135 @using System
5136 @using System.Web
5137 @using System.Collections.Generic
5138 @using Dynamicweb.Rapido.Blocks.Extensibility
5139 @using Dynamicweb.Rapido.Blocks
5140 @using NextechDWAddIn.Handlers
5141 @using NextechDWAddIn.Common
5142
5143 @{
5144
5145
5146 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master");
5147 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table";
5148
5149 Block orderLines = new Block
5150 {
5151 Id = "MiniCartOrderLines",
5152 SkipRenderBlocksList = true,
5153 BlocksList = new List<Block>
5154 {
5155 new Block {
5156 Id = "MiniCartOrderLinesList",
5157 SortId = 20,
5158 Template = RenderMiniCartOrderLinesList()
5159 }
5160 }
5161 };
5162
5163 Block orderlinesScriptTemplates = new Block
5164 {
5165 Id = "OrderlinesScriptTemplates"
5166 };
5167
5168 if (orderlinesView == "table")
5169 {
5170 orderLines.Template = RenderMiniCartOrderLinesTable();
5171 orderLines.BlocksList.Add(
5172 new Block {
5173 Id = "MiniCartOrderlinesTableHeader",
5174 SortId = 10,
5175 Template = RenderMiniCartOrderLinesHeader()
5176 }
5177 );
5178
5179 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates();
5180 }
5181 else
5182 {
5183 orderLines.Template = RenderMiniCartOrderLinesBlocks();
5184 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates();
5185 }
5186
5187 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates);
5188
5189 Block miniCartScriptTemplates = new Block()
5190 {
5191 Id = "MasterMiniCartTemplates",
5192 SortId = 1,
5193 Template = RenderMiniCartScriptTemplates(),
5194 SkipRenderBlocksList = true,
5195 BlocksList = new List<Block>
5196 {
5197 orderLines,
5198 new Block {
5199 Id = "MiniCartFooter",
5200 Template = RenderMiniCartFooter(),
5201 SortId = 50,
5202 SkipRenderBlocksList = true,
5203 BlocksList = new List<Block>
5204 {
5205 new Block {
5206 Id = "MiniCartFees",
5207 Template = RenderMiniCartFees(),
5208 SortId = 30
5209 },
5210 new Block {
5211 Id = "MiniCartPoints",
5212 Template = RenderMiniCartPoints(),
5213 SortId = 40
5214 },
5215 new Block {
5216 Id = "MiniCartTotal",
5217 Template = RenderMiniCartTotal(),
5218 SortId = 50
5219 },
5220 new Block {
5221 Id = "MiniCartActions",
5222 Template = RenderMiniCartActions(),
5223 SortId = 60
5224 }
5225 }
5226 }
5227 }
5228 };
5229
5230 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates);
5231 }
5232
5233 @helper RenderMiniCartScriptsTableTemplates()
5234 {
5235 <script id="MiniCartOrderline" type="text/x-template">
5236 {{#unless isEmpty}}
5237 <tr>
5238 <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}}"></a></td>
5239 <td class="u-va-middle">
5240 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a>
5241 {{#if variantname}}
5242 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a>
5243 {{/if}}
5244 {{#if unitname}}
5245 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div>
5246 {{/if}}
5247 </td>
5248 <td class="u-ta-right u-va-middle">{{quantity}}</td>
5249 <td class="u-ta-right u-va-middle">
5250 {{#if pointsTotal}}
5251 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points")
5252 {{else}}
5253 {{totalprice}}
5254 {{/if}}
5255 </td>
5256 </tr>
5257
5258 {{#OrderLineChildren}}
5259 <tr class="table__row--no-border">
5260 <!--CS NT Do not show the XDO NOT LET USER REMOVE ProductDiscount-->
5261 <td> </td>
5262 <td colspan="2">{{nameCS}} </td>
5263 <td class="cart-table__price u-ta-right dw-mod">{{totalpriceCS}}</td>
5264 </tr>
5265 {{/OrderLineChildren}}
5266
5267 {{/unless}}
5268 </script>
5269
5270 @*TODO CS NT Comment out and move further below with different html OR add seperator *@
5271
5272 <script id="MiniCartOrderlineDiscount" type="text/x-template">
5273 {{#unless isEmpty}}
5274
5275 {{#if parentId}}
5276 {{else}}
5277 <tr class="table__row--no-border">
5278 <td colspan="3">{{name}}</td>
5279 @*<td class="u-w60px"> </td>*@
5280 @*<td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td>*@
5281 @*<td class="u-ta-right"> </td>*@
5282 <td class="u-ta-right">{{totalprice}}</td>
5283 </tr>
5284 {{/if}}
5285 {{/unless}}
5286 </script>
5287 }
5288
5289 @helper RenderMiniCartScriptsListTemplates()
5290 {
5291 int cartOrderlinesFeedPageId = GetPageIdByNavigationTag("CartOrderlinesFeed");
5292 <script id="MiniCartOrderline" type="text/x-template">
5293 {{#unless isEmpty}}
5294 <div class="mini-cart-orderline grid dw-mod">
5295 <div class="grid__col-4">
5296 <a href="{{link}}" class="{{hideimage}}">
5297 <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}}">
5298 </a>
5299 </div>
5300 <div class="grid__col-8">
5301 <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>
5302
5303
5304 {{#if variantname}}
5305 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div>
5306 {{/if}}
5307 {{#if unitname}}
5308 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div>
5309 {{/if}}
5310 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div>
5311
5312 <div class="grid__cell-footer">
5313 <div class="grid__cell">
5314 <div class=" mini-cart-orderline__price dw-mod">
5315 {{#if pointsTotal}}
5316 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points")
5317 {{else}}
5318 {{totalprice}}
5319 {{/if}}
5320 </div>
5321 {{#if leastExpensiveDiscountText}}
5322 <div class=" u-pull--left discountCartLine dw-mod">{{leastExpensiveDiscountText}} {{leastExpensiveDiscountAmount}} </div>
5323 {{/if}}
5324 <button type="button" title="@Translate("Remove orderline")" class="btn btn--clean btn--condensed u-pull--right mini-cart-orderline__remove-btn dw-mod" onclick="{{removeFromCartGoogleImpression}}; Cart.UpdateCart('Cart', '/Default.aspx?ID=@cartOrderlinesFeedPageId', 'CartCmd=DelOrderLine&key={{orderLineId}}', true);">@Translate("Remove") <i class="fas fa-times"></i></button>
5325 </div>
5326 </div>
5327 </div>
5328 </div>
5329
5330 {{#OrderLineChildren}}
5331 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod">
5332 <div class="grid__col-4"><!--CS NT Mini cart (not table) product discount lines-->
5333 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{nameCS}}</div>
5334 </div>
5335 <div class="grid__col-8">{{totalpriceCS}}</div>
5336 </div>
5337 {{/OrderLineChildren}}
5338
5339 {{/unless}}
5340 </script>
5341
5342 @*TODO CS NT Comment out and move further below with different html OR add seperator *@
5343
5344 <script id="MiniCartOrderlineDiscount" type="text/x-template">
5345 {{#unless isEmpty}}
5346
5347 {{#if parentId}}
5348 {{else}}
5349 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod">
5350 <div class="grid__col-4">
5351 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div>
5352 </div>
5353 <div class="grid__col-8">{{totalprice}}</div>
5354 </div>
5355 {{/if}}
5356 {{/unless}}
5357 </script>
5358 }
5359
5360 @helper RenderMiniCartScriptTemplates()
5361 {
5362 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList();
5363 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));
5364 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage"));
5365
5366 <script id="MiniCartContent" type="text/x-template">
5367 {{#.}}
5368 {{#unless isEmpty}}
5369 @if (useGoogleTagManager)
5370 {
5371 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text>
5372 }
5373 @RenderBlockList(subBlocks)
5374 {{/unless}}
5375 {{#if isEmpty}}
5376 {{{locationReload '@cartPageLink'}}}
5377 {{/if}}
5378 {{/.}}
5379 </script>
5380 }
5381
5382 @helper RenderMiniCartOrderLinesTable()
5383 {
5384 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList();
5385
5386 <div class="u-overflow-auto">
5387 <table class="table mini-cart-table dw-mod">
5388 @RenderBlockList(subBlocks)
5389 </table>
5390 </div>
5391 }
5392
5393 @helper RenderMiniCartOrderLinesBlocks()
5394 {
5395 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList();
5396
5397 <div class="u-overflow-auto">
5398 @RenderBlockList(subBlocks)
5399 </div>
5400 }
5401
5402 @helper RenderMiniCartOrderLinesHeader()
5403 {
5404 <thead>
5405 <tr>
5406 <td> </td>
5407 <td>@Translate("Product")</td>
5408 <td class="u-ta-right">@Translate("Qty")</td>
5409 <td class="u-ta-right" width="120">@Translate("Price")</td>
5410 </tr>
5411 </thead>
5412 }
5413
5414 @helper RenderMiniCartOrderLinesList()
5415 {
5416 <text>
5417 {{#OrderLines}}
5418 {{#ifCond template "===" "CartOrderline"}}
5419 {{>MiniCartOrderline}}
5420 {{/ifCond}}
5421 {{#ifCond template "===" "CartOrderlineMobile"}}
5422 {{>MiniCartOrderline}}
5423 {{/ifCond}}
5424 {{#ifCond template "===" "CartOrderlineDiscount"}}
5425 {{>MiniCartOrderlineDiscount}}
5426 {{/ifCond}}
5427 {{/OrderLines}}
5428 </text>
5429 }
5430
5431 @helper RenderMiniCartFees()
5432 {
5433 @*CS NT Hide Payment
5434 <div class="grid u-border-top grid--external-bleed-bottom">
5435 <div class="grid__col-6">
5436 {{paymentmethod}}
5437 </div>
5438 <div class="grid__col-6 grid--align-end">{{paymentfee}}</div>
5439 </div>
5440 *@
5441 <div class="grid grid--external-bleed-bottom">
5442 <div class="grid__col-6">
5443 {{shippingmethod}}
5444 </div>
5445 <div class="grid__col-6 grid--align-end">{{shippingfee}}</div>
5446 </div>
5447 }
5448
5449 @helper RenderMiniCartFooter()
5450 {
5451 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList();
5452
5453 <div class="mini-cart__footer dw-mod">
5454 @RenderBlockList(subBlocks)
5455 </div>
5456 }
5457
5458 @helper RenderMiniCartActions()
5459 {
5460 int cartPageId = GetPageIdByNavigationTag("CartPage");
5461
5462 <!-- CS NT Hide Empty Cart <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>-->
5463 <a href="/Default.aspx?ID=@cartPageId" title="@Translate("Proceed to checkout")" class="btn btn--primary u-full-width u-no-margin dw-mod">@Translate("Proceed to checkout")</a>
5464 }
5465
5466 @helper RenderMiniCartPoints()
5467 {
5468 <text>
5469 {{#if earnings}}
5470 <div class="grid grid--external-bleed-bottom">
5471 <div class="grid__col-6">@Translate("Earnings")</div>
5472 <div class="grid__col-6 grid--align-end">
5473 <div>
5474 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points")
5475 </div>
5476 </div>
5477 </div>
5478 {{/if}}
5479 </text>
5480 }
5481
5482 @helper RenderMiniCartTotal()
5483 {
5484 <div class="mini-cart-totals grid u-margin-bottom dw-mod">
5485 <div class="grid__col-6">@Translate("Total")</div>
5486 <div class="grid__col-6 grid--align-end">{{totalprice}}</div>
5487 </div>
5488 }
5489 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5490
5491 @using Dynamicweb.Rapido.Blocks.Extensibility
5492 @using Dynamicweb.Rapido.Blocks
5493
5494 @{
5495 bool addToCartNotificationOnlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0;
5496 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : "";
5497 bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart");
5498
5499 if (!addToCartNotificationOnlyPreview && !string.IsNullOrEmpty(addToCartNotificationType)) {
5500 if (addToCartNotificationType == "modal")
5501 {
5502 Block addToCartNotificationModal = new Block
5503 {
5504 Id = "AddToCartNotificationModal",
5505 Template = RenderAddToCartNotificationModal()
5506 };
5507
5508 Block addToCartNotificationScript = new Block
5509 {
5510 Id = "AddToCartNotificationScript",
5511 Template = RenderAddToCartNotificationModalScript()
5512 };
5513 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal);
5514 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript);
5515 }
5516 else if (addToCartNotificationType == "toggle" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
5517 {
5518 Block addToCartNotificationScript = new Block
5519 {
5520 Id = "AddToCartNotificationScript",
5521 Template = RenderAddToCartNotificationToggleScript()
5522 };
5523 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript);
5524 }
5525 }
5526 }
5527
5528 @helper RenderAddToCartNotificationModal()
5529 {
5530 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div>
5531 }
5532
5533 @helper RenderAddToCartNotificationModalScript()
5534 {
5535 int cartPageId = GetPageIdByNavigationTag("CartPage");
5536
5537 <script id="LastAddedProductTemplate" type="text/x-template">
5538 <!-- Trigger for the login modal -->
5539 <input type="checkbox" id="LastAddedProductModalTrigger" class="modal-trigger" />
5540
5541 <!-- Login modal -->
5542 <div class="modal-container">
5543 <label for="LastAddedProductModalTrigger" class="modal-overlay"></label>
5544 <div class="modal modal--md">
5545 <div class="modal__header">
5546 <h2>@Translate("Product is added to the cart")</h2>
5547 </div>
5548 <div class="modal__body">
5549 <div class="grid">
5550 <div class="grid__col-2">
5551 <a href="{{productInfo.link}}">
5552 <img src="{{productInfo.image}}" alt="{{productInfo.name}}" class="dw-mod" />
5553 </a>
5554 </div>
5555 <div class="u-padding grid--align-self-center">
5556 <span>{{quantity}}</span> x
5557 </div>
5558 <div class="grid__col-auto grid--align-self-center">
5559 <div>{{productInfo.name}}</div>
5560 {{#if productInfo.variantName}}
5561 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small>
5562 {{/if}}
5563 {{#if productInfo.unitName}}
5564 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small>
5565 {{/if}}
5566 </div>
5567 </div>
5568 <div class="modal__footer u-margin-top--lg">
5569 <label class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" for="LastAddedProductModalTrigger">@Translate("Continue shopping")</label>
5570 <a href="/Default.aspx?ID=@cartPageId" class="btn btn--primary u-pull--right u-no-margin dw-mod btn--sm">@Translate("Proceed to checkout")</a>
5571 </div>
5572 </div>
5573 <label class="modal__close-btn" for="LastAddedProductModalTrigger"></label>
5574 </div>
5575 </div>
5576 </script>
5577 <script>
5578 document.addEventListener('addToCart', function (event) {
5579 Cart.ShowLastAddedProductModal(event.detail);
5580 });
5581 </script>
5582 }
5583
5584 @helper RenderAddToCartNotificationToggleScript()
5585 {
5586 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5587
5588 <script>
5589 document.addEventListener('addToCart', function () {
5590 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId');
5591 });
5592 </script>
5593 }
5594 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5595
5596 @using System
5597 @using System.Web
5598 @using System.Collections.Generic
5599 @using Dynamicweb.Rapido.Blocks.Extensibility
5600 @using Dynamicweb.Rapido.Blocks
5601
5602 @functions {
5603 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master");
5604 }
5605
5606 @{
5607 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content");
5608 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content");
5609 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content");
5610 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header");
5611 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header");
5612 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header");
5613
5614 Block masterFooterContent = new Block()
5615 {
5616 Id = "MasterFooterContent",
5617 SortId = 10,
5618 Template = RenderFooter(),
5619 SkipRenderBlocksList = true
5620 };
5621 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent);
5622
5623 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader))
5624 {
5625 Block masterFooterColumnOne = new Block
5626 {
5627 Id = "MasterFooterColumnOne",
5628 SortId = 10,
5629 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent),
5630 Design = new Design {
5631 Size = "auto",
5632 RenderType = RenderType.Column
5633 }
5634 };
5635 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne);
5636 }
5637
5638 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader))
5639 {
5640 Block masterFooterColumnTwo = new Block
5641 {
5642 Id = "MasterFooterColumnTwo",
5643 SortId = 20,
5644 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent),
5645 Design = new Design
5646 {
5647 Size = "auto",
5648 RenderType = RenderType.Column
5649 }
5650 };
5651 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo);
5652 }
5653
5654 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader))
5655 {
5656 Block masterFooterColumnThree = new Block
5657 {
5658 Id = "MasterFooterColumnThree",
5659 SortId = 30,
5660 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent),
5661 Design = new Design
5662 {
5663 Size = "auto",
5664 RenderType = RenderType.Column
5665 }
5666 };
5667 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree);
5668 }
5669
5670 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp"))
5671 {
5672 Block masterFooterNewsletterSignUp = new Block
5673 {
5674 Id = "MasterFooterNewsletterSignUp",
5675 SortId = 40,
5676 Template = RenderFooterNewsletterSignUp(),
5677 Design = new Design
5678 {
5679 Size = "auto",
5680 RenderType = RenderType.Column
5681 }
5682 };
5683 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp);
5684 }
5685
5686 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0)
5687 {
5688 Block masterFooterSocialLinks = new Block
5689 {
5690 Id = "MasterFooterSocialLinks",
5691 SortId = 50,
5692 Template = RenderFooterSocialLinks(),
5693 Design = new Design
5694 {
5695 Size = "auto",
5696 RenderType = RenderType.Column
5697 }
5698 };
5699 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks);
5700 }
5701
5702 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0)
5703 {
5704 Block masterFooterPayments = new Block
5705 {
5706 Id = "MasterFooterPayments",
5707 SortId = 60,
5708 Template = RenderFooterPayments(),
5709 Design = new Design
5710 {
5711 Size = "12",
5712 RenderType = RenderType.Column
5713 }
5714 };
5715 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments);
5716 }
5717
5718 Block masterFooterCopyright = new Block
5719 {
5720 Id = "MasterFooterCopyright",
5721 SortId = 70,
5722 Template = RenderFooterCopyright(),
5723 Design = new Design
5724 {
5725 Size = "12",
5726 RenderType = RenderType.Column
5727 }
5728 };
5729 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright);
5730 }
5731
5732 @helper RenderFooter() {
5733 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList();
5734 string oneDivPayments_socialIconsStyle= Pageview.Device.ToString() != "Mobile" ? "display: inline;" : "";
5735
5736
5737 <footer class="footer dw-mod">
5738 <div class="center-container u-padding dw-mod" id="productPageDeliveryBenefitsAdvice">
5739 <div class="grid productPage-Delivery-Benefits-Advice">
5740 <div class="grid__col-lg-4 grid__col-md-4 grid__col-sm-12 grid__col-xs-12 oneThirdDiv">
5741 <p>
5742 <a href="/">
5743 <img src="Files/Images/General/delivery_icon.svg" />
5744 </a>
5745 </p>
5746 <div>
5747 <p><strong>@Translate("Free Standard Delivery when you") </strong></p>
5748
5749 <p><strong>@Translate("spend euro 15 or more")</strong></p>
5750
5751 <p>@Translate("Delivery will take 3-5 working days")</p>
5752 </div>
5753 </div>
5754
5755 <div class="grid__col-lg-4 grid__col-md-4 grid__col-sm-12 grid__col-xs-12 oneThirdDiv">
5756 <p>
5757 <a href="/createecommerceaccount">
5758 <img src="Files/Images/General/loyalty_icon.svg" />
5759 </a>
5760 </p>
5761 <div>
5762 <p>
5763 <a href="/createecommerceaccount"><strong>@Translate("Join our Benefits Loyalty Scheme")</strong></a>
5764 </p>
5765 <p>@Translate("Join our loyalty scheme today. Every euro 1 of purchases adds 1 point to your account")</p>
5766 <p> </p>
5767 </div>
5768 </div>
5769
5770 <div class="grid__col-lg-4 grid__col-md-4 grid__col-sm-12 grid__col-xs-12 oneThirdDiv">
5771 <p>
5772 <a href="/expertly-trained">
5773 <img src="Files/Images/General/ExpertlyTrained_footer_small.png" style="width: 55px; height: 45px;" />
5774 </a>
5775 </p>
5776 <div>
5777 <p>
5778 <a href="/expertly-trained"><strong>@Translate("Ask our Experts!")</strong></a>
5779 </p>
5780 <p>@Translate("All our store colleagues are expertly trained to the highest standards within the industry. Visit us in-store or online.")</p>
5781 <p> </p>
5782 </div>
5783 </div>
5784 </div>
5785 </div>
5786 <div class="center-container top-container__center-container dw-mod">
5787
5788 <!-- CS NT add Payments-Social and Lines Start..-->
5789 <div class="fullSoftLine"></div>
5790 <div class="grid" style="padding: 1rem 0;">
5791 <!--<div class="oneHalfDiv_Payments"><img src="Files/Images/General/payment-options.svg" /></div>
5792 <div class="oneHalfDiv_Social"><img src="Files/Images/General/social-instagram.svg" /> <img src="Files/Images/General/social-facebook.svg" /></div>-->
5793 <div class="oneDiv_Payments">
5794 <img class="generalPaymentsImg" src="Files/Images/General/payments options.png" />
5795 <div class="oneDiv_Payments_SocialIcons" style="@oneDivPayments_socialIconsStyle">
5796 <a href="https://www.instagram.com/hollandandbarrett_cy/?hl=en" target="_blank">
5797 <img src="Files/Images/SocialIcons/ICON_HB_INSTAGRAM.png" />
5798 </a>
5799 <a href="https://www.facebook.com/HollandAndBarrettCy/" target="_blank">
5800 <img src="Files/Images/SocialIcons/ICON_HB_FACEBOOK.png" />
5801 </a>
5802 <a href="https://www.tiktok.com/@("@hollandbarrettcyprus")?_t=8gpL9QH8bY1&_r=1" target="_blank">
5803 <img src="Files/Images/SocialIcons/ICON_HB_TIKTOK.png" />
5804 </a>
5805 </div>
5806 </div>
5807 </div>
5808 <div class="fullThickLine"></div>
5809 <!-- CS NT add Payments-Social and Lines ..End-->
5810
5811 <div class="grid grid--external-bleed-x">
5812 @RenderBlockList(subBlocks)
5813 </div>
5814 </div>
5815 </footer>
5816 }
5817
5818 @helper RenderFooterColumn(string header, string content) {
5819 <h3 class="footer__heading dw-mod">@header</h3>
5820 <div class="footer__content dw-mod">
5821 @content
5822 </div>
5823 }
5824
5825 @helper RenderFooterNewsletterSignUp() {
5826 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString();
5827
5828 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3>
5829 <div class="footer__content dw-mod">
5830 <form class="form dw-mod" name="NewsletterRedirect" action='/Default.aspx' method="get" enctype="multipart/form-data">
5831 <input name="ID" value="@newsletterSignUpPageId" type="hidden" />
5832 <label for="NewsletterEmail" class="u-margin-bottom">@Translate("Sign up if you would like to receive occasional treats from us", "Sign up if you would like to receive occasional treats from us")</label>
5833 <div class="form__field-combi">
5834 <input name="NewsletterEmail" id="NewsletterEmail" type="text" placeholder='@Translate("Your email address", "Your email address")' class="u-full-width use-btn-primary-height" />
5835 <input class="btn btn--primary btn--condensed dw-mod" type="submit" id="Submitter" value='@Translate("Go", "Go")' />
5836 </div>
5837 </form>
5838 </div>
5839 }
5840
5841 @helper RenderFooterSocialLinks() {
5842
5843 if(Pageview.Device.ToString() == "Desktop")
5844 {
5845 }
5846
5847
5848
5849 <h3 class="footer__heading dw-mod">@Translate("Brands")</h3>
5850 <div class="footer__content dw-mod">
5851 <ul>
5852 <li><a href="/brands" class="">@Translate("View all brands")</a></li>
5853 <li><a href="/products?HBBrand=Holland%20%26%20Barrett" class="">@Translate("Holland & Barrett")</a></li>
5854 <li><a href="/products?HBBrand=Dr%20Organic" class="">@Translate("Dr Organic")</a></li>
5855 <li><a href="/products?HBBrand=Optimum%20Nutrition" class="">@Translate("Optimum Nutrition")</a></li>
5856 </ul>
5857 </div>
5858
5859
5860
5861 @*
5862 <h3 class="footer__heading dw-mod">@Translate("Download the app")</h3>
5863 <div class="footer__content dw-mod">
5864 <p>@Translate("Get 20% off your first order")</p>
5865
5866 <div class="FooterWidgetMenuApp-module_imagesContainer__gwNFx">
5867 <div class="FooterWidgetMenuApp-module_appLinkQrCode__4ZpWq" style="margin: 0 12px;">
5868 <img loading="lazy" decoding="async" src="/Files/Images/H_B_APP_Download.png" alt="Download our app" width="80" height="80">
5869 </div>
5870 <div class="FooterWidgetMenuApp-module_appLinks__-5uli">
5871 <a href="https://apps.apple.com/cy/app/holland-barrett-cyprus/id1520161822" class="FooterWidgetMenuApp-module_appLinkImage__Ad1ps">
5872 <img loading="lazy" decoding="async" src="/Files/Images/General/download-appstore-blk.svg" alt="app store" width="120" height="40">
5873 </a>
5874 <a href="https://play.google.com/store/apps/details?id=com.eumbrellacorp.hollandandbarrett" class="FooterWidgetMenuApp-module_appLinkImage__Ad1ps">
5875 <img loading="lazy" decoding="async" src="/Files/Images/General/googleplay.svg" alt="google play" width="120" height="40">
5876 </a>
5877 </div>
5878 </div>
5879
5880 </div>
5881 *@
5882
5883 @*CS NT
5884 <h3 class="footer__heading dw-mod">@Translate("Social links")</h3>
5885 <div class="footer__content dw-mod">
5886 <div class="collection dw-mod">
5887 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks"))
5888 {
5889 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel;
5890 string socialIconClass = socialIcon.SelectedValue;
5891 string socialIconTitle = socialIcon.SelectedName;
5892 string socialLink = socialitem.GetString("Link");
5893
5894 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a>
5895 }
5896 </div>
5897 </div>
5898 *@
5899 }
5900
5901 @helper RenderFooterPayments() {
5902 <div class="footer__content dw-mod">
5903 <div class="collection dw-mod">
5904 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments"))
5905 {
5906 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel;
5907 string paymentImage = null;
5908 string paymentTitle = paymentItem.SelectedName;
5909 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault();
5910 if (selected != null)
5911 {
5912 paymentImage = selected.Icon;
5913 }
5914
5915 <div class="footer__card-type">
5916 <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=60&Compression=75&image=@paymentImage" alt="@paymentTitle" title="@paymentTitle" />
5917 </div>
5918 }
5919 </div>
5920 </div>
5921 }
5922
5923 @helper RenderFooterCopyright() {
5924 <div class="grid__col-12 footer__copyright dw-mod">
5925 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p>
5926 </div>
5927 }
5928 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
5929
5930 @using System
5931 @using System.Web
5932 @using System.Collections.Generic
5933 @using Dynamicweb.Rapido.Blocks.Extensibility
5934 @using Dynamicweb.Rapido.Blocks
5935 @using Dynamicweb.Ecommerce.Common
5936
5937 @{
5938 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master");
5939
5940 Block masterScriptReferences = new Block()
5941 {
5942 Id = "MasterScriptReferences",
5943 SortId = 1,
5944 Template = RenderMasterScriptReferences()
5945 };
5946 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences);
5947 }
5948
5949 @helper RenderMasterScriptReferences()
5950 {
5951
5952
5953 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script>
5954 <!--CS NT Use ticks <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script>-->
5955 //CS NT Ticks for files
5956 var masterMinJSfileInfo = new System.IO.FileInfo(System.Web.HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/js/master.min.js"));
5957 <script type="text/javascript" src="/Files/Templates/Designs/Rapido/js/master.min.js?ticks=@masterMinJSfileInfo.LastWriteTime.Ticks.ToString()"></script>
5958
5959 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript"))
5960 {
5961 <script src="/Files/Templates/Designs/Rapido/js/custom.min.js"></script>
5962 PushPromise("/Files/Templates/Designs/Rapido/js/custom.min.js");
5963 }
5964
5965 PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js");
5966 PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js");
5967 }
5968 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5969
5970 @using System
5971 @using System.Web
5972 @using System.Collections.Generic
5973 @using Dynamicweb.Rapido.Blocks.Extensibility
5974 @using Dynamicweb.Rapido.Blocks
5975
5976 @{
5977 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master");
5978 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");
5979 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID"));
5980
5981 if (!navigationItemsHideSearch || isFavoriteList)
5982 {
5983 Block masterSearchScriptTemplates = new Block()
5984 {
5985 Id = "MasterSearchScriptTemplates",
5986 SortId = 1,
5987 Template = RenderSearchScriptTemplates()
5988 };
5989
5990 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates);
5991 }
5992 }
5993
5994 @helper RenderSearchScriptTemplates()
5995 {
5996 int productsPageId = GetPageIdByNavigationTag("ProductsPage");
5997 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;
5998 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID"));
5999 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0;
6000 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID"));
6001 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults");
6002 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton");
6003 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton");
6004 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton");
6005 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
6006
6007 <script id="SearchGroupsTemplate" type="text/x-template">
6008 {{#.}}
6009 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li>
6010 {{/.}}
6011 </script>
6012
6013 <script id="SearchProductsTemplate" type="text/x-template">
6014 {{#each .}}
6015 {{#Product}}
6016 {{#ifCond template "!==" "SearchMore"}}
6017 <li class="dropdown__item dropdown__item--seperator dw-mod">
6018 @if (useFacebookPixel)
6019 {
6020 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text>
6021 }
6022 @if (useGoogleTagManager)
6023 {
6024 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text>
6025 }
6026 <div>
6027 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}">
6028 <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}}"></div>
6029 <div class="u-pull--left">
6030 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}</div>
6031 @if (showPrice && !onlyPreview)
6032 {
6033 if (pointShopOnly)
6034 {
6035 <text>
6036 {{#if havePointPrice}}
6037 <div>
6038 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points")
6039 </div>
6040 {{else}}
6041 <small class="help-text u-no-margin">@Translate("Not available")</small>
6042 {{/if}}
6043 {{#unless canBePurchasedWithPoints}}
6044 {{#if havePointPrice}}
6045 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small>
6046 {{/if}}
6047 {{/unless}}
6048 </text>
6049 }
6050 else
6051 {
6052 <div>{{price}}</div>
6053 }
6054 }
6055 </div>
6056 </a>
6057 <div class="u-margin-left u-pull--right">
6058 @if (showAddToCartButton && !onlyPreview) {
6059 if (pointShopOnly)
6060 {
6061 <button type="button" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside {{#unless canBePurchasedWithPoints}}js-stay-disabled{{/unless}}" name="CartCmd" value="addWithPoints"
6062 onclick="Cart.AddToCart(event, {
6063 id: '{{productId}}',
6064 quantity: 1,
6065 buyForPoints: true,
6066 productInfo: {{productInfo}}
6067 }); {{facebookPixelAction}}" {{disabledBuyButton}}>
6068 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i>
6069 </button>
6070 } else {
6071 @* CS NT Comment out for onClick..
6072 <button type="button" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside"
6073 onclick="Cart.AddToCart(event, {
6074 id: '{{productId}}',
6075 quantity: 1,
6076 productInfo: {{productInfo}}
6077 }); {{facebookPixelAction}}">
6078 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i>
6079 </button>
6080 .. CS NT Comment out for onClick*@
6081 <input type="number" class="product__quantity-selector u-w70px use-btn-primary-height dw-mod" style="display: none;" id="Quantity_{{id}}" name="Quantity" value="1" min="1" data-qtyincart="{{qtyInCart}}" data-id="{{id}}">
6082 <button type="button" id="CartButton_{{id}}" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside"
6083 onclick="ProductAddToCart(event, {{id}}, {
6084 id: '{{productId}}',
6085 variantId: '{{variantid}}',
6086 unitId: '{{unitId}}',
6087 quantity: 1,
6088 productInfo: {{productInfo}}
6089 }); {{facebookPixelAction}}" >
6090 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i>
6091 </button>
6092 }
6093 <a href="{{link}}" onclick="{{googleImpressionClick}}" class="btn btn--secondary btn--condensed btn--full u-no-margin dw-mod {{hideViewMore}} js-ignore-click-outside" title="@Translate("View")">@Translate("View")</a>
6094 }
6095 else if (showViewButton)
6096 {
6097 <a href="{{link}}" onclick="{{googleImpressionClick}}" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod js-ignore-click-outside" title="@Translate("View")">@Translate("View")</a>
6098 }
6099 @if (showAddToDownloadButton)
6100 {
6101 <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}}">
6102 <i class="fas fa-plus js-button-icon"></i>
6103 </button>
6104 }
6105 </div>
6106
6107 <div class="error-message" style="display:none" id="error-message{{id}}">
6108 <br />
6109 <div class="error-block-nextech">@Translate("Available stock is") <span id="stockSpan{{id}}"></span></div>
6110 </div>
6111
6112 </div>
6113 </li>
6114 {{/ifCond}}
6115 {{#ifCond template "===" "SearchMore"}}
6116 {{>SearchMoreProducts}}
6117 {{/ifCond}}
6118 {{/Product}}
6119 {{else}}
6120 <li class="dropdown__item dropdown__item--seperator dw-mod">
6121 @Translate("Your search gave 0 results")
6122 </li>
6123 {{/each}}
6124 </script>
6125
6126 <script id="SearchMoreProducts" type="text/x-template">
6127 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod">
6128 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link">
6129 @Translate("View all")
6130 </a>
6131 </li>
6132 </script>
6133
6134 <script id="SearchMorePages" type="text/x-template">
6135 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod">
6136 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link">
6137 @Translate("View all")
6138 </a>
6139 </li>
6140 </script>
6141
6142 <script id="SearchPagesTemplate" type="text/x-template">
6143 {{#each .}}
6144 {{#ifCond template "!==" "SearchMore"}}
6145 <li class="dropdown__item dropdown__item--seperator dw-mod">
6146 <div>
6147 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit">
6148 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div>
6149 <div class="u-pull--left">
6150 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div>
6151 </div>
6152 </a>
6153 </div>
6154 </li>
6155 {{/ifCond}}
6156 {{#ifCond template "===" "SearchMore"}}
6157 {{>SearchMorePages}}
6158 {{/ifCond}}
6159 {{else}}
6160 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable dw-mod">
6161 @Translate("Your search gave 0 results")
6162 </li>
6163 {{/each}}
6164 </script>
6165
6166 <script id="SearchPagesTemplateWrap" type="text/x-template">
6167 <div class="dropdown__column-header">@Translate("Pages")</div>
6168 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod">
6169 {{>SearchPagesTemplate}}
6170 </ul>
6171 </script>
6172
6173 <script id="SearchProductsTemplateWrap" type="text/x-template">
6174 <div class="dropdown__column-header">@Translate("Products")</div>
6175 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod">
6176 {{>SearchProductsTemplate}}
6177 </ul>
6178 </script>
6179 }
6180
6181
6182 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
6183
6184 @using System
6185 @using System.Web
6186 @using System.Collections.Generic
6187 @using Dynamicweb.Rapido.Blocks.Extensibility
6188 @using Dynamicweb.Rapido.Blocks
6189
6190 @{
6191 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master");
6192
6193 Block primaryBottomSnippets = new Block()
6194 {
6195 Id = "MasterJavascriptInitializers",
6196 SortId = 100,
6197 Template = RenderPrimaryBottomSnippets()
6198 };
6199 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets);
6200 }
6201
6202 @helper RenderPrimaryBottomSnippets() {
6203 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode");
6204 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));
6205
6206 if (isWireframeMode)
6207 {
6208 <script>
6209 Wireframe.Init(true);
6210 </script>
6211 }
6212
6213
6214 if (useGoogleTagManager)
6215 {
6216 <script>
6217 document.addEventListener('addToCart', function(event) {
6218 var googleImpression = event.detail.productInfo.googleImpression;
6219 dataLayer.push({
6220 'event': 'addToCart',
6221 'ecommerce': {
6222 'currencyCode': '@Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency().Code',
6223 'add': {
6224 'products': [{
6225 'name': googleImpression.name,
6226 'id': googleImpression.id,
6227 'price': googleImpression.price,
6228 'brand': googleImpression.brand,
6229 'category': googleImpression.category,
6230 'variant': googleImpression.variant,
6231 'quantity': event.detail.quantity
6232 }]
6233 }
6234 }
6235 });
6236 });
6237 </script>
6238 }
6239
6240 //if digitalwarehouse
6241 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart"))
6242 {
6243 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]);
6244
6245 if (string.IsNullOrEmpty(cartContextId)) {
6246 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2");
6247 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps);
6248 cartContextId = cartSettings.OrderContextID;
6249 HttpContext.Current.Application["DownloadCartContext"] = cartContextId;
6250 }
6251
6252 <script>
6253 let downloadCart = new DownloadCart({
6254 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"),
6255 contextId: "@cartContextId",
6256 addButtonText: "@Translate("Add")",
6257 removeButtonText: "@Translate("Remove")"
6258 });
6259 </script>
6260 }
6261
6262 <!--$$Javascripts-->
6263 }
6264 @if (File.Exists(HttpContext.Current.Server.MapPath("/MasterBlocks/Custom__Blocks.cshtml")))
6265 {
6266 <text>@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
6267
6268 @using System
6269 @using System.Web
6270 @using System.Collections.Generic
6271 @using Dynamicweb.Rapido.Blocks
6272
6273 @{
6274 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master");
6275
6276 }</text>
6277 }
6278
6279
6280 @functions {
6281 public class ManifestIcon
6282 {
6283 public string src { get; set; }
6284 public string type { get; set; }
6285 public string sizes { get; set; }
6286 }
6287
6288 public class Manifest
6289 {
6290 public string name { get; set; }
6291 public string short_name { get; set; }
6292 public string start_url { get; set; }
6293 public string display { get; set; }
6294 public string background_color { get; set; }
6295 public string theme_color { get; set; }
6296 public List<ManifestIcon> icons { get; set; }
6297 }
6298 }
6299 @{
6300 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) {
6301 Manifest manifest = new Manifest
6302 {
6303 name = Model.Area.Item.GetItem("Settings").GetString("AppName"),
6304 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"),
6305 start_url = "/",
6306 display = "standalone",
6307 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"),
6308 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor")
6309 };
6310
6311 manifest.icons = new List<ManifestIcon> {
6312 new ManifestIcon {
6313 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,
6314 sizes = "192x192",
6315 type = "image/png"
6316 },
6317 new ManifestIcon {
6318 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,
6319 sizes = "512x512",
6320 type = "image/png"
6321 },
6322 new ManifestIcon {
6323 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,
6324 sizes = "1024x1024",
6325 type = "image/png"
6326 }
6327 };
6328
6329 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json");
6330 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest);
6331 string currentManifest = File.ReadAllText(manifestFilePath);
6332
6333 if (manifestJSON != currentManifest)
6334 {
6335 File.WriteAllText(manifestFilePath, manifestJSON);
6336 }
6337 }
6338 }
6339
6340 @{
6341 var swatches = new Dynamicweb.Content.Items.ColorSwatchService();
6342 var brandColors = swatches.GetColorSwatch(1);
6343 string brandColorOne = brandColors.Palette["BrandColor1"];
6344
6345 //CS NT Ticks for files
6346 var customJSfileInfo = new System.IO.FileInfo(System.Web.HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/js/source/Custom.js"));
6347 var nextechCSSfileInfo = new System.IO.FileInfo(System.Web.HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/css/nextech.css"));
6348
6349 string addId_FB = "";
6350 string url_FB = HttpContext.Current.Request.Url.AbsoluteUri;
6351 string imageURL_FB_path = "";
6352 string imageURL_FB = "";
6353 string imageExtension_FB ="png";
6354 string title_FB = "";
6355 string description_FB = "";
6356 if(Model != null && Model.Item != null && Model.Item.GetFile("Image") != null )//&& !string.IsNullOrWhiteSpace(Model.Item.GetFile("Image").Path))
6357 {
6358 imageURL_FB_path = Model.Item.GetFile("Image").ToString();
6359 imageURL_FB = string.Format("{0}://{1}{2}", Dynamicweb.Context.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, imageURL_FB_path);
6360 title_FB = Model.Item.GetString("Title");
6361 description_FB = Model.Item.GetString("Summary");
6362 imageExtension_FB = Model.Item.GetFile("Image").Extension.Replace(".","");
6363
6364 }else{
6365 imageURL_FB = "https://hollandandbarrett.com.cy/Files/Images/Holland&Barrett_primary_logo.jpg";
6366 title_FB = "Holland & Barrett Cyprus";
6367 description_FB = "Holland And Barrett Cyprus";
6368 }
6369 imageExtension_FB = "image/" + imageExtension_FB;
6370
6371 if (!string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")))
6372 {
6373 //addId_FB = Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID");
6374 }
6375 }
6376
6377 <!DOCTYPE html>
6378
6379 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName">
6380 <head>
6381 <!-- Rapido version 3.1.1 -->
6382
6383 <!--CS NT Google Analytics -->
6384 <!-- Global site tag (gtag.js) - Google Ads: 632787444 -->
6385 <script async src="https://www.googletagmanager.com/gtag/js?id=AW-632787444"></script>
6386 <script>
6387 window.dataLayer = window.dataLayer || [];
6388 function gtag(){dataLayer.push(arguments);}
6389 gtag('js', new Date());
6390
6391 gtag('config', 'AW-632787444');
6392 </script>
6393
6394 <!-- CS NT Google Dynamic Remarketing Tag -->
6395 <script type="text/javascript">
6396 var google_conversion_id = 632787444;
6397 var google_custom_params = window.google_tag_params;
6398 var google_remarketing_only = true;
6399 </script>
6400 <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js"></script>
6401 <noscript>
6402 <div style="display:inline;">
6403 <img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/632787444/?guid=ON&script=0" />
6404 </div>
6405 </noscript>
6406
6407
6408
6409 <meta charset="utf-8" />
6410 <title>@Model.Title</title>
6411 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6412 <meta name="robots" content="index, follow">
6413 <meta name="theme-color" content="@brandColorOne" />
6414 <meta name="facebook-domain-verification" content="y88ahcuv2gfi2shmg6us5hysr6u08c" />
6415
6416 <!--FACEBOOK CS NT START-->
6417 <meta property="fb:app_id" content="@addId_FB">
6418 <meta property="og:image" content="@imageURL_FB">
6419 <meta property="og:image:type" content="image/png">
6420 <meta property="og:image:width" content="1024">
6421 <meta property="og:image:height" content="1024">
6422 <meta property="og:type" content="website" />
6423 <!--CS NT This redirects all pages <meta property="og:url" content="https://staging.hollandandbarrett.com.cy"/>-->
6424 <meta property="og:url" content="@url_FB"/>
6425 <meta property="og:title" content="@title_FB" />
6426 <meta property="og:description" content="@description_FB" />
6427 <!--FACEBOOK CS NT END-->
6428
6429 @Model.MetaTags
6430
6431 <!-- CS NT JQuery Library-->
6432 <script type="text/javascript" src="/Files/Templates/Designs/Rapido/js/jquery.min.js"></script>
6433
6434 <!-- CS NT Slick.js Library-->
6435 <script type="text/javascript" src="/Files/Templates/Designs/Rapido/js/slick.js"></script>
6436
6437 <!-- CS NT Jquery Mask.js Library UNUSED -->
6438 <!--<script type="text/javascript" src="/Files/Templates/Designs/Rapido/js/jquery.mask.min.js"></script>-->
6439
6440 <!-- CS NT Custom.js from DW-->
6441 <script type="text/javascript" src="/Files/Templates/Designs/Rapido/js/source/Custom.js?ticks=@customJSfileInfo.LastWriteTime.Ticks.ToString()"></script>
6442
6443 <!-- Favicon -->
6444 <link href="@favicon" rel="icon" type="image/png">
6445
6446 <!-- Base (Default, wireframe) styles -->
6447 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css">
6448
6449 <!-- Rapido Css from Website Settings -->
6450 <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css">
6451
6452 <!-- Ignite Css (Custom site specific styles) -->
6453 <link rel="stylesheet" id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css">
6454
6455 <!-- Font awesome -->
6456 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css">
6457
6458 <!-- Flag icon -->
6459 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css">
6460
6461 <!-- CS NT Custom nextech.css-->
6462 <link rel="stylesheet" type="text/css" href="/Files/Templates/Designs/Rapido/css/nextech.css?ticks=@nextechCSSfileInfo.LastWriteTime.Ticks.ToString()">
6463
6464 <!-- CS NT Custom slick.css-->
6465 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/slick.css" type="text/css">
6466
6467 <!-- CS NT Custom slick-theme.css-->
6468 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/slick-theme.css" type="text/css">
6469
6470 <!-- Google fonts -->
6471 @{
6472 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)));
6473 }
6474 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet">
6475 @{
6476 PushPromise(favicon);
6477 PushPromise(fontAwesomeCssLink);
6478 PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css");
6479 PushPromise(autoCssLink);
6480 PushPromise("/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css");
6481 PushPromise("/Files/Images/placeholder.gif");
6482 PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css");
6483 }
6484
6485 @if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")))
6486 {
6487 <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json">
6488 PushPromise("/Files/Templates/Designs/Rapido/manifest.json");
6489 }
6490
6491 <!-- Hey Oliver -->
6492 <script type='text/javascript'>
6493 var _hoid = _hoid || []; _hoid.push('ho_VZUKBbZIPaS65Zn0STWUuqpXKAOWM7tZlzdeM1GUrS3NoeW');
6494 var heyopath = (('https:' == document.location.protocol) ? 'https://www.heyoliver.com/webroot/ho-ui/v2/' :
6495 'http://www.heyoliver.com/webroot/ho-ui/v2/');
6496 var heyop = (('https:' == document.location.protocol) ? 'https://' : 'http://');
6497 var heyospt = document.createElement('script'); heyospt.type = 'text/javascript';
6498 heyospt.async = true; heyospt.src = heyopath + 'ho2.js';
6499 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(heyospt, s);
6500 </script>
6501 <!-- End of Hey Oliver -->
6502
6503 </head>
6504
6505 <body>
6506
6507 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@
6508 @RenderBlockList(masterPage.BlocksRoot.BlocksList)
6509
6510
6511 @helper RenderMasterHeader()
6512 {
6513 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList();
6514 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop");
6515 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : "";
6516
6517 <header class="top-container @stickyTop dw-mod" id="Top">
6518 @RenderBlockList(subBlocks)
6519 </header>
6520 }
6521
6522 @helper RenderMain()
6523 {
6524 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList();
6525 //CS NT get language and set the css class
6526 string languageCode = "language_css_" + Dynamicweb.Environment.ExecutingContext.GetCulture(true).TwoLetterISOLanguageName;
6527
6528 <main class="site dw-mod @languageCode">
6529 @RenderBlockList(subBlocks)
6530 </main>
6531 }
6532
6533 @helper RenderPageContent()
6534 {
6535 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop");
6536 string pagePos = isNavigationStickyMenu ? "js-page-pos" : "";
6537
6538 <div id="Page" class="page @pagePos">
6539 <section class="center-container content-container dw-mod" id="content">
6540 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
6541
6542
6543 @using Dynamicweb.Rapido.Blocks.Components
6544 @using Dynamicweb.Rapido.Blocks.Components.Articles
6545 @using Dynamicweb.Rapido.Blocks.Components.General
6546 @using Dynamicweb.Rapido.Blocks
6547
6548 @functions {
6549 BlocksPage articlePage = BlocksPage.GetBlockPage("BlogArticle");
6550 }
6551
6552 @{
6553 string image = !String.IsNullOrEmpty(Model.Item.GetString("Image")) ? Model.Item.GetFile("Image").PathUrlEncoded : "";
6554
6555 ArticleHeader topBanner = new ArticleHeader
6556 {
6557 Layout = ArticleHeaderLayout.Banner,
6558 Image = new Image { Path = image },
6559 Heading = Model.Item.GetString("Title"),
6560 Subheading = Model.Item.GetString("Summary"),
6561 TextColor = "#fff",
6562 Category = Model.Item.GetString("Author"),
6563 Date = Model.Item.GetString("Date"),
6564 ButtonLayout = ButtonLayout.Primary,
6565 TextLayout = ArticleHeaderTextLayout.Full
6566 };
6567
6568 ButtonLayout buttonDesign;
6569 Enum.TryParse<ButtonLayout>(Model.Item.GetString("ButtonDesign"), out buttonDesign);
6570 if (Enum.GetName(typeof(ButtonLayout), buttonDesign).ToLower() == "none")
6571 {
6572 buttonDesign = ButtonLayout.Primary;
6573 }
6574
6575 Block articleContainer = new Block
6576 {
6577 Id = "ArticleContainer",
6578 SortId = 10,
6579 Design = new Design
6580 {
6581 RenderType = RenderType.Row
6582 },
6583 BlocksList = new List<Block> {
6584 new Block {
6585 Id = "ArticleHeader",
6586 SortId = 20,
6587 Component = topBanner,
6588 Design = new Design {
6589 RenderType = RenderType.Column,
6590 Size = "12",
6591 HidePadding = true,
6592 CssClass = "article-head"
6593 }
6594 },
6595 new Block {
6596 Id = "ArticleBody",
6597 SortId = 30,
6598 Design = new Design {
6599 RenderType = RenderType.Column,
6600 Size = "8"
6601 },
6602 BlocksList = new List<Block> {
6603 new Block {
6604 Id = "ArticleBodyRow",
6605 SortId = 10,
6606 Design = new Design {
6607 RenderType = RenderType.Row
6608 },
6609 BlocksList = new List<Block> {
6610 new Block {
6611 Id = "ArticleText",
6612 SortId = 10,
6613 Component = new ArticleText { Text = Model.Item.GetString("Text") },
6614 Design = new Design {
6615 RenderType = RenderType.Column,
6616 Size = "12",
6617 CssClass = "u-padding--lg"
6618 }
6619 },
6620 new Block {
6621 Id = "ArticleLink",
6622 SortId = 20,
6623 Component = new ArticleLink { Link = Model.Item.GetString("Link"), Title = Model.Item.GetString("LinkText"), ButtonLayout = buttonDesign },
6624 Design = new Design {
6625 RenderType = RenderType.Column,
6626 Size = "12",
6627 CssClass = "u-padding--lg u-ta-right"
6628 }
6629 }
6630 }
6631 }
6632 }
6633 }
6634 }
6635 };
6636 articlePage.Add(articleContainer);
6637
6638 if (Model.PropertyItem.GetList("ShowBreadcrumb").SelectedValue == "True")
6639 {
6640 Block breadcrumb = new Block
6641 {
6642 Id = "ArticleBreadcrumb",
6643 SortId = 10,
6644 Component = new BreadcrumbNavigation { },
6645 Design = new Design
6646 {
6647 RenderType = RenderType.Column,
6648 Size = "12"
6649 }
6650 };
6651 articlePage.Add("ArticleContainer", breadcrumb);
6652 }
6653 }
6654
6655 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@
6656 @RenderBlockList(articlePage.BlocksRoot.BlocksList)
6657
6658 </section>
6659 </div>
6660 }
6661
6662 <script>
6663 $(document).ready(function(){
6664 //CS NT Not used now.. Maybe used in the future to displaying and error anywhere as an alert or a modal
6665 let searchParams = new URLSearchParams(window.location.search);
6666 if (searchParams.has('StockError'))
6667 {
6668 let stockErrorPar = searchParams.get('StockError');
6669 alert(stockErrorPar);
6670 }
6671 });
6672 </script>
6673 </body>
6674 </html>
6675
6676