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