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