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