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