Error executing template "Designs/Rapido/_parsed/ContentPage.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at CompiledRazorTemplates.Dynamic.RazorEngine_dd23ad39edf5495cac5e2be01ea4d9e9.<RenderFooter>b__180_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Capo\Gastro.cloud.dynamicweb-cms.com\files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 6928
at RazorEngine.Templating.TemplateWriter.ToString()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at CompiledRazorTemplates.Dynamic.RazorEngine_dd23ad39edf5495cac5e2be01ea4d9e9.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Capo\Gastro.cloud.dynamicweb-cms.com\files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
at CompiledRazorTemplates.Dynamic.RazorEngine_dd23ad39edf5495cac5e2be01ea4d9e9.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Capo\Gastro.cloud.dynamicweb-cms.com\files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
at CompiledRazorTemplates.Dynamic.RazorEngine_dd23ad39edf5495cac5e2be01ea4d9e9.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Capo\Gastro.cloud.dynamicweb-cms.com\files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 292
at CompiledRazorTemplates.Dynamic.RazorEngine_dd23ad39edf5495cac5e2be01ea4d9e9.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Capo\Gastro.cloud.dynamicweb-cms.com\files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
at CompiledRazorTemplates.Dynamic.RazorEngine_dd23ad39edf5495cac5e2be01ea4d9e9.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Capo\Gastro.cloud.dynamicweb-cms.com\files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 292
at CompiledRazorTemplates.Dynamic.RazorEngine_dd23ad39edf5495cac5e2be01ea4d9e9.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Capo\Gastro.cloud.dynamicweb-cms.com\files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
at CompiledRazorTemplates.Dynamic.RazorEngine_dd23ad39edf5495cac5e2be01ea4d9e9.<RenderMasterBody>b__202_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Capo\Gastro.cloud.dynamicweb-cms.com\files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8233
at RazorEngine.Templating.TemplateWriter.ToString()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at CompiledRazorTemplates.Dynamic.RazorEngine_dd23ad39edf5495cac5e2be01ea4d9e9.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Capo\Gastro.cloud.dynamicweb-cms.com\files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
at CompiledRazorTemplates.Dynamic.RazorEngine_dd23ad39edf5495cac5e2be01ea4d9e9.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Capo\Gastro.cloud.dynamicweb-cms.com\files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
at CompiledRazorTemplates.Dynamic.RazorEngine_dd23ad39edf5495cac5e2be01ea4d9e9.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Capo\Gastro.cloud.dynamicweb-cms.com\files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 292
at CompiledRazorTemplates.Dynamic.RazorEngine_dd23ad39edf5495cac5e2be01ea4d9e9.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Capo\Gastro.cloud.dynamicweb-cms.com\files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
at CompiledRazorTemplates.Dynamic.RazorEngine_dd23ad39edf5495cac5e2be01ea4d9e9.Execute() in D:\dynamicweb.net\Solutions\Capo\Gastro.cloud.dynamicweb-cms.com\files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8066
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 };
133134 masterPage.Add(root);
135 }
136137 @* 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
147148149 @*--- START: Base block renderers ---*@
150151 @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();
155156 foreach (Block item in blocks)
157 {
158 if (debug) {
159 <!-- Block START: @item.Id -->
160 }
161162 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 : "";
168169 <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 : "";
176177 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 }
184185 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;
190191 <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 }
195196 if (item.Design.RenderType == RenderType.Table)
197 {
198 <table class="table @cssClass dw-mod" id="Block__@item.Id">
199 @RenderBlock(item)
200 </table>
201 }
202203 if (item.Design.RenderType == RenderType.TableRow)
204 {
205 <tr class="@cssClass dw-mod" id="Block__@item.Id">
206 @RenderBlock(item)
207 </tr>
208 }
209210 if (item.Design.RenderType == RenderType.TableColumn)
211 {
212 <td class="@cssClass dw-mod" id="Block__@item.Id">
213 @RenderBlock(item)
214 </td>
215 }
216217 if (item.Design.RenderType == RenderType.CardHeader)
218 {
219 <div class="card-header @cssClass dw-mod">
220 @RenderBlock(item)
221 </div>
222 }
223224 if (item.Design.RenderType == RenderType.CardBody)
225 {
226 <div class="card @cssClass dw-mod">
227 @RenderBlock(item)
228 </div>
229 }
230231 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 }
243244 if (debug) {
245 <!-- Block END: @item.Id -->
246 }
247 }
248 }
249250 @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;
253254 if (item.Template != null)
255 {
256 @BlocksPage.RenderTemplate(item.Template)
257 }
258259 if (item.Component != null)
260 {
261 string customSufix = "Custom";
262 string methodName = item.Component.HelperName;
263264 ComponentBase[] methodParameters = new ComponentBase[1];
265 methodParameters[0] = item.Component;
266 Type methodType = this.GetType();
267268 MethodInfo customMethod = methodType.GetMethod(methodName + customSufix);
269270 try {
271 if (debug) {
272 <!-- Component: @methodName.Replace("Render", "") -->
273 }
274 if(customMethod != null) {
275 @customMethod.Invoke(this, methodParameters).ToString();
276 } else {
277 MethodInfo generalMethod = methodType.GetMethod(methodName);
278 @generalMethod.Invoke(this, methodParameters).ToString();
279 }
280 } catch {
281 try {
282 MethodInfo generalMethod = methodType.GetMethod(methodName);
283 @generalMethod.Invoke(this, methodParameters).ToString();
284 } catch(Exception ex) {
285 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked", ex);
286 }
287 }
288 }
289290 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList)
291 {
292 @RenderBlockList(item.BlocksList)
293 }
294 }
295296 @*--- END: Base block renderers ---*@
297298299 @* Include the components *@
300 @using Dynamicweb.Rapido.Blocks.Components
301 @using Dynamicweb.Rapido.Blocks.Components.General
302 @using Dynamicweb.Rapido.Blocks
303 @using System.IO
304305 @* Required *@
306 @using Dynamicweb.Rapido.Blocks.Components
307 @using Dynamicweb.Rapido.Blocks.Components.General
308 @using Dynamicweb.Rapido.Blocks
309310311 @helper Render(ComponentBase component)
312 {
313 if (component != null)
314 {
315 @component.Render(this)
316 }
317 }
318319 @* Components *@
320 @using System.Reflection
321 @using Dynamicweb.Rapido.Blocks.Components.General
322323324 @* Component *@
325326 @helper RenderIcon(Icon settings)
327 {
328 if (settings != null)
329 {
330 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : "";
331332 if (settings.Name != null)
333 {
334 if (string.IsNullOrEmpty(settings.Label))
335 {
336 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i>
337 }
338 else
339 {
340 if (settings.LabelPosition == IconLabelPosition.Before)
341 {
342 <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>
343 }
344 else
345 {
346 <div class="u-flex u-flex--align-items-center @settings.CssClass"><i class="@settings.Prefix @settings.Name u-margin-right u-w20px" @color></i>@settings.Label</div>
347 }
348 }
349 }
350 else if (!string.IsNullOrEmpty(settings.Label))
351 {
352 @settings.Label
353 }
354 }
355 }
356 @using System.Reflection
357 @using Dynamicweb.Rapido.Blocks.Components.General
358 @using Dynamicweb.Rapido.Blocks.Components
359 @using Dynamicweb.Core
360361 @* Component *@
362363 @helper RenderButton(Button settings)
364 {
365 if (settings != null && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null))
366 {
367 Dictionary<string, string> attributes = new Dictionary<string, string>();
368 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>();
369 if (settings.Disabled) {
370 attributes.Add("disabled", "true");
371 classList.Add("disabled");
372 }
373374 if (!string.IsNullOrEmpty(settings.ConfirmText) || !string.IsNullOrEmpty(settings.ConfirmTitle))
375 {
376 settings.Id = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N");
377 @RenderConfirmDialog(settings);
378 settings.OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = true";
379 }
380381 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
382 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
383 if (!string.IsNullOrEmpty(settings.AltText))
384 {
385 attributes.Add("title", settings.AltText);
386 }
387 else if (!string.IsNullOrEmpty(settings.Title))
388 {
389 string cleanTitle = Regex.Replace(settings.Title, "<.*?>", String.Empty);
390 cleanTitle = cleanTitle.Replace(" ", " ");
391 attributes.Add("title", cleanTitle);
392 }
393394 var onClickEvents = new List<string>();
395 if (!string.IsNullOrEmpty(settings.OnClick))
396 {
397 onClickEvents.Add(settings.OnClick);
398 }
399 if (!string.IsNullOrEmpty(settings.Href))
400 {
401 onClickEvents.Add("location.href='" + settings.Href + "'");
402 }
403 if (onClickEvents.Count > 0)
404 {
405 attributes.Add("onClick", string.Join(";", onClickEvents));
406 }
407408 if (settings.ButtonLayout != ButtonLayout.None)
409 {
410 classList.Add("btn");
411 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower();
412 if (btnLayout == "linkclean")
413 {
414 btnLayout = "link-clean"; //fix
415 }
416 classList.Add("btn--" + btnLayout);
417 }
418419 if (settings.Icon == null)
420 {
421 settings.Icon = new Icon();
422 }
423424 settings.Icon.CssClass += Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower() != "linkclean" ? " u-flex--align-center" : "";
425 settings.Icon.Label = settings.Title;
426427 attributes.Add("type", Enum.GetName(typeof(ButtonType), settings.ButtonType).ToLower());
428429 <button class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</button>
430 }
431 }
432433 @helper RenderConfirmDialog(Button settings)
434 {
435 Modal confirmDialog = new Modal {
436 Id = settings.Id,
437 Width = ModalWidth.Sm,
438 Heading = new Heading
439 {
440 Level = 2,
441 Title = settings.ConfirmTitle
442 },
443 BodyText = settings.ConfirmText
444 };
445446 confirmDialog.AddAction(new Button { Title = Translate("Cancel"), ButtonLayout = ButtonLayout.Secondary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false"});
447 confirmDialog.AddAction(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false;" + settings.OnClick });
448449 @Render(confirmDialog)
450 }
451 @using Dynamicweb.Rapido.Blocks.Components.General
452 @using Dynamicweb.Rapido.Blocks.Components
453 @using Dynamicweb.Core
454455 @helper RenderDashboard(Dashboard settings)
456 {
457 var widgets = settings.GetWidgets();
458459 if (!string.IsNullOrEmpty(settings.WidgetsBaseBackgroundColor))
460 {
461 //set bg color for them
462463 System.Drawing.Color color = System.Drawing.ColorTranslator.FromHtml(settings.WidgetsBaseBackgroundColor);
464 int r = Convert.ToInt16(color.R);
465 int g = Convert.ToInt16(color.G);
466 int b = Convert.ToInt16(color.B);
467468 var count = widgets.Length;
469 var max = Math.Max(r, Math.Max(g, b));
470 double step = 255.0 / (max * count);
471 var i = 0;
472 foreach (var widget in widgets)
473 {
474 i++;
475476 var shade = "rgb(" + Converter.ToString(r * step * i).Replace(",", ".") + ", " + Converter.ToString(g * step * i).Replace(",", ".") + ", " + Converter.ToString(b * step * i).Replace(",", ".") + ")";
477 widget.BackgroundColor = shade;
478 }
479 }
480481 <div class="dashboard @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
482 @foreach (var widget in widgets)
483 {
484 <div class="dashboard__widget">
485 @Render(widget)
486 </div>
487 }
488 </div>
489 }
490 @using Dynamicweb.Rapido.Blocks.Components.General
491 @using Dynamicweb.Rapido.Blocks.Components
492493 @helper RenderDashboardWidgetLink(DashboardWidgetLink settings)
494 {
495 if (!string.IsNullOrEmpty(settings.Link))
496 {
497 var backgroundStyles = "";
498 if (!string.IsNullOrEmpty(settings.BackgroundColor))
499 {
500 backgroundStyles = "style=\"background-color:" + settings.BackgroundColor + "\"";
501 }
502503 <a href="@settings.Link" class="widget widget--link @settings.CssClass dw-mod" @backgroundStyles title="@settings.Title" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
504 <div class="u-center-middle u-color-light">
505 @if (settings.Icon != null)
506 {
507 settings.Icon.CssClass += "widget__icon";
508 @Render(settings.Icon)
509 }
510 <div class="widget__title">@settings.Title</div>
511 </div>
512 </a>
513 }
514 }
515 @using Dynamicweb.Rapido.Blocks.Components.General
516 @using Dynamicweb.Rapido.Blocks.Components
517518 @helper RenderDashboardWidgetCounter(DashboardWidgetCounter settings)
519 {
520 var backgroundStyles = "";
521 if (!string.IsNullOrEmpty(settings.BackgroundColor))
522 {
523 backgroundStyles = "style='background-color:" + settings.BackgroundColor + "'";
524 }
525526 <div class="widget @settings.CssClass dw-mod" @backgroundStyles @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
527 <div class="u-center-middle u-color-light">
528 @if (settings.Icon != null)
529 {
530 settings.Icon.CssClass += "widget__icon";
531 @Render(settings.Icon)
532 }
533 <div class="widget__counter">@settings.Count</div>
534 <div class="widget__title">@settings.Title</div>
535 </div>
536 </div>
537 }
538 @using System.Reflection
539 @using Dynamicweb.Rapido.Blocks.Components.General
540 @using Dynamicweb.Rapido.Blocks.Components
541 @using Dynamicweb.Core
542543 @* Component *@
544545 @helper RenderLink(Link settings)
546 {
547 if (settings != null && !string.IsNullOrEmpty(settings.Href) && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null))
548 {
549 Dictionary<string, string> attributes = new Dictionary<string, string>();
550 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>();
551 if (settings.Disabled)
552 {
553 attributes.Add("disabled", "true");
554 classList.Add("disabled");
555 }
556557 if (!string.IsNullOrEmpty(settings.AltText))
558 {
559 attributes.Add("title", settings.AltText);
560 }
561 else if (!string.IsNullOrEmpty(settings.Title))
562 {
563 attributes.Add("title", settings.Title);
564 }
565566 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
567 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
568 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onClick", settings.OnClick); }
569 attributes.Add("href", settings.Href);
570571 if (settings.ButtonLayout != ButtonLayout.None)
572 {
573 classList.Add("btn");
574 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower();
575 if (btnLayout == "linkclean")
576 {
577 btnLayout = "link-clean"; //fix
578 }
579 classList.Add("btn--" + btnLayout);
580 }
581582 if (settings.Icon == null)
583 {
584 settings.Icon = new Icon();
585 }
586 settings.Icon.Label = settings.Title;
587588 if (settings.Target == LinkTargetType.Blank && settings.Rel == LinkRelType.None)
589 {
590 settings.Rel = LinkRelType.Noopener;
591 }
592 if (settings.Target != LinkTargetType.None)
593 {
594 attributes.Add("target", "_" + Enum.GetName(typeof(LinkTargetType), settings.Target).ToLower());
595 }
596 if (settings.Download)
597 {
598 attributes.Add("download", "true");
599 }
600 if (settings.Rel != LinkRelType.None)
601 {
602 attributes.Add("rel", Enum.GetName(typeof(LinkRelType), settings.Rel).ToLower());
603 }
604605 <a class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</a>
606 }
607 }
608 @using System.Reflection
609 @using Dynamicweb.Rapido.Blocks.Components
610 @using Dynamicweb.Rapido.Blocks.Components.General
611 @using Dynamicweb.Rapido.Blocks
612613614 @* Component *@
615616 @helper RenderRating(Rating settings)
617 {
618 if (settings.Score > 0)
619 {
620 int rating = settings.Score;
621 string iconType = "fa-star";
622623 switch (settings.Type.ToString()) {
624 case "Stars":
625 iconType = "fa-star";
626 break;
627 case "Hearts":
628 iconType = "fa-heart";
629 break;
630 case "Lemons":
631 iconType = "fa-lemon";
632 break;
633 case "Bombs":
634 iconType = "fa-bomb";
635 break;
636 }
637638 <div class="u-ta-right">
639 @for (int i = 0; i < settings.OutOf; i++)
640 {
641 <i class="@(rating > i ? "fas" : "far") @iconType"></i>
642 }
643 </div>
644 }
645 }
646 @using System.Reflection
647 @using Dynamicweb.Rapido.Blocks.Components.General
648 @using Dynamicweb.Rapido.Blocks.Components
649650651 @* Component *@
652653 @helper RenderSelectFieldOption(SelectFieldOption settings)
654 {
655 Dictionary<string, string> attributes = new Dictionary<string, string>();
656 if (settings.Checked) { attributes.Add("selected", "true"); }
657 if (settings.Disabled) { attributes.Add("disabled", "true"); }
658 if (settings.Value != null) { attributes.Add("value", settings.Value); }
659 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
660661 <option @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Label</option>
662 }
663 @using System.Reflection
664 @using Dynamicweb.Rapido.Blocks.Components.General
665 @using Dynamicweb.Rapido.Blocks.Components
666667668 @* Component *@
669670 @helper RenderNavigation(Navigation settings) {
671 @RenderNavigation(new
672 {
673 id = settings.Id,
674 cssclass = settings.CssClass,
675 startLevel = settings.StartLevel,
676 endlevel = settings.EndLevel,
677 expandmode = settings.Expandmode,
678 sitemapmode = settings.SitemapMode,
679 template = settings.Template
680 })
681 }
682 @using Dynamicweb.Rapido.Blocks.Components.General
683 @using Dynamicweb.Rapido.Blocks.Components
684685686 @* Component *@
687688 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) {
689 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id;
690 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template;
691 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel;
692 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel;
693 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode;
694 settings.SitemapMode = false;
695696 @RenderNavigation(settings)
697 }
698 @using Dynamicweb.Rapido.Blocks.Components.General
699 @using Dynamicweb.Rapido.Blocks.Components
700701702 @* Component *@
703704 @helper RenderLeftNavigation(LeftNavigation settings) {
705 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id;
706 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template;
707 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel;
708 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel;
709 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode;
710711 <div class="grid__cell">
712 @RenderNavigation(settings)
713 </div>
714 }
715 @using System.Reflection
716 @using Dynamicweb.Rapido.Blocks.Components.General
717 @using Dynamicweb.Core
718719 @* Component *@
720721 @helper RenderHeading(Heading settings)
722 {
723 if (settings != null && !string.IsNullOrEmpty(settings.Title))
724 {
725 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : "";
726 string tagName = settings.Level != 0 ? "h" + settings.Level.ToString() : "div";
727728 @("<" + tagName + " class=\"" + settings.CssClass + " dw-mod\" " + color + ">")
729 if (!string.IsNullOrEmpty(settings.Link))
730 {
731 @Render(new Link { Href = settings.Link, Icon = settings.Icon, Title = settings.Title, ButtonLayout = ButtonLayout.None })
732 }
733 else
734 {
735 if (settings.Icon == null)
736 {
737 settings.Icon = new Icon();
738 }
739 settings.Icon.Label = settings.Title;
740 @Render(settings.Icon)
741 }
742 @("</" + tagName + ">");
743 }
744 }
745 @using Dynamicweb.Rapido.Blocks.Components
746 @using Dynamicweb.Rapido.Blocks.Components.General
747 @using Dynamicweb.Rapido.Blocks
748749750 @* Component *@
751752 @helper RenderImage(Image settings)
753 {
754 if (settings.FilterPrimary != ImageFilter.None || settings.FilterSecondary != ImageFilter.None)
755 {
756 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>();
757 if (!string.IsNullOrEmpty(settings.FilterColor)) { optionalAttributes.Add("style", "background-color: " + settings.FilterColor); }
758759 if (settings.Caption != null)
760 {
761 @:<div>
762 }
763764 var primaryFilterClass = settings.FilterPrimary.ToString().ToLower();
765 var secondaryFilterClass = settings.FilterSecondary.ToString().ToLower();
766767 <div class="image-filter image-filter--@primaryFilterClass u-position-relative dw-mod" @ComponentMethods.AddAttributes(optionalAttributes)>
768 <div class="image-filter image-filter--@secondaryFilterClass dw-mod">
769 @if (settings.Link != null)
770 {
771 <a href="@settings.Link">
772 @RenderTheImage(settings)
773 </a>
774 }
775 else
776 {
777 @RenderTheImage(settings)
778 }
779 </div>
780 </div>
781782 if (settings.Caption != null)
783 {
784 <span class="image-caption dw-mod">@settings.Caption</span>
785 @:</div>
786 }
787 }
788 else
789 {
790 if (settings.Caption != null)
791 {
792 @:<div>
793 }
794 if (!string.IsNullOrEmpty(settings.Link))
795 {
796 <a href="@settings.Link">
797 @RenderTheImage(settings)
798 </a>
799 }
800 else
801 {
802 @RenderTheImage(settings)
803 }
804805 if (settings.Caption != null)
806 {
807 <span class="image-caption dw-mod">@settings.Caption</span>
808 @:</div>
809 }
810 }
811 }
812813 @helper RenderTheImage(Image settings)
814 {
815 if (settings != null)
816 {
817 string alternativeImage = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("AlternativeImage")) ? Pageview.AreaSettings.GetItem("Settings").GetFile("AlternativeImage").PathUrlEncoded : "/Images/missing_image.jpg";
818 string placeholderImage = "/Files/Images/placeholder.gif";
819 string imageEngine = "/Admin/Public/GetImage.ashx?";
820821 string imageStyle = "";
822823 switch (settings.Style)
824 {
825 case ImageStyle.Ball:
826 imageStyle = "grid__cell-img--ball";
827 break;
828829 case ImageStyle.Triangle:
830 imageStyle = "grid__cell-img--triangle";
831 break;
832 }
833834 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle || settings.Style == ImageStyle.Triangle)
835 {
836 settings.ImageDefault.Crop = settings.ImageDefault.Crop == 5 ? settings.ImageDefault.Crop = 0 : settings.ImageDefault.Crop;
837838 if (settings.ImageDefault != null)
839 {
840 settings.ImageDefault.Height = settings.ImageDefault.Width;
841 }
842 if (settings.ImageMedium != null)
843 {
844 settings.ImageMedium.Height = settings.ImageMedium.Width;
845 }
846 if (settings.ImageSmall != null)
847 {
848 settings.ImageSmall.Height = settings.ImageSmall.Width;
849 }
850 }
851852 string defaultImage = imageEngine;
853 string imageSmall = "";
854 string imageMedium = "";
855856 if (settings.DisableImageEngine)
857 {
858 defaultImage = settings.Path;
859 }
860 else
861 {
862 if (settings.ImageDefault != null)
863 {
864 defaultImage += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageDefault);
865866 if (settings.Path.GetType() != typeof(string))
867 {
868 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
869 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
870 }
871 else
872 {
873 defaultImage += settings.Path != null ? "Image=" + settings.Path : "";
874 }
875876 defaultImage += "&AlternativeImage=" + alternativeImage;
877 }
878879 if (settings.ImageSmall != null)
880 {
881 imageSmall = "data-src-small=\"" + imageEngine;
882 imageSmall += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageSmall);
883884 if (settings.Path.GetType() != typeof(string))
885 {
886 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
887 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
888 }
889 else
890 {
891 imageSmall += settings.Path != null ? "Image=" + settings.Path : "";
892 }
893894 imageSmall += "&alternativeImage=" + alternativeImage;
895896 imageSmall += "\"";
897 }
898899 if (settings.ImageMedium != null)
900 {
901 imageMedium = "data-src-medium=\"" + imageEngine;
902 imageMedium += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageMedium);
903904 if (settings.Path.GetType() != typeof(string))
905 {
906 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
907 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
908 }
909 else
910 {
911 imageMedium += settings.Path != null ? "Image=" + settings.Path : "";
912 }
913914 imageMedium += "&alternativeImage=" + alternativeImage;
915916 imageMedium += "\"";
917 }
918 }
919920 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>();
921 if (!string.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); }
922 if (!string.IsNullOrEmpty(settings.Title))
923 {
924 optionalAttributes.Add("alt", settings.Title);
925 optionalAttributes.Add("title", settings.Title);
926 }
927928 if (settings.DisableLazyLoad)
929 {
930 <img id="@settings.Id" class="@imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) />
931 }
932 else
933 {
934 <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) />
935 }
936 }
937 }
938 @using System.Reflection
939 @using Dynamicweb.Rapido.Blocks.Components.General
940 @using Dynamicweb.Rapido.Blocks.Components
941942 @* Component *@
943944 @helper RenderFileField(FileField settings)
945 {
946 var attributes = new Dictionary<string, string>();
947 if (string.IsNullOrEmpty(settings.Id))
948 {
949 settings.Id = Guid.NewGuid().ToString("N");
950 }
951952 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
953 if (settings.Disabled) { attributes.Add("disabled", "true"); }
954 if (settings.Required) { attributes.Add("required", "true"); }
955 if (settings.Multiple) { attributes.Add("multiple", "true"); }
956 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
957 if (string.IsNullOrEmpty(settings.ChooseFileText))
958 {
959 settings.ChooseFileText = Translate("Choose file");
960 }
961 if (string.IsNullOrEmpty(settings.NoFilesChosenText))
962 {
963 settings.NoFilesChosenText = Translate("No files chosen...");
964 }
965 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
966967 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
968969 string setValueToFakeInput = "FileUpload.setValueToFakeInput(this)";
970 attributes.Add("onchange", setValueToFakeInput + (!string.IsNullOrEmpty(settings.OnChange) ? settings.OnChange : ""));
971972 attributes.Add("type", "file");
973 if (settings.Value != null) { attributes.Add("value", settings.Value); }
974 settings.CssClass = "u-full-width " + settings.CssClass;
975976 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
977978 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod">
979 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
980 {
981 <div class="u-full-width">
982 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
983 @if (settings.Link != null) {
984 <div class="u-pull--right">
985 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
986 @Render(settings.Link)
987 </div>
988 }
989 </div>
990991 }
992993 @if (!string.IsNullOrEmpty(settings.HelpText))
994 {
995 <small class="form__help-text">@settings.HelpText</small>
996 }
997998 <div class="form__field-combi file-input u-no-margin dw-mod">
999 <input @ComponentMethods.AddAttributes(resultAttributes) class="file-input__real-input" data-no-files-text="@settings.NoFilesChosenText" data-many-files-text="@Translate("files")" />
1000 <label for="@settings.Id" class="file-input__btn btn--secondary btn dw-mod">@settings.ChooseFileText</label>
1001 <label for="@settings.Id" class="@settings.CssClass file-input__fake-input js-fake-input dw-mod">@settings.NoFilesChosenText</label>
1002 @if (settings.UploadButton != null)
1003 {
1004 settings.UploadButton.CssClass += " btn--condensed u-no-margin";
1005 @Render(settings.UploadButton)
1006 }
1007 </div>
1008 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1009 </div>
1010 }
1011 @using System.Reflection
1012 @using Dynamicweb.Rapido.Blocks.Components.General
1013 @using Dynamicweb.Rapido.Blocks.Components
1014 @using Dynamicweb.Core
1015 @using System.Linq
10161017 @* Component *@
10181019 @helper RenderDateTimeField(DateTimeField settings)
1020 {
1021 if (string.IsNullOrEmpty(settings.Id))
1022 {
1023 settings.Id = Guid.NewGuid().ToString("N");
1024 }
10251026 var textField = new TextField {
1027 Name = settings.Name,
1028 Id = settings.Id,
1029 Label = settings.Label,
1030 HelpText = settings.HelpText,
1031 Value = settings.Value,
1032 Disabled = settings.Disabled,
1033 Required = settings.Required,
1034 ErrorMessage = settings.ErrorMessage,
1035 CssClass = settings.CssClass,
1036 WrapperCssClass = settings.WrapperCssClass,
1037 OnChange = settings.OnChange,
1038 OnClick = settings.OnClick,
1039 Link = settings.Link,
1040 ExtraAttributes = settings.ExtraAttributes,
1041 //
1042 Placeholder = settings.Placeholder
1043 };
10441045 @Render(textField)
10461047 List<string> jsAttributes = new List<string>();
10481049 jsAttributes.Add("mode: '" + Enum.GetName(typeof(DateTimeFieldMode), settings.Mode).ToLower() + "'");
10501051 if (!string.IsNullOrEmpty(settings.DateFormat))
1052 {
1053 jsAttributes.Add("dateFormat: '" + settings.DateFormat + "'");
1054 }
1055 if (!string.IsNullOrEmpty(settings.MinDate))
1056 {
1057 jsAttributes.Add("minDate: '" + settings.MinDate + "'");
1058 }
1059 if (!string.IsNullOrEmpty(settings.MaxDate))
1060 {
1061 jsAttributes.Add("maxDate: '" + settings.MaxDate + "'");
1062 }
1063 if (settings.IsInline)
1064 {
1065 jsAttributes.Add("inline: " + Converter.ToString(settings.IsInline).ToLower());
1066 }
1067 if (settings.EnableTime)
1068 {
1069 jsAttributes.Add("enableTime: " + Converter.ToString(settings.EnableTime).ToLower());
1070 }
1071 if (settings.EnableWeekNumbers)
1072 {
1073 jsAttributes.Add("weekNumbers: " + Converter.ToString(settings.EnableWeekNumbers).ToLower());
1074 }
10751076 jsAttributes.AddRange(settings.GetFlatPickrOptions().Select(x => x.Key + ": " + x.Value));
10771078 <script>
1079 document.addEventListener("DOMContentLoaded", function () {
1080 flatpickr("#@textField.Id", {
1081 @string.Join(",", jsAttributes)
1082 });
1083 });
1084 </script>
1085 }
1086 @using System.Reflection
1087 @using Dynamicweb.Rapido.Blocks.Components.General
1088 @using Dynamicweb.Rapido.Blocks.Components
10891090 @* Component *@
10911092 @helper RenderTextField(TextField settings)
1093 {
1094 var attributes = new Dictionary<string, string>();
1095 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1096 {
1097 settings.Id = Guid.NewGuid().ToString("N");
1098 }
10991100 /*base settings*/
1101 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1102 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1103 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1104 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1105 if (settings.Required) { attributes.Add("required", "true"); }
1106 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1107 /*end*/
11081109 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
1110 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
1111 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
1112 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
1113 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); }
1114 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); }
1115 attributes.Add("type", Enum.GetName(typeof(TextFieldType), settings.Type).ToLower());
1116 if (settings.Type == TextFieldType.Password) { attributes.Add("autocomplete", "off"); };
1117 if (settings.Value != null) { attributes.Add("value", settings.Value); }
11181119 settings.CssClass = "u-full-width " + settings.CssClass;
11201121 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
11221123 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
11241125 string noMargin = "u-no-margin";
1126 if (!settings.ReadOnly) {
1127 noMargin = "";
1128 }
11291130 <div class="form__field-group u-full-width @noMargin @settings.WrapperCssClass dw-mod">
1131 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1132 {
1133 <div class="u-full-width">
1134 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1135 @if (settings.Link != null) {
1136 settings.Link.ButtonLayout = ButtonLayout.LinkClean;
11371138 <div class="u-pull--right">
1139 @Render(settings.Link)
1140 </div>
1141 }
1142 </div>
11431144 }
11451146 @if (!string.IsNullOrEmpty(settings.HelpText))
1147 {
1148 <small class="form__help-text">@settings.HelpText</small>
1149 }
11501151 @if (settings.ActionButton != null)
1152 {
1153 settings.ActionButton.CssClass += " btn--condensed u-no-margin";
1154 <div class="form__field-combi u-no-margin dw-mod">
1155 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1156 @Render(settings.ActionButton)
1157 </div>
1158 }
1159 else
1160 {
1161 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1162 }
11631164 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1165 </div>
1166 }
1167 @using System.Reflection
1168 @using Dynamicweb.Rapido.Blocks.Components.General
1169 @using Dynamicweb.Rapido.Blocks.Components
11701171 @* Component *@
11721173 @helper RenderNumberField(NumberField settings)
1174 {
1175 var attributes = new Dictionary<string, string>();
1176 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1177 {
1178 settings.Id = Guid.NewGuid().ToString("N");
1179 }
11801181 /*base settings*/
1182 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1183 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1184 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1185 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1186 if (settings.Required) { attributes.Add("required", "true"); }
1187 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1188 /*end*/
11891190 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
1191 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
1192 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
1193 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
1194 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); }
1195 if (settings.Min != null) { attributes.Add("min", settings.Min.ToString()); }
1196 if (settings.Step != 0) { attributes.Add("step", settings.Step.ToString()); }
1197 if (settings.Value != null && !string.IsNullOrEmpty(settings.Value.ToString())) { attributes.Add("value", settings.Value.ToString()); }
1198 attributes.Add("type", "number");
11991200 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
12011202 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod">
1203 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1204 {
1205 <div class="u-full-width">
1206 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1207 @if (settings.Link != null) {
1208 <div class="u-pull--right">
1209 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1210 @Render(settings.Link)
1211 </div>
1212 }
1213 </div>
12141215 }
12161217 @if (!string.IsNullOrEmpty(settings.HelpText))
1218 {
1219 <small class="form__help-text">@settings.HelpText</small>
1220 }
12211222 @if (settings.ActionButton != null)
1223 {
1224 settings.ActionButton.CssClass += " btn--condensed u-no-margin";
1225 <div class="form__field-combi u-no-margin dw-mod">
1226 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1227 @Render(settings.ActionButton)
1228 </div>
1229 }
1230 else
1231 {
1232 <div class="form__field-combi u-no-margin dw-mod">
1233 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1234 </div>
1235 }
12361237 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1238 </div>
1239 }
1240 @using System.Reflection
1241 @using Dynamicweb.Rapido.Blocks.Components.General
1242 @using Dynamicweb.Rapido.Blocks.Components
124312441245 @* Component *@
12461247 @helper RenderTextareaField(TextareaField settings)
1248 {
1249 Dictionary<string, string> attributes = new Dictionary<string, string>();
1250 string id = settings.Id;
1251 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(id))
1252 {
1253 id = Guid.NewGuid().ToString("N");
1254 }
12551256 if (!string.IsNullOrEmpty(id)) { attributes.Add("id", id); }
1257 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1258 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
1259 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
1260 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
1261 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1262 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); }
1263 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1264 if (settings.Required) { attributes.Add("required", "true"); }
1265 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
1266 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); }
1267 if (settings.Rows != 0) { attributes.Add("rows", settings.Rows.ToString()); }
1268 attributes.Add("name", settings.Name);
12691270 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
12711272 <div class="form__field-group @settings.WrapperCssClass dw-mod">
1273 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1274 {
1275 <div class="u-full-width">
1276 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1277 @if (settings.Link != null) {
1278 <div class="u-pull--right">
1279 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1280 @Render(settings.Link)
1281 </div>
1282 }
1283 </div>
1284 }
12851286 @if (!string.IsNullOrEmpty(settings.HelpText))
1287 {
1288 <small class="form__help-text">@settings.HelpText</small>
1289 }
12901291 <textarea class="u-full-width @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Value</textarea>
12921293 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1294 </div>
1295 }
1296 @using System.Reflection
1297 @using Dynamicweb.Rapido.Blocks.Components.General
1298 @using Dynamicweb.Rapido.Blocks.Components
129913001301 @* Component *@
13021303 @helper RenderHiddenField(HiddenField settings) {
1304 var attributes = new Dictionary<string, string>();
1305 attributes.Add("type", "hidden");
1306 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1307 if (settings.Value != null) { attributes.Add("value", settings.Value); }
1308 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
13091310 <input @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)/>
1311 }
1312 @using System.Reflection
1313 @using Dynamicweb.Rapido.Blocks.Components.General
1314 @using Dynamicweb.Rapido.Blocks.Components
13151316 @* Component *@
13171318 @helper RenderCheckboxField(CheckboxField settings)
1319 {
1320 var attributes = new Dictionary<string, string>();
1321 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1322 {
1323 settings.Id = Guid.NewGuid().ToString("N");
1324 }
13251326 /*base settings*/
1327 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1328 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1329 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1330 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1331 if (settings.Required) { attributes.Add("required", "true"); }
1332 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1333 /*end*/
13341335 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
13361337 attributes.Add("type", "checkbox");
1338 if (settings.Checked) { attributes.Add("checked", "true"); }
1339 settings.CssClass = "form__control " + settings.CssClass;
1340 if (settings.Value != null) { attributes.Add("value", settings.Value); }
13411342 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
13431344 <div class="form__field-group @settings.WrapperCssClass dw-mod">
1345 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1346 @if (!string.IsNullOrEmpty(settings.Label))
1347 {
1348 <label for="@settings.Id" class="dw-mod">@settings.Label</label>
1349 }
13501351 @if (settings.Link != null) {
1352 <span>
1353 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1354 @Render(settings.Link)
1355 </span>
1356 }
13571358 @if (!string.IsNullOrEmpty(settings.HelpText))
1359 {
1360 <small class="form__help-text checkbox-help dw-mod">@settings.HelpText</small>
1361 }
1362 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1363 </div>
1364 }
1365 @using System.Reflection
1366 @using Dynamicweb.Rapido.Blocks.Components.General
1367 @using Dynamicweb.Rapido.Blocks.Components
136813691370 @* Component *@
13711372 @helper RenderCheckboxListField(CheckboxListField settings)
1373 {
1374 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1375 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1376 {
1377 <div class="u-full-width">
1378 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1379 @if (settings.Link != null) {
1380 <div class="u-pull--right">
1381 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1382 @Render(settings.Link)
1383 </div>
1384 }
1385 </div>
13861387 }
13881389 <div class="u-pull--left">
1390 @if (!string.IsNullOrEmpty(settings.HelpText))
1391 {
1392 <small class="form__help-text">@settings.HelpText</small>
1393 }
13941395 @foreach (var item in settings.Options)
1396 {
1397 if (settings.Required)
1398 {
1399 item.Required = true;
1400 }
1401 if (settings.Disabled)
1402 {
1403 item.Disabled = true;
1404 }
1405 if (!string.IsNullOrEmpty(settings.Name))
1406 {
1407 item.Name = settings.Name;
1408 }
1409 if (!string.IsNullOrEmpty(settings.CssClass))
1410 {
1411 item.CssClass += settings.CssClass;
1412 }
14131414 /* value is not supported */
14151416 if (!string.IsNullOrEmpty(settings.OnClick))
1417 {
1418 item.OnClick += settings.OnClick;
1419 }
1420 if (!string.IsNullOrEmpty(settings.OnChange))
1421 {
1422 item.OnChange += settings.OnChange;
1423 }
1424 @Render(item)
1425 }
14261427 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1428 </div>
14291430 </div>
1431 }
1432 @using Dynamicweb.Rapido.Blocks.Components.General
14331434 @* Component *@
14351436 @helper RenderSearch(Search settings)
1437 {
1438 var searchValue = HttpContext.Current.Request.QueryString.Get(settings.SearchParameter) ?? "";
1439 var groupValue = HttpContext.Current.Request.QueryString.Get(settings.GroupsParameter) ?? "";
14401441 if (string.IsNullOrEmpty(settings.Id))
1442 {
1443 settings.Id = Guid.NewGuid().ToString("N");
1444 }
14451446 var resultAttributes = new Dictionary<string, string>();
14471448 if (settings.PageSize != 0)
1449 {
1450 resultAttributes.Add("data-page-size", settings.PageSize.ToString());
1451 }
1452 if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl))
1453 {
1454 resultAttributes.Add("data-groups-feed-url", settings.GroupItemsFeedUrl);
1455 if (!string.IsNullOrEmpty(groupValue))
1456 {
1457 resultAttributes.Add("data-selected-group", groupValue);
1458 }
1459 if (!string.IsNullOrEmpty(settings.GroupsParameter))
1460 {
1461 resultAttributes.Add("data-groups-parameter", settings.GroupsParameter);
1462 }
1463 }
1464 resultAttributes.Add("data-force-init", "true");
1465 if (settings.GoToFirstSearchResultOnEnter)
1466 {
1467 resultAttributes.Add("data-go-to-first-search-result-on-enter", settings.GoToFirstSearchResultOnEnter.ToString().ToLower());
1468 }
1469 if (!string.IsNullOrEmpty(settings.SearchParameter))
1470 {
1471 resultAttributes.Add("data-search-parameter", settings.SearchParameter);
1472 }
1473 resultAttributes.Add("data-search-feed-url", settings.SearchData.SearchFeedUrl);
1474 resultAttributes.Add("data-results-template-id", settings.SearchData.ResultsTemplateId);
14751476 if (settings.SecondSearchData != null)
1477 {
1478 resultAttributes.Add("data-second-search-feed-url", settings.SecondSearchData.SearchFeedUrl);
1479 resultAttributes.Add("data-second-results-template-id", settings.SecondSearchData.ResultsTemplateId);
1480 }
1481 if (!string.IsNullOrEmpty(settings.ResultsPageUrl))
1482 {
1483 resultAttributes.Add("data-results-page-url", settings.ResultsPageUrl);
1484 }
14851486 resultAttributes = resultAttributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
14871488 string searchFieldCss = (settings.SearchButton == null) ? "search--with-icon" : "";
14891490 <div class="search @settings.CssClass @searchFieldCss js-search-data-source dw-mod" id="@settings.Id" @ComponentMethods.AddAttributes(resultAttributes)>
1491 @if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl))
1492 {
1493 <button type="button" class="search__groups-btn dw-mod js-search-groups-btn">@Translate("All")</button>
1494 <ul class="dropdown dropdown--absolute-position dw-mod search__groups-results js-search-groups-list"></ul>
1495 }
14961497 <input type="text" class="search__field dw-mod js-search-field" placeholder="@settings.Placeholder" value="@searchValue">
14981499 <div class="dropdown dropdown--absolute-position search__results dw-mod js-search-results @(settings.SecondSearchData != null ? "search__results--combined" : "")">
1500 @if (settings.SecondSearchData != null)
1501 {
1502 <div class="search__column search__column--products dw-mod">
1503 <div class="search__column-header dw-mod">@Translate("Products")</div>
1504 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul>
1505 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl))
1506 {
1507 @Render(new Link {
1508 Title = Translate("View all"),
1509 CssClass = "js-view-all-button u-margin",
1510 Href = settings.SearchData.ResultsPageUrl
1511 });
1512 }
1513 </div>
1514 <div class="search__column search__column--pages dw-mod">
1515 <div class="search__column-header">@Translate("Pages")</div>
1516 <ul class="search__results-list dw-mod js-search-results-second-list" id="@(settings.Id)_SecondResultsList"></ul>
1517 @if (!string.IsNullOrEmpty(settings.SecondSearchData.ResultsPageUrl))
1518 {
1519 @Render(new Link
1520 {
1521 Title = Translate("View all"),
1522 CssClass = "js-view-all-button u-margin",
1523 Href = settings.SecondSearchData.ResultsPageUrl
1524 });
1525 }
1526 </div>
1527 }
1528 else
1529 {
1530 <div class="search__column search__column--only dw-mod">
1531 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul>
1532 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl))
1533 {
1534 @Render(new Link {
1535 Title = Translate("View all"),
1536 CssClass = "js-view-all-button u-margin",
1537 Href = settings.SearchData.ResultsPageUrl
1538 });
1539 }
1540 </div>
1541 }
1542 </div>
15431544 @if (settings.SearchButton != null)
1545 {
1546 settings.SearchButton.CssClass += " search__btn js-search-btn";
1547 if (settings.RenderDefaultSearchIcon)
1548 {
1549 settings.SearchButton.Icon = new Icon { Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue };
1550 }
1551 @Render(settings.SearchButton);
1552 }
1553 </div>
1554 }
1555 @using System.Reflection
1556 @using Dynamicweb.Rapido.Blocks.Components.General
1557 @using Dynamicweb.Rapido.Blocks.Components
155815591560 @* Component *@
15611562 @helper RenderSelectField(SelectField settings)
1563 {
1564 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1565 {
1566 settings.Id = Guid.NewGuid().ToString("N");
1567 }
15681569 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod">
1570 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1571 {
1572 <div class="u-full-width">
1573 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1574 @if (settings.Link != null) {
1575 <div class="u-pull--right">
1576 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1577 @Render(settings.Link)
1578 </div>
1579 }
1580 </div>
1581 }
15821583 @if (!string.IsNullOrEmpty(settings.HelpText))
1584 {
1585 <small class="form__help-text">@settings.HelpText</small>
1586 }
15871588 @if (settings.ActionButton != null)
1589 {
1590 settings.ActionButton.CssClass += " btn--condensed u-no-margin";
1591 <div class="form__field-combi u-no-margin dw-mod">
1592 @RenderSelectBase(settings)
1593 @Render(settings.ActionButton)
1594 </div>
1595 }
1596 else
1597 {
1598 @RenderSelectBase(settings)
1599 }
16001601 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1602 </div>
1603 }
16041605 @helper RenderSelectBase(SelectField settings)
1606 {
1607 var attributes = new Dictionary<string, string>();
16081609 /*base settings*/
1610 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1611 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1612 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1613 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1614 if (settings.Required) { attributes.Add("required", "true"); }
1615 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1616 /*end*/
16171618 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
16191620 <select @ComponentMethods.AddAttributes(resultAttributes) class="u-full-width @settings.CssClass dw-mod">
1621 @if (settings.Default != null)
1622 {
1623 @Render(settings.Default)
1624 }
16251626 @foreach (var item in settings.Options)
1627 {
1628 if (settings.Value != null) {
1629 item.Checked = item.Value == settings.Value;
1630 }
1631 @Render(item)
1632 }
1633 </select>
1634 }
1635 @using System.Reflection
1636 @using Dynamicweb.Rapido.Blocks.Components.General
1637 @using Dynamicweb.Rapido.Blocks.Components
16381639 @* Component *@
16401641 @helper RenderRadioButtonField(RadioButtonField settings)
1642 {
1643 var attributes = new Dictionary<string, string>();
1644 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1645 {
1646 settings.Id = Guid.NewGuid().ToString("N");
1647 }
16481649 /*base settings*/
1650 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1651 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1652 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1653 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1654 if (settings.Required) { attributes.Add("required", "true"); }
1655 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1656 /*end*/
16571658 attributes.Add("type", "radio");
1659 if (settings.Checked) { attributes.Add("checked", "true"); }
1660 settings.CssClass = "form__control " + settings.CssClass;
1661 if (settings.Value != null) { attributes.Add("value", settings.Value); }
16621663 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
16641665 <div class="form__field-group @settings.WrapperCssClass dw-mod">
1666 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1667 @if (!string.IsNullOrEmpty(settings.Label))
1668 {
1669 <label for="@settings.Id" class="dw-mod">@settings.Label</label>
1670 }
1671 @if (!string.IsNullOrEmpty(settings.HelpText))
1672 {
1673 <small class="form__help-text">@settings.HelpText</small>
1674 }
1675 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1676 </div>
1677 }
1678 @using System.Reflection
1679 @using Dynamicweb.Rapido.Blocks.Components.General
1680 @using Dynamicweb.Rapido.Blocks.Components
168116821683 @* Component *@
16841685 @helper RenderRadioButtonListField(RadioButtonListField settings)
1686 {
1687 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
16881689 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1690 @if (!string.IsNullOrEmpty(settings.Label))
1691 {
1692 <label>@settings.Label</label>
1693 }
1694 @if (!string.IsNullOrEmpty(settings.HelpText))
1695 {
1696 <small class="form__help-text">@settings.HelpText</small>
1697 }
16981699 @foreach (var item in settings.Options)
1700 {
1701 if (settings.Required)
1702 {
1703 item.Required = true;
1704 }
1705 if (settings.Disabled)
1706 {
1707 item.Disabled = true;
1708 }
1709 if (!string.IsNullOrEmpty(settings.Name))
1710 {
1711 item.Name = settings.Name;
1712 }
1713 if (settings.Value != null && settings.Value == item.Value)
1714 {
1715 item.Checked = true;
1716 }
1717 if (!string.IsNullOrEmpty(settings.OnClick))
1718 {
1719 item.OnClick += settings.OnClick;
1720 }
1721 if (!string.IsNullOrEmpty(settings.OnChange))
1722 {
1723 item.OnChange += settings.OnChange;
1724 }
1725 if (!string.IsNullOrEmpty(settings.CssClass))
1726 {
1727 item.CssClass += settings.CssClass;
1728 }
1729 @Render(item)
1730 }
17311732 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1733 </div>
1734 }
1735 @using System.Reflection
1736 @using Dynamicweb.Rapido.Blocks.Components.General
1737 @using Dynamicweb.Rapido.Blocks.Components
173817391740 @* Component *@
17411742 @helper RenderNotificationMessage(NotificationMessage settings)
1743 {
1744 if (!string.IsNullOrEmpty(settings.Message))
1745 {
1746 var attributes = new Dictionary<string, string>();
1747 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
17481749 string messageTypeClass = Enum.GetName(typeof(NotificationMessageType), settings.MessageType).ToLower();
1750 string messageLayoutClass = Enum.GetName(typeof(NotificationMessageLayout), settings.MessageLayout).ToLower();
1751 string minHeightClass = settings.Icon != null ? "u-min-h70px" : "";
17521753 <div class="notification-message-@messageTypeClass notification-message-@messageLayoutClass @messageLayoutClass @minHeightClass @settings.CssClass u-full-width dw-mod" @ComponentMethods.AddAttributes(attributes)>
1754 @if (settings.Icon != null) {
1755 settings.Icon.Label = !string.IsNullOrEmpty(settings.Icon.Label) ? settings.Message + settings.Icon.Label : settings.Message;
1756 @Render(settings.Icon)
1757 } else {
1758 @settings.Message
1759 }
1760 </div>
1761 }
1762 }
1763 @using Dynamicweb.Rapido.Blocks.Components.General
176417651766 @* Component *@
17671768 @helper RenderHandlebarsRoot(HandlebarsRoot settings) {
1769 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : "";
17701771 <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>
1772 @if (settings.SubBlocks != null) {
1773 @RenderBlockList(settings.SubBlocks)
1774 }
1775 </div>
1776 }
1777 @using System.Reflection
1778 @using Dynamicweb.Rapido.Blocks.Components.General
1779 @using Dynamicweb.Rapido.Blocks.Components
1780 @using System.Text.RegularExpressions
178117821783 @* Component *@
17841785 @helper RenderSticker(Sticker settings) {
1786 if (!String.IsNullOrEmpty(settings.Title)) {
1787 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : "";
1788 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : "";
17891790 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>();
1791 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) {
1792 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : "";
1793 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : "";
1794 optionalAttributes.Add("style", styleTag);
1795 }
17961797 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div>
1798 }
1799 }
18001801 @using System.Reflection
1802 @using Dynamicweb.Rapido.Blocks.Components.General
1803 @using Dynamicweb.Rapido.Blocks.Components
180418051806 @* Component *@
18071808 @helper RenderStickersCollection(StickersCollection settings)
1809 {
1810 if (settings.Stickers.Count > 0)
1811 {
1812 string position = "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower();
18131814 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1815 @foreach (Sticker sticker in settings.Stickers)
1816 {
1817 @Render(sticker)
1818 }
1819 </div>
1820 }
1821 }
18221823 @using Dynamicweb.Rapido.Blocks.Components.General
182418251826 @* Component *@
18271828 @helper RenderForm(Form settings) {
1829 if (settings != null)
1830 {
1831 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>();
1832 if (!string.IsNullOrEmpty(settings.Action)) { optionalAttributes.Add("action", settings.Action); };
1833 if (!string.IsNullOrEmpty(settings.Name)) { optionalAttributes.Add("name", settings.Name); };
1834 if (!string.IsNullOrEmpty(settings.OnSubmit)) { optionalAttributes.Add("onsubmit", settings.OnSubmit); };
1835 var enctypes = new Dictionary<string, string>
1836 {
1837 { "multipart", "multipart/form-data" },
1838 { "text", "text/plain" },
1839 { "application", "application/x-www-form-urlencoded" }
1840 };
1841 if (settings.Enctype != FormEnctype.none) { optionalAttributes.Add("enctype", enctypes[Enum.GetName(typeof(FormEnctype), settings.Enctype).ToLower()]); };
1842 optionalAttributes.Add("method", settings.Method.ToString());
18431844 if (!string.IsNullOrEmpty(settings.FormStartMarkup))
1845 {
1846 @settings.FormStartMarkup
1847 }
1848 else
1849 {
1850 @:<form class="@settings.CssClass u-no-margin dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1851 }
18521853 foreach (var field in settings.GetFields())
1854 {
1855 @Render(field)
1856 }
18571858 @:</form>
1859 }
1860 }
1861 @using System.Reflection
1862 @using Dynamicweb.Rapido.Blocks.Components.General
1863 @using Dynamicweb.Rapido.Blocks.Components
186418651866 @* Component *@
18671868 @helper RenderText(Text settings)
1869 {
1870 @settings.Content
1871 }
1872 @using System.Reflection
1873 @using Dynamicweb.Rapido.Blocks.Components.General
1874 @using Dynamicweb.Rapido.Blocks.Components
187518761877 @* Component *@
18781879 @helper RenderContentModule(ContentModule settings) {
1880 if (!string.IsNullOrEmpty(settings.Content))
1881 {
1882 @settings.Content
1883 }
1884 }
1885 @using System.Reflection
1886 @using Dynamicweb.Rapido.Blocks.Components.General
1887 @using Dynamicweb.Rapido.Blocks.Components
188818891890 @* Component *@
18911892 @helper RenderModal(Modal settings) {
1893 if (settings != null)
1894 {
1895 string modalId = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N");
18961897 string onchange = !string.IsNullOrEmpty(settings.OnClose) ? "onchange=\"if(!this.checked){" + settings.OnClose + "}\"" : "";
18981899 <input type="checkbox" id="@(modalId)ModalTrigger" class="modal-trigger" @onchange />
19001901 <div class="modal-container">
1902 @if (!settings.DisableDarkOverlay)
1903 {
1904 <label for="@(modalId)ModalTrigger" id="@(modalId)ModalOverlay" class="modal-overlay"></label>
1905 }
1906 <div class="modal modal--@settings.Width.ToString().ToLower() modal-height--@settings.Height.ToString().ToLower()" id="@(modalId)Modal">
1907 @if (settings.Heading != null)
1908 {
1909 if (!string.IsNullOrEmpty(settings.Heading.Title))
1910 {
1911 <div class="modal__header">
1912 @Render(settings.Heading)
1913 </div>
1914 }
1915 }
1916 <div class="modal__body @(settings.Width.ToString().ToLower() == "full" ? "modal__body--full" : "")">
1917 @if (!string.IsNullOrEmpty(settings.BodyText))
1918 {
1919 @settings.BodyText
1920 }
1921 @if (settings.BodyTemplate != null)
1922 {
1923 @settings.BodyTemplate
1924 }
1925 @{
1926 var actions = settings.GetActions();
1927 }
1928 </div>
1929 @if (actions.Length > 0)
1930 {
1931 <div class="modal__footer">
1932 @foreach (var action in actions)
1933 {
1934 if (Pageview.Device.ToString() != "Mobile") {
1935 action.CssClass += " u-no-margin";
1936 } else {
1937 action.CssClass += " u-full-width u-margin-bottom";
1938 }
19391940 @Render(action)
1941 }
1942 </div>
1943 }
1944 <label class="modal__close-btn" for="@(modalId)ModalTrigger"></label>
1945 </div>
1946 </div>
1947 }
1948 }
1949 @using Dynamicweb.Rapido.Blocks.Components.General
19501951 @* Component *@
19521953 @helper RenderMediaListItem(MediaListItem settings)
1954 {
1955 <div class="media-list-item @settings.CssClass dw-mod" @(!string.IsNullOrEmpty(settings.Id) ? "id=\"" + settings.Id + "\"" : "")>
1956 @if (!string.IsNullOrEmpty(settings.Label))
1957 {
1958 if (!string.IsNullOrEmpty(settings.Link))
1959 {
1960 @Render(new Link
1961 {
1962 Href = settings.Link,
1963 CssClass = "media-list-item__sticker dw-mod",
1964 ButtonLayout = ButtonLayout.None,
1965 Title = settings.Label,
1966 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : ""
1967 })
1968 }
1969 else if (!string.IsNullOrEmpty(settings.OnClick))
1970 {
1971 <span class="media-list-item__sticker dw-mod" onclick="@(settings.OnClick)">
1972 <span class="u-uppercase">@settings.Label</span>
1973 </span>
1974 }
1975 else
1976 {
1977 <span class="media-list-item__sticker media-list-item__sticker--no-link dw-mod">
1978 <span class="u-uppercase">@settings.Label</span>
1979 </span>
1980 }
1981 }
1982 <div class="media-list-item__wrap">
1983 <div class="media-list-item__info dw-mod">
1984 <div class="media-list-item__header dw-mod">
1985 @if (!string.IsNullOrEmpty(settings.Title))
1986 {
1987 if (!string.IsNullOrEmpty(settings.Link))
1988 {
1989 @Render(new Link
1990 {
1991 Href = settings.Link,
1992 CssClass = "media-list-item__name dw-mod",
1993 ButtonLayout = ButtonLayout.None,
1994 Title = settings.Title,
1995 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : ""
1996 })
1997 }
1998 else if (!string.IsNullOrEmpty(settings.OnClick))
1999 {
2000 <span class="media-list-item__name dw-mod" onclick="@(settings.OnClick)">@settings.Title</span>
2001 }
2002 else
2003 {
2004 <span class="media-list-item__name media-list-item__name--no-link dw-mod">@settings.Title</span>
2005 }
2006 }
20072008 @if (!string.IsNullOrEmpty(settings.Status))
2009 {
2010 <div class="media-list-item__state dw-mod">@settings.Status</div>
2011 }
2012 </div>
2013 @{
2014 settings.InfoTable.CssClass += " media-list-item__parameters-table";
2015 }
20162017 @Render(settings.InfoTable)
2018 </div>
2019 <div class="media-list-item__actions dw-mod">
2020 <div class="media-list-item__actions-list dw-mod">
2021 @{
2022 var actions = settings.GetActions();
20232024 foreach (ButtonBase action in actions)
2025 {
2026 action.ButtonLayout = ButtonLayout.None;
2027 action.CssClass += " media-list-item__action link";
20282029 @Render(action)
2030 }
2031 }
2032 </div>
20332034 @if (settings.SelectButton != null && !string.IsNullOrEmpty(settings.SelectButton.Title))
2035 {
2036 settings.SelectButton.CssClass += " u-no-margin";
20372038 <div class="media-list-item__action-button">
2039 @Render(settings.SelectButton)
2040 </div>
2041 }
2042 </div>
2043 </div>
2044 </div>
2045 }
2046 @using Dynamicweb.Rapido.Blocks.Components.General
2047 @using Dynamicweb.Rapido.Blocks.Components
20482049 @helper RenderTable(Table settings)
2050 {
2051 Dictionary<string, string> attributes = new Dictionary<string, string>();
2052 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
20532054 var enumToClasses = new Dictionary<TableDesign, string>
2055 {
2056 { TableDesign.Clean, "table--clean" },
2057 { TableDesign.Bordered, "table--bordered" },
2058 { TableDesign.Striped, "table--striped" },
2059 { TableDesign.Hover, "table--hover" },
2060 { TableDesign.Compact, "table--compact" },
2061 { TableDesign.Condensed, "table--condensed" },
2062 { TableDesign.NoTopBorder, "table--no-top-border" }
2063 };
2064 string tableDesignClass = "";
2065 if (settings.Design != TableDesign.None)
2066 {
2067 tableDesignClass = enumToClasses[settings.Design];
2068 }
20692070 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableDesign.None) { attributes.Add("class", "table " + tableDesignClass + " " + settings.CssClass + " dw-mod"); }
20712072 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);
20732074 <table @ComponentMethods.AddAttributes(resultAttributes)>
2075 @if (settings.Header != null)
2076 {
2077 <thead>
2078 @Render(settings.Header)
2079 </thead>
2080 }
2081 <tbody>
2082 @foreach (var row in settings.Rows)
2083 {
2084 @Render(row)
2085 }
2086 </tbody>
2087 @if (settings.Footer != null)
2088 {
2089 <tfoot>
2090 @Render(settings.Footer)
2091 </tfoot>
2092 }
2093 </table>
2094 }
2095 @using Dynamicweb.Rapido.Blocks.Components.General
2096 @using Dynamicweb.Rapido.Blocks.Components
20972098 @helper RenderTableRow(TableRow settings)
2099 {
2100 Dictionary<string, string> attributes = new Dictionary<string, string>();
2101 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
21022103 var enumToClasses = new Dictionary<TableRowDesign, string>
2104 {
2105 { TableRowDesign.NoBorder, "table__row--no-border" },
2106 { TableRowDesign.Border, "table__row--border" },
2107 { TableRowDesign.TopBorder, "table__row--top-line" },
2108 { TableRowDesign.BottomBorder, "table__row--bottom-line" },
2109 { TableRowDesign.Solid, "table__row--solid" }
2110 };
21112112 string tableRowDesignClass = "";
2113 if (settings.Design != TableRowDesign.None)
2114 {
2115 tableRowDesignClass = enumToClasses[settings.Design];
2116 }
21172118 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableRowDesign.None) { attributes.Add("class", "table__row " + tableRowDesignClass + " " + settings.CssClass + " dw-mod"); }
21192120 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);
21212122 <tr @ComponentMethods.AddAttributes(resultAttributes)>
2123 @foreach (var cell in settings.Cells)
2124 {
2125 if (settings.IsHeaderRow)
2126 {
2127 cell.IsHeader = true;
2128 }
2129 @Render(cell)
2130 }
2131 </tr>
2132 }
2133 @using Dynamicweb.Rapido.Blocks.Components.General
2134 @using Dynamicweb.Rapido.Blocks.Components
2135 @using Dynamicweb.Core
21362137 @helper RenderTableCell(TableCell settings)
2138 {
2139 Dictionary<string, string> attributes = new Dictionary<string, string>();
2140 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
2141 if (settings.Colspan != 0) { attributes.Add("colspan", Converter.ToString(settings.Colspan)); }
2142 if (settings.Rowspan != 0) { attributes.Add("rowspan", Converter.ToString(settings.Rowspan)); }
2143 if (!string.IsNullOrEmpty(settings.CssClass)) { attributes.Add("class", settings.CssClass + " dw-mod"); }
21442145 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);
21462147 string tagName = settings.IsHeader ? "th" : "td";
21482149 @("<" + tagName + " " + ComponentMethods.AddAttributes(resultAttributes) + ">")
2150 @settings.Content
2151 @("</" + tagName + ">");
2152 }
2153 @using System.Linq
2154 @using Dynamicweb.Rapido.Blocks.Components.General
21552156 @* Component *@
21572158 @helper RenderPagination(Dynamicweb.Rapido.Blocks.Components.General.Pagination settings)
2159 {
2160 var pageNumberQueryStringName = Dynamicweb.Rapido.Services.Pagination.GetPageNumberQueryStringName(settings); // Get the proper 'page number' query string parameter
2161 var queryParameters = Dynamicweb.Rapido.Services.Url.GetQueryParameters(pageNumberQueryStringName); // Get the NameValueCollection from the querystring
21622163 if (settings.NumberOfPages > 1)
2164 {
2165 string url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/Default.aspx";
2166 string ariaLabel = !string.IsNullOrWhiteSpace(settings.AriaLabel) ? settings.AriaLabel : Translate("Page navigation");
2167 Dictionary<string, int> startAndEndPageNumber = Dynamicweb.Rapido.Services.Pagination.GetStartAndEndPageNumber(settings);
21682169 <div class="pager u-margin-top dw-mod @settings.CssClass" aria-label="@ariaLabel">
2170 @if (settings.ShowPagingInfo)
2171 {
2172 <div class="pager__info dw-mod">
2173 @Translate("Page") @settings.CurrentPageNumber @Translate("of") @settings.NumberOfPages
2174 </div>
2175 }
2176 <ul class="pager__list dw-mod">
2177 @if (!string.IsNullOrWhiteSpace(settings.FirstPageUrl) && settings.ShowFirstAndLastControls)
2178 {
2179 @Render(new PaginationItem { Link = settings.FirstPageUrl, Icon = settings.FirstIcon })
2180 }
2181 @if (!string.IsNullOrWhiteSpace(settings.PreviousPageUrl) && settings.ShowNextAndPrevControls)
2182 {
2183 @Render(new PaginationItem { Link = settings.PreviousPageUrl, Icon = settings.PrevIcon })
2184 }
2185 @if (settings.GetPages().Any())
2186 {
2187 foreach (var page in settings.GetPages())
2188 {
2189 @Render(page)
2190 }
2191 }
2192 else
2193 {
2194 for (var page = startAndEndPageNumber["StartPage"]; page <= startAndEndPageNumber["EndPage"]; page++)
2195 {
2196 queryParameters = Dynamicweb.Rapido.Services.Url.UpdateQueryStringParameter(queryParameters, pageNumberQueryStringName, page.ToString());
2197 @Render(new PaginationItem { Label = page.ToString(), Link = Dynamicweb.Rapido.Services.Url.BuildUri(url, queryParameters).PathAndQuery, IsActive = (settings.CurrentPageNumber == page) });
2198 }
2199 }
2200 @if (!string.IsNullOrWhiteSpace(settings.NextPageUrl) && settings.ShowNextAndPrevControls)
2201 {
2202 @Render(new PaginationItem { Link = settings.NextPageUrl, Icon = settings.NextIcon })
2203 }
2204 @if (!string.IsNullOrWhiteSpace(settings.LastPageUrl) && settings.ShowFirstAndLastControls)
2205 {
2206 @Render(new PaginationItem { Link = settings.LastPageUrl, Icon = settings.LastIcon })
2207 }
2208 </ul>
2209 </div>
2210 }
2211 }
22122213 @helper RenderPaginationItem(PaginationItem settings)
2214 {
2215 if (settings.Icon == null)
2216 {
2217 settings.Icon = new Icon();
2218 }
22192220 settings.Icon.Label = settings.Label;
2221 <li class="pager__btn dw-mod">
2222 @if (settings.IsActive)
2223 {
2224 <span class="pager__num pager__num--current dw-mod">
2225 @Render(settings.Icon)
2226 </span>
2227 }
2228 else
2229 {
2230 <a href="@settings.Link" class="pager__num dw-mod">
2231 @Render(settings.Icon)
2232 </a>
2233 }
2234 </li>
2235 }
223622372238 @using Dynamicweb.Rapido.Blocks.Components.General
2239 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
224022412242 @using Dynamicweb.Frontend
2243 @using System.Reflection
2244 @using Dynamicweb.Content.Items
2245 @using System.Web.UI.HtmlControls
2246 @using Dynamicweb.Rapido.Blocks.Components
2247 @using Dynamicweb.Rapido.Blocks
2248 @using Dynamicweb.Rapido.Blocks.Components.Articles
22492250 @* Components for the articles *@
2251 @using System.Reflection
2252 @using Dynamicweb.Rapido.Blocks.Components.Articles
225322542255 @* Component for the articles *@
22562257 @helper RenderArticleBanner(dynamic settings) {
2258 string filterClasses = "image-filter image-filter--darken";
2259 settings.Layout = ArticleHeaderLayout.Banner;
22602261 if (settings.Image != null)
2262 {
2263 if (settings.Image.Path != null)
2264 {
2265 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width">
2266 <div class="background-image @filterClasses dw-mod">
2267 <div class="background-image__wrapper @filterClasses dw-mod">
2268 @{
2269 settings.Image.CssClass += "background-image__cover dw-mod";
2270 }
2271 @Render(settings.Image)
2272 </div>
2273 </div>
2274 <div class="center-container dw-mod">
2275 <div class="grid">
2276 <div class="grid__col-md-8 grid__col-xs-12 paragraph-container paragraph-container--height-lg">
2277 <div class="u-left-middle">
2278 <div>
2279 @if (!String.IsNullOrEmpty(settings.Heading))
2280 {
2281 <h1 class="article__header article__header--giant dw-mod" style="color: @settings.TextColor">@settings.Heading</h1>
2282 }
2283 @if (!String.IsNullOrEmpty(settings.Subheading))
2284 {
2285 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div>
2286 }
2287 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2288 {
2289 <small class="article__post-info u-margin-bottom--lg dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small>
2290 }
2291 @if (!String.IsNullOrEmpty(settings.Link)) {
2292 <div class="grid__cell">
2293 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2294 </div>
2295 }
2296 </div>
2297 </div>
2298 </div>
2299 @if (settings.ExternalParagraphId != 0)
2300 {
2301 <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod">
2302 <div class="u-color-light-gray--bg u-color-dark dw-mod">
2303 @RenderParagraphContent(settings.ExternalParagraphId)
2304 </div>
2305 </div>
2306 }
23072308 </div>
2309 </div>
2310 </section>
2311 if (!String.IsNullOrEmpty(settings.Image.Caption)) {
2312 <div class="image-caption dw-mod">@settings.Image.Caption</div>
2313 }
2314 }
2315 else
2316 {
2317 settings.Layout = ArticleHeaderLayout.Clean;
2318 @RenderArticleCleanHeader(settings);
2319 }
2320 }
2321 else
2322 {
2323 settings.Layout = ArticleHeaderLayout.Clean;
2324 @RenderArticleCleanHeader(settings);
2325 }
2326 }
2327 @using System.Reflection
2328 @using Dynamicweb.Rapido.Blocks.Components
2329 @using Dynamicweb.Rapido.Blocks.Components.General
2330 @using Dynamicweb.Rapido.Blocks.Components.Articles
2331 @using Dynamicweb.Rapido.Blocks
233223332334 @* Component for the articles *@
23352336 @helper RenderArticleHeader(ArticleHeader settings) {
2337 dynamic[] methodParameters = new dynamic[1];
2338 methodParameters[0] = settings;
2339 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleHeaderCustom");
23402341 if (customMethod != null)
2342 {
2343 @customMethod.Invoke(this, methodParameters).ToString();
2344 } else {
2345 switch (settings.Layout)
2346 {
2347 case ArticleHeaderLayout.Clean:
2348 @RenderArticleCleanHeader(settings);
2349 break;
2350 case ArticleHeaderLayout.Split:
2351 @RenderArticleSplitHeader(settings);
2352 break;
2353 case ArticleHeaderLayout.Banner:
2354 @RenderArticleBannerHeader(settings);
2355 break;
2356 case ArticleHeaderLayout.Overlay:
2357 @RenderArticleOverlayHeader(settings);
2358 break;
2359 default:
2360 @RenderArticleCleanHeader(settings);
2361 break;
2362 }
2363 }
2364 }
23652366 @helper RenderArticleCleanHeader(ArticleHeader settings) {
2367 dynamic[] methodParameters = new dynamic[1];
2368 methodParameters[0] = settings;
2369 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom");
23702371 if (customMethod != null)
2372 {
2373 @customMethod.Invoke(this, methodParameters).ToString();
2374 }
2375 else
2376 {
2377 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12";
23782379 <div class="grid grid--align-content-start grid--justify-start">
2380 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod">
2381 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0)
2382 {
2383 <div class="u-border-bottom u-padding-bottom">
2384 @if (!String.IsNullOrEmpty(settings.Category))
2385 {
2386 <div class="u-pull--left">
2387 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div>
2388 </div>
2389 }
2390 <div class="u-pull--right">
2391 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2392 {
2393 <small class="article__post-info dw-mod">@settings.Author @settings.Date</small>
2394 }
2395 @if (settings.RatingOutOf != 0)
2396 {
2397 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })
2398 }
2399 </div>
2400 </div>
2401 }
24022403 <div class="grid__cell">
2404 @if (!String.IsNullOrEmpty(settings.Heading))
2405 {
2406 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1>
2407 }
2408 @if (settings.Image != null)
2409 {
2410 if (settings.Image.Path != null)
2411 {
2412 <div class="u-padding-bottom--lg">
2413 @Render(settings.Image)
2414 </div>
2415 }
2416 }
2417 @if (!String.IsNullOrEmpty(settings.Subheading))
2418 {
2419 <div class="article__leadtext dw-mod">@settings.Subheading</div>
2420 }
2421 @if (!String.IsNullOrEmpty(settings.Link))
2422 {
2423 <div class="grid__cell">
2424 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2425 </div>
2426 }
2427 </div>
2428 </div>
2429 @if (settings.ExternalParagraphId != 0)
2430 {
2431 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod">
2432 @RenderParagraphContent(settings.ExternalParagraphId)
2433 </div>
2434 }
2435 </div>
2436 }
2437 }
24382439 @helper RenderArticleSplitHeader(ArticleHeader settings) {
2440 dynamic[] methodParameters = new dynamic[1];
2441 methodParameters[0] = settings;
2442 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSplitHeaderCustom");
24432444 if (customMethod != null)
2445 {
2446 @customMethod.Invoke(this, methodParameters).ToString();
2447 }
2448 else
2449 {
2450 string headerColumnWidth = settings.ExternalParagraphId != 0 ? "4" : "6";
24512452 if (settings.Image != null)
2453 {
2454 if (settings.Image.Path != null)
2455 {
2456 <section class="multiple-paragraphs-container paragraph-container--full-width">
2457 <div class="grid">
2458 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod">
2459 <div class="u-left-middle u-padding--lg">
2460 <div>
2461 @if (!String.IsNullOrEmpty(settings.Category))
2462 {
2463 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div>
2464 }
2465 @if (!String.IsNullOrEmpty(settings.Heading))
2466 {
2467 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1>
2468 }
2469 @if (!String.IsNullOrEmpty(settings.Subheading))
2470 {
2471 <div class="article__leadtext dw-mod">@settings.Subheading</div>
2472 }
2473 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2474 {
2475 <small class="article__post-info u-pull--left dw-mod">@settings.Author @settings.Date</small>
2476 }
2477 @if (settings.RatingOutOf != 0)
2478 {
2479 <div class="u-pull--right">
2480 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })
2481 </div>
2482 }
2483 @if (!String.IsNullOrEmpty(settings.Link)) {
2484 <div class="u-full-width u-pull--left u-margin-top">
2485 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2486 </div>
2487 }
2488 </div>
2489 </div>
2490 </div>
2491 <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>
2492 @if (settings.ExternalParagraphId != 0)
2493 {
2494 <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">
2495 @RenderParagraphContent(settings.ExternalParagraphId)
2496 </div>
2497 }
2498 </div>
2499 </section>
2500 }
2501 }
2502 else
2503 {
2504 @RenderArticleCleanHeader(settings);
2505 }
2506 }
2507 }
25082509 @helper RenderArticleOverlayHeader(ArticleHeader settings) {
2510 dynamic[] methodParameters = new dynamic[1];
2511 methodParameters[0] = settings;
2512 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleOverlayHeaderCustom");
25132514 if (customMethod != null)
2515 {
2516 @customMethod.Invoke(this, methodParameters).ToString();
2517 }
2518 else
2519 {
2520 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12";
2521 string contentAlignment = settings.TextLayout == ArticleHeaderTextLayout.Center ? "grid--justify-center" : "";
25222523 if (settings.Image != null)
2524 {
2525 if (settings.Image.Path != null)
2526 {
2527 if (settings.ExternalParagraphId == 0)
2528 {
2529 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width">
2530 <div class="background-image image-filter image-filter--darken dw-mod">
2531 <div class="background-image__wrapper image-filter image-filter--darken dw-mod">
2532 @{
2533 settings.Image.CssClass += "background-image__cover dw-mod";
2534 }
2535 @Render(settings.Image)
2536 </div>
2537 </div>
2538 <div class="center-container dw-mod">
2539 <div class="grid @contentAlignment">
2540 <div class="grid__col-md-@contentColumns grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod">
2541 @if (!string.IsNullOrEmpty(settings.Heading))
2542 {
2543 <h1 class="article__header article__header--giant u-padding-top--lg dw-mod" style="color: @settings.TextColor">@settings.Heading</h1>
2544 }
2545 @if (!String.IsNullOrEmpty(settings.Subheading))
2546 {
2547 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div>
2548 }
2549 <div class="u-margin-top">
2550 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2551 {
2552 <small class="article__post-info u-pull--left dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small>
2553 }
2554 @if (settings.RatingOutOf != 0)
2555 {
2556 <div class="u-pull--right">
2557 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })
2558 </div>
2559 }
2560 </div>
2561 @if (!String.IsNullOrEmpty(settings.Link))
2562 {
2563 <div class="grid__cell">
2564 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2565 </div>
2566 }
2567 </div>
2568 </div>
2569 </div>
2570 </section>
2571 }
2572 else
2573 {
2574 @RenderArticleBanner(settings);
2575 }
2576 }
2577 }
2578 else
2579 {
2580 @RenderArticleCleanHeader(settings);
2581 }
2582 }
2583 }
25842585 @helper RenderArticleBannerHeader(dynamic settings) {
2586 dynamic[] methodParameters = new dynamic[1];
2587 methodParameters[0] = settings;
2588 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerHeaderCustom");
25892590 if (customMethod != null)
2591 {
2592 @customMethod.Invoke(this, methodParameters).ToString();
2593 }
2594 else
2595 {
2596 @RenderArticleBanner(settings);
2597 }
2598 }
2599 @using System.Reflection
2600 @using System.Text.RegularExpressions;
2601 @using Dynamicweb.Frontend
2602 @using Dynamicweb.Content.Items
2603 @using Dynamicweb.Rapido.Blocks.Components
2604 @using Dynamicweb.Rapido.Blocks.Components.Articles
2605 @using Dynamicweb.Rapido.Blocks
26062607 @* Component for the articles *@
26082609 @helper RenderArticleBodyRow(ArticleBodyRow settings)
2610 {
2611 string position = settings.TopLayout == "overlay" ? "article__overlay-offset" : "";
2612 string contentAlignment = settings.TextLayout == "center" ? "grid--justify-center" : "";
26132614 <div class="grid grid--align-content-start @contentAlignment @position dw-mod">
2615 @RenderBlockList(settings.SubBlocks)
2616 </div>
2617 }
2618 @using System.Reflection
2619 @using Dynamicweb.Rapido.Blocks.Components
2620 @using Dynamicweb.Rapido.Blocks.Components.General
2621 @using Dynamicweb.Rapido.Blocks.Components.Articles
2622 @using Dynamicweb.Rapido.Blocks
26232624 @* Component for the articles *@
26252626 @helper RenderArticleImage(ArticleImage settings)
2627 {
2628 if (settings.Image != null)
2629 {
2630 if (settings.Image.Path != null)
2631 {
2632 <div class="u-margin-bottom--lg">
2633 @Render(settings.Image)
2634 </div>
2635 }
2636 }
2637 }
2638 @using System.Reflection
2639 @using Dynamicweb.Rapido.Blocks.Components
2640 @using Dynamicweb.Rapido.Blocks.Components.Articles
264126422643 @* Component for the articles *@
26442645 @helper RenderArticleSubHeader(ArticleSubHeader settings)
2646 {
2647 if (!String.IsNullOrEmpty(settings.Title))
2648 {
2649 <h2 class="article__header">@settings.Title</h2>
2650 }
2651 }
2652 @using System.Reflection
2653 @using Dynamicweb.Rapido.Blocks.Components
2654 @using Dynamicweb.Rapido.Blocks.Components.Articles
2655 @using Dynamicweb.Rapido.Blocks
265626572658 @* Component for the articles *@
26592660 @helper RenderArticleText(ArticleText settings)
2661 {
2662 if (!String.IsNullOrEmpty(settings.Text))
2663 {
2664 string greatTextClass = settings.EnableLargeText == true ? "article__paragraph--great-text" : "";
26652666 <div class="article__paragraph @greatTextClass dw-mod">
2667 @settings.Text
2668 </div>
2669 }
2670 }
2671 @using System.Reflection
2672 @using Dynamicweb.Rapido.Blocks.Components
2673 @using Dynamicweb.Rapido.Blocks.Components.Articles
2674 @using Dynamicweb.Rapido.Blocks
267526762677 @* Component for the articles *@
26782679 @helper RenderArticleQuote(ArticleQuote settings)
2680 {
2681 string text = Regex.Replace(settings.Text, "<.*?>", String.Empty);
26822683 <div class="grid u-padding-bottom--lg">
2684 @if (settings.Image != null)
2685 {
2686 if (settings.Image.Path != null) {
2687 <div class="grid__col-3">
2688 <div class="grid__cell-img">
2689 @{
2690 settings.Image.Title = !String.IsNullOrEmpty(settings.Image.Title) ? settings.Image.Title : settings.Author;
2691 settings.Image.CssClass += " article__image article__image--ball";
2692 settings.Image.ImageDefault.Width = 200;
2693 settings.Image.ImageDefault.Height = 200;
2694 }
2695 @Render(settings.Image)
2696 </div>
2697 </div>
2698 }
2699 }
2700 <div class="grid__col-auto">
2701 @if (!String.IsNullOrEmpty(settings.Text))
2702 {
2703 <div class="article__quote dw-mod">
2704 <i class="fas fa-quote-right u-margin-bottom--lg"></i>
2705 @settings.Text
2706 <i class="fas fa-quote-right"></i>
2707 </div>
2708 }
2709 @if (!String.IsNullOrEmpty(settings.Author))
2710 {
2711 <div class="article__quote-author dw-mod">
2712 - @settings.Author
2713 </div>
2714 }
2715 </div>
2716 </div>
2717 }
2718 @using System.Reflection
2719 @using Dynamicweb.Rapido.Blocks.Components
2720 @using Dynamicweb.Rapido.Blocks.Components.Articles
2721 @using Dynamicweb.Rapido.Blocks
27222723 @* Component for the articles *@
27242725 @helper RenderArticleInfoTable(ArticleInfoTable settings)
2726 {
2727 <table class="table table--clean">
2728 @foreach (var row in settings.Rows)
2729 {
2730 string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two";
27312732 <tr>
2733 @if (!String.IsNullOrEmpty(row.Icon))
2734 {
2735 <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td>
2736 }
2737 <td class="u-no-margin-on-p-elements">
2738 <div class="u-bold">@row.Title</div>
2739 @if (!String.IsNullOrEmpty(row.SubTitle))
2740 {
2741 if (row.Link == null)
2742 {
2743 <div>@row.SubTitle</div>
2744 }
2745 else
2746 {
2747 <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a>
2748 }
2749 }
2750 </td>
2751 </tr>
2752 }
2753 </table>
2754 }
2755 @using System.Reflection
2756 @using Dynamicweb.Rapido.Blocks.Components
2757 @using Dynamicweb.Rapido.Blocks.Components.General
2758 @using Dynamicweb.Rapido.Blocks.Components.Articles
2759 @using Dynamicweb.Rapido.Blocks
27602761 @* Component for the articles *@
27622763 @helper RenderArticleGalleryModal(ArticleGalleryModal settings)
2764 {
2765 Modal galleryModal = new Modal
2766 {
2767 Id = "ParagraphGallery",
2768 Width = ModalWidth.Full,
2769 BodyTemplate = RenderArticleGalleryModalContent()
2770 };
27712772 @Render(galleryModal)
2773 }
27742775 @helper RenderArticleGalleryModalContent() {
2776 <div class="modal__image-min-size-wrapper">
2777 @Render(new Image {
2778 Id = "ParagraphGallery",
2779 Path = "#",
2780 CssClass = "modal--full__img",
2781 DisableLazyLoad = true,
2782 DisableImageEngine = true
2783 })
2784 </div>
27852786 <div class="modal__images-counter" id="ParagraphGallery_counter"></div>
27872788 @Render(new Button {
2789 Id = "ParagraphGallery_prev",
2790 ButtonType = ButtonType.Button,
2791 ButtonLayout = ButtonLayout.None,
2792 CssClass = "modal__prev-btn",
2793 Icon = new Icon { Prefix = "far", Name = "fa-angle-left", LabelPosition = IconLabelPosition.After },
2794 OnClick = "Gallery.prevImage('ParagraphGallery')"
2795 })
27962797 @Render(new Button {
2798 Id = "ParagraphGallery_next",
2799 ButtonType = ButtonType.Button,
2800 ButtonLayout = ButtonLayout.None,
2801 CssClass = "modal__next-btn",
2802 Icon = new Icon { Prefix = "far", Name = "fa-angle-right", LabelPosition = IconLabelPosition.After },
2803 OnClick = "Gallery.nextImage('ParagraphGallery')"
2804 })
2805 }
2806 @using System.Reflection
2807 @using Dynamicweb.Rapido.Blocks.Components
2808 @using Dynamicweb.Rapido.Blocks.Components.Articles
2809 @using Dynamicweb.Rapido.Blocks
281028112812 @* Component for the articles *@
28132814 @helper RenderArticleRelated(ArticleRelated settings)
2815 {
2816 string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : "";
2817 string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : "";
28182819 <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width">
2820 <div class="center-container dw-mod">
2821 <div class="grid u-padding">
2822 <div class="grid__col-md-12 grid__col-xs-12">
2823 <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2>
2824 </div>
2825 </div>
28262827 <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>
28282829 <script id="RelatedSimpleTemplate" type="text/x-template">
2830 {{#.}}
2831 <div class="grid u-padding-bottom--lg">
2832 {{#Cases}}
2833 <div class="grid__col-lg-3 grid__col-sm-6 image-hover--zoom dw-mod">
2834 <a href="{{link}}" class="u-full-height u-color-light--bg u-flex u-flex--column">
2835 {{#if image}}
2836 <div class="u-color-light--bg u-no-padding dw-mod">
2837 <div class="flex-img image-hover__wrapper">
2838 <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}}" />
2839 </div>
2840 </div>
2841 {{/if}}
28422843 <div class="card u-color-light--bg u-full-height dw-mod">
2844 <h3 class="article-list__item-header u-truncate-text dw-mod">{{title}}</h3>
2845 <p class="article__short-summary dw-mod">{{summary}}</p>
2846 </div>
2847 </a>
2848 </div>
2849 {{/Cases}}
2850 </div>
2851 {{/.}}
2852 </script>
2853 </div>
2854 </section>
2855 }
2856 @using System.Reflection
2857 @using Dynamicweb.Rapido.Blocks.Components
2858 @using Dynamicweb.Rapido.Blocks.Components.Articles
2859 @using Dynamicweb.Rapido.Blocks
286028612862 @* Component for the articles *@
28632864 @helper RenderArticleMenu(ArticleMenu settings)
2865 {
2866 if (!String.IsNullOrEmpty(settings.Title)) {
2867 <div class="u-margin u-border-bottom">
2868 <h3 class="u-no-margin">@settings.Title</h3>
2869 </div>
2870 }
28712872 <ul class="menu-left u-margin-bottom dw-mod">
2873 @foreach (var item in settings.Items)
2874 {
2875 @Render(item)
2876 }
2877 </ul>
2878 }
28792880 @helper RenderArticleMenuItem(ArticleMenuItem settings)
2881 {
2882 string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#";
28832884 if (!String.IsNullOrEmpty(settings.Title)) {
2885 <li class="menu-left__item dw-mod">
2886 <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a>
2887 </li>
2888 }
2889 }
2890 @using System.Reflection
2891 @using Dynamicweb.Rapido.Blocks.Components
2892 @using Dynamicweb.Rapido.Blocks.Components.Articles
2893 @using Dynamicweb.Rapido.Blocks
28942895 @* Component for the articles *@
28962897 @helper RenderArticleList(ArticleList settings)
2898 {
2899 if (Pageview != null)
2900 {
2901 bool isParagraph = Pageview.CurrentParagraph != null ? true : false;
2902 string[] sortArticlesListBy = new string[2];
29032904 if (isParagraph) {
2905 sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" };
2906 }
2907 else {
2908 sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" };
2909 }
29102911 string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString();
29122913 if (!settings.DisablePagination) {
2914 @RenderItemList(new
2915 {
2916 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle",
2917 ListSourceType = settings.SourceType,
2918 ListSourcePage = sourcePage,
2919 ItemFieldsList = "*",
2920 Filter = settings.Filter,
2921 ListOrderBy = sortArticlesListBy[0],
2922 ListOrderByDirection = sortArticlesListBy[1],
2923 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date",
2924 ListSecondOrderByDirection = "ASC",
2925 IncludeAllChildItems = true,
2926 ListTemplate = settings.Template,
2927 ListPageSize = settings.PageSize.ToString()
2928 });
2929 } else {
2930 @RenderItemList(new
2931 {
2932 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle",
2933 ListSourceType = settings.SourceType,
2934 ListSourcePage = sourcePage,
2935 ItemFieldsList = "*",
2936 Filter = settings.Filter,
2937 ListOrderBy = sortArticlesListBy[0],
2938 ListOrderByDirection = sortArticlesListBy[1],
2939 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date",
2940 ListSecondOrderByDirection = "ASC",
2941 IncludeAllChildItems = true,
2942 ListTemplate = settings.Template,
2943 ListPageSize = settings.PageSize.ToString(),
2944 ListViewMode = "Partial",
2945 ListShowTo = settings.PageSize + 1
2946 });
2947 }
2948 }
2949 }
2950 @using System.Reflection
2951 @using Dynamicweb.Rapido.Blocks.Components.Articles
295229532954 @* Component for the articles *@
29552956 @helper RenderArticleSummary(ArticleSummary settings)
2957 {
2958 if (!String.IsNullOrEmpty(settings.Text))
2959 {
2960 <div class="article__summary dw-mod">@settings.Text</div>
2961 }
2962 }
2963 @using System.Reflection
2964 @using Dynamicweb.Rapido.Blocks.Components
2965 @using Dynamicweb.Rapido.Blocks.Components.Articles
2966 @using Dynamicweb.Rapido.Blocks
29672968 @* Component for the articles *@
29692970 @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings)
2971 {
2972 string pageId = Pageview.ID.ToString();
2973 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All");
2974 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString());
29752976 foreach (var option in settings.Categories)
2977 {
2978 selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter;
2979 }
29802981 if (selectedFilter == pageId)
2982 {
2983 selectedFilter = Translate("All");
2984 }
29852986 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
2987 {
2988 <div class="u-pull--right u-margin-left">
2989 <div class="collection u-no-margin">
2990 <h5>@Translate("Category")</h5>
2991 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" />
2992 <div class="dropdown u-w180px dw-mod">
2993 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label>
2994 <div class="dropdown__content dw-mod">
2995 @foreach (var option in settings.Categories)
2996 {
2997 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div>
2998 }
2999 </div>
3000 <label class="dropdown-trigger-off" for="CategorySelector"></label>
3001 </div>
3002 </div>
3003 </div>
3004 }
3005 else
3006 {
3007 <div class="u-full-width u-margin-bottom">
3008 <h5 class="u-no-margin">@Translate("Category")</h5>
3009 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" />
3010 <div class="dropdown u-full-width dw-mod">
3011 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label>
3012 <div class="dropdown__content dw-mod">
3013 @foreach (var option in settings.Categories)
3014 {
3015 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div>
3016 }
3017 </div>
3018 <label class="dropdown-trigger-off" for="CategorySelector"></label>
3019 </div>
3020 </div>
3021 }
3022 }
3023 @using System.Reflection
3024 @using Dynamicweb.Rapido.Blocks.Components
3025 @using Dynamicweb.Rapido.Blocks.Components.Articles
3026 @using Dynamicweb.Rapido.Blocks
3027 @using System.Collections.Generic
30283029 @* Component for the articles *@
30303031 @helper RenderArticleListFilter(ArticleListFilter settings)
3032 {
3033 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All");
3034 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString());
30353036 if (settings.Options != null)
3037 {
3038 if (settings.Options is IEnumerable<dynamic>)
3039 {
3040 var options = (IEnumerable<dynamic>) settings.Options;
3041 settings.Options = options.OrderBy(item => item.Name);
3042 }
30433044 foreach (var option in settings.Options)
3045 {
3046 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter;
3047 }
30483049 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
3050 {
3051 <div class="u-pull--right u-margin-left">
3052 <div class="collection u-no-margin">
3053 <h5>@settings.Label</h5>
3054 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" />
3055 <div class="dropdown u-w180px dw-mod">
3056 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label>
3057 <div class="dropdown__content dw-mod">
3058 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div>
3059 @foreach (var option in settings.Options)
3060 {
3061 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div>
3062 }
3063 </div>
3064 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label>
3065 </div>
3066 </div>
3067 </div>
3068 }
3069 else
3070 {
3071 <div class="u-full-width u-margin-bottom">
3072 <h5 class="u-no-margin">@settings.Label</h5>
3073 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" />
3074 <div class="dropdown u-full-width w-mod">
3075 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label>
3076 <div class="dropdown__content dw-mod">
3077 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div>
3078 @foreach (var option in settings.Options)
3079 {
3080 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div>
3081 }
3082 </div>
3083 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label>
3084 </div>
3085 </div>
3086 }
3087 }
3088 }
3089 @using System.Reflection
3090 @using Dynamicweb.Rapido.Blocks.Components
3091 @using Dynamicweb.Rapido.Blocks.Components.Articles
3092 @using Dynamicweb.Rapido.Blocks
30933094 @* Component for the articles *@
30953096 @helper RenderArticleListSearch(ArticleListSearch settings)
3097 {
3098 string searchParameter = !string.IsNullOrEmpty(settings.SearchParameter) ? settings.SearchParameter : "Title";
3099 string searchWord = HttpContext.Current.Request.QueryString.Get(searchParameter);
3100 string searchString = !string.IsNullOrEmpty(searchWord) ? searchWord.Trim('*') : "";
3101 string className = "u-w340px u-pull--right u-margin-left";
31023103 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet")
3104 {
3105 className = "u-full-width";
3106 }
31073108 <div class="typeahead u-color-inherit u-margin-bottom dw-mod @className">
3109 <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 + '*')">
3110 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button>
3111 </div>
3112 }
3113 @using System.Reflection
3114 @using Dynamicweb.Rapido.Blocks.Components
3115 @using Dynamicweb.Rapido.Blocks.Components.Articles
3116 @using Dynamicweb.Rapido.Blocks
31173118 @* Component for the articles *@
31193120 @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings)
3121 {
3122 <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div>
3123 }
3124 @using System.Reflection
3125 @using Dynamicweb.Rapido.Blocks.Components
3126 @using Dynamicweb.Rapido.Blocks.Components.General
3127 @using Dynamicweb.Rapido.Blocks.Components.Articles
3128 @using Dynamicweb.Rapido.Blocks
3129 @using System.Text.RegularExpressions
31303131 @* Component for the articles *@
31323133 @helper RenderArticleListItem(ArticleListItem settings)
3134 {
3135 switch (settings.Type) {
3136 case ArticleListItemType.Card:
3137 @RenderArticleListItemCard(settings);
3138 break;
3139 case ArticleListItemType.List:
3140 @RenderArticleListItemList(settings);
3141 break;
3142 case ArticleListItemType.Simple:
3143 @RenderArticleListItemSimple(settings);
3144 break;
3145 default:
3146 @RenderArticleListItemCard(settings);
3147 break;
3148 }
3149 }
31503151 @helper RenderArticleListItemCard(ArticleListItem settings) {
3152 <a href="@settings.Link" class="u-full-height u-color-light--bg u-flex u-flex--column">
3153 <div class="u-color-light--bg u-no-padding dw-mod">
3154 @if (settings.Logo != null)
3155 {
3156 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;" : "";
3157 settings.Logo.ImageDefault.Crop = 5;
3158 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width;
3159 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height;
3160 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage">
3161 @if (settings.Stickers != null)
3162 {
3163 if (settings.Stickers.Position != StickersListPosition.Custom && settings.Stickers.Position != StickersListPosition.None)
3164 {
3165 @Render(settings.Stickers);
3166 }
3167 }
3168 @RenderImage(settings.Logo)
3169 </div>
3170 } else if (settings.Image != null)
3171 {
3172 <div class="flex-img image-hover__wrapper u-position-relative dw-mod">
3173 @if (settings.Stickers != null)
3174 {
3175 if (settings.Stickers.Position != StickersListPosition.Custom && settings.Stickers.Position != StickersListPosition.None)
3176 {
3177 @Render(settings.Stickers);
3178 }
3179 }
3180 @Render(settings.Image)
3181 </div>
3182 }
3183 </div>
31843185 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary))
3186 {
3187 <div class="card u-color-light--bg u-full-height dw-mod">
3188 @if (settings.Stickers != null)
3189 {
3190 if (settings.Stickers.Position == StickersListPosition.Custom)
3191 {
3192 @Render(settings.Stickers);
3193 }
3194 }
3195 @if (!String.IsNullOrEmpty(settings.Title))
3196 {
3197 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3>
3198 }
3199 @if (!String.IsNullOrEmpty(settings.SubTitle))
3200 {
3201 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>
3202 }
3203 @if (!String.IsNullOrEmpty(settings.Summary))
3204 {
3205 <p class="article__short-summary dw-mod">@settings.Summary</p>
3206 }
3207 </div>
3208 }
3209 </a>
3210 }
32113212 @helper RenderArticleListItemList(ArticleListItem settings) {
3213 <a href="@settings.Link">
3214 <div class="grid u-color-light--bg u-no-padding dw-mod">
3215 <div class="grid__col-md-3">
3216 <div class="u-color-light--bg u-no-padding dw-mod">
3217 @if (settings.Logo != null)
3218 {
3219 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;" : "";
3220 settings.Logo.ImageDefault.Crop = 5;
3221 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width;
3222 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height;
3223 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage">
3224 @if (settings.Stickers != null)
3225 {
3226 if (settings.Stickers.Position != StickersListPosition.Custom)
3227 {
3228 @Render(settings.Stickers);
3229 }
3230 }
3231 @RenderImage(settings.Logo)
3232 </div>
3233 } else if (settings.Image != null)
3234 {
3235 <div class="flex-img image-hover__wrapper dw-mod">
3236 @if (settings.Stickers != null)
3237 {
3238 if (settings.Stickers.Position != StickersListPosition.Custom)
3239 {
3240 @Render(settings.Stickers);
3241 }
3242 }
3243 @Render(settings.Image)
3244 </div>
3245 }
3246 </div>
3247 </div>
32483249 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary))
3250 {
3251 <div class="grid__col-md-9">
3252 @if (!String.IsNullOrEmpty(settings.Title))
3253 {
3254 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3>
3255 }
3256 @if (settings.Stickers != null)
3257 {
3258 if (settings.Stickers.Position == StickersListPosition.Custom)
3259 {
3260 @Render(settings.Stickers);
3261 }
3262 }
3263 @if (!String.IsNullOrEmpty(settings.SubTitle))
3264 {
3265 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>
3266 }
3267 @if (!String.IsNullOrEmpty(settings.Summary))
3268 {
3269 <p class="article__short-summary dw-mod">@settings.Summary</p>
3270 }
3271 </div>
3272 }
3273 </div>
3274 </a>
3275 }
32763277 @helper RenderArticleListItemSimple(ArticleListItem settings) {
3278 <a href="@settings.Link" class="u-color-inherit">
3279 <div class="grid u-color-light--bg u-no-padding dw-mod">
3280 <div class="grid__col-md-12">
3281 @if (!String.IsNullOrEmpty(settings.Title))
3282 {
3283 <div class="article-list-item__header u-truncate-text u-no-margin dw-mod">@settings.Title</div>
3284 }
3285 @if (!String.IsNullOrEmpty(settings.SubTitle))
3286 {
3287 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>
3288 }
3289 </div>
3290 </div>
3291 </a>
3292 }
3293 @using System.Reflection
3294 @using Dynamicweb.Rapido.Blocks.Components.Articles
329532963297 @* Component for the articles *@
32983299 @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings)
3300 {
3301 <small class="article__subscription">
3302 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date)))
3303 {
3304 <text>@Translate("Written")</text>
3305 }
3306 @if (!string.IsNullOrWhiteSpace(settings.Author))
3307 {
3308 <text>@Translate("by") @settings.Author</text>
3309 }
3310 @if (!string.IsNullOrWhiteSpace(settings.Date))
3311 {
3312 <text>@Translate("on") @settings.Date</text>
3313 }
3314 </small>
3315 }
3316 @using System.Reflection
3317 @using Dynamicweb.Rapido.Blocks.Components.Articles
3318 @using Dynamicweb.Rapido.Blocks.Components.General
331933203321 @* Component for the articles *@
33223323 @helper RenderArticleLink(ArticleLink settings)
3324 {
3325 if (!string.IsNullOrEmpty(settings.Title))
3326 {
3327 Button link = new Button {
3328 ConfirmText = settings.ConfirmText,
3329 ConfirmTitle = settings.ConfirmTitle,
3330 ButtonType = settings.ButtonType,
3331 Id = settings.Id,
3332 Title = settings.Title,
3333 AltText = settings.AltText,
3334 OnClick = settings.OnClick,
3335 CssClass = settings.CssClass,
3336 Disabled = settings.Disabled,
3337 Icon = settings.Icon,
3338 Name = settings.Name,
3339 Href = settings.Href,
3340 ButtonLayout = settings.ButtonLayout,
3341 ExtraAttributes = settings.ExtraAttributes
3342 };
3343 <div class="grid__cell">
3344 @Render(link)
3345 </div>
3346 }
3347 }
3348 @using System.Reflection
3349 @using Dynamicweb.Rapido.Blocks
3350 @using Dynamicweb.Rapido.Blocks.Components.Articles
3351 @using Dynamicweb.Rapido.Blocks.Components.General
335233533354 @* Component for the articles *@
33553356 @helper RenderArticleCarousel(ArticleCarousel settings)
3357 {
3358 <div class="grid">
3359 <div class="grid__col-12 u-no-padding u-margin-bottom">
3360 <div class="carousel" id="carousel_@settings.Id">
3361 <div class="carousel__container js-carousel-slides dw-mod">
3362 @RenderBlockList(settings.SubBlocks)
3363 </div>
3364 </div>
3365 </div>
3366 </div>
33673368 <script>
3369 document.addEventListener("DOMContentLoaded", function () {
3370 new CarouselModule("#carousel_@settings.Id", {
3371 slideTime: 0,
3372 dots: true
3373 });
3374 });
3375 </script>
3376 }
33773378 @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings)
3379 {
3380 string imageEngine = "/Admin/Public/GetImage.ashx?";
33813382 string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image;
3383 if (settings.ImageSettings != null)
3384 {
3385 defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : "";
3386 defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : "";
3387 defaultImage += "Crop=" + settings.ImageSettings.Crop + "&";
3388 defaultImage += "Compression=" + settings.ImageSettings.Compression + "&";
3389 defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&";
3390 defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&";
3391 }
3392 defaultImage += "&Image=" + settings.Image;
33933394 <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')">
3395 <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title">
3396 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2>
3397 <div class="article-list__item-info">
3398 @if (settings.Stickers != null)
3399 {
3400 settings.Stickers.Position = StickersListPosition.Custom;
3401 @Render(settings.Stickers);
3402 }
34033404 <small class="u-margin-top--lg u-color-light">
3405 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date)))
3406 {
3407 <text>@Translate("Written")</text>
3408 }
3409 @if (!string.IsNullOrWhiteSpace(settings.Author))
3410 {
3411 <text>@Translate("by") @settings.Author</text>
3412 }
3413 @if (!string.IsNullOrWhiteSpace(settings.Date))
3414 {
3415 <text>@Translate("on") @settings.Date</text>
3416 }
3417 </small>
3418 </div>
34193420 <h3 class="article__short-summary u-color-light">@settings.Summary</h3>
3421 </a>
3422 @if (settings.UseFilters == true)
3423 {
3424 <div class="background-image image-filter image-filter--darken dw-mod"></div>
3425 }
3426 </div>
3427 }
3428 @using System.Text.RegularExpressions
3429 @using Dynamicweb.Rapido.Blocks.Components
3430 @using Dynamicweb.Rapido.Blocks.Components.General
3431 @using Dynamicweb.Rapido.Blocks.Components.Articles
3432 @using Dynamicweb.Rapido.Blocks
34333434 @* Component for the articles *@
34353436 @helper RenderArticleVideo(ArticleVideo settings)
3437 {
3438 if (settings.Url != null)
3439 {
3440 //getting video ID from youtube URL
3441 string videoCode = settings.Url;
3442 Regex regex = new Regex(@".be\/(.[^?]*)");
3443 Match match = regex.Match(videoCode);
3444 string videoId = "";
3445 if (match.Success)
3446 {
3447 videoId = match.Groups[1].Value;
3448 }
3449 else
3450 {
3451 regex = new Regex(@"v=([^&]+)");
3452 match = regex.Match(videoCode);
3453 if (match.Success)
3454 {
3455 videoId = match.Groups[1].Value;
3456 }
3457 }
34583459 int autoPlay = settings.AutoPlay == "true" ? 1 : 0;
34603461 <div class="video-wrapper">
3462 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div>
3463 </div>
3464 }
3465 }
3466346734683469 @* Simple helpers *@
34703471 @*Requires the Gallery ItemType that comes with Rapido*@
3472 @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) {
3473 if (gallery != null && gallery.Count > 0)
3474 {
3475 int count = 1;
34763477 foreach (var item in gallery)
3478 {
3479 if (item.GetFile("ImagePath") != null)
3480 {
3481 string image = item.GetFile("ImagePath").PathUrlEncoded;
3482 string imagePrefix = "/Admin/Public/GetImage.ashx?width=1200&height=820&crop=5&Compression=75&DoNotUpscale=1&image=";
3483 int imagesCount = gallery.Count;
34843485 if (count == 1)
3486 {
3487 <label class="gallery" for="ParagraphGalleryModalTrigger" onclick="Gallery.openImage(this.querySelector('.js-gallery'))">
3488 <span class="gallery__main-image">
3489 <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" />
3490 </span>
3491 <span class="gallery__image-counter">
3492 <i class="fas fa-camera fa-2x"></i> <span class="gallery__image-counter__number">@imagesCount</span>
3493 <span class="gallery__image-counter__text">@Translate("See all") <i class="fas fa-angle-right"></i></span>
3494 </span>
3495 </label>
3496 }
3497 else
3498 {
3499 <div class="u-hidden js-gallery" data-for="ParagraphGallery" data-image="@imagePrefix@image"></div>
3500 }
35013502 count++;
3503 }
3504 }
35053506 @Render(new ArticleGalleryModal())
3507 }
3508 }
35093510 @helper RenderMobileFilters(List<Block> subBlocks)
3511 {
3512 if (subBlocks.Count > 0)
3513 {
3514 <div class="grid__col-12">
3515 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" />
3516 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters">
3517 @RenderBlockList(subBlocks)
3518 </div>
3519 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label>
3520 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label>
3521 </div>
3522 }
3523 }
352435253526 @* Include the Blocks for the page *@
3527 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
35283529 @using System
3530 @using System.Web
3531 @using System.Collections.Generic
3532 @using Dynamicweb.Rapido.Blocks.Extensibility
3533 @using Dynamicweb.Rapido.Blocks
35343535 @functions {
3536 string GoogleTagManagerID = "";
3537 string GoogleAnalyticsID = "";
3538 }
35393540 @{
3541 GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID");
3542 GoogleAnalyticsID = Model.Area.Item.GetItem("Settings").GetString("GoogleAnalyticsTrackingID");
35433544 BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master");
35453546 if (!string.IsNullOrWhiteSpace(GoogleAnalyticsID))
3547 {
3548 Block tagManager = new Block()
3549 {
3550 Id = "GoogleAnalytics",
3551 SortId = 0,
3552 Template = RenderGoogleAnalyticsSnippet()
3553 };
3554 topSnippetsBlocksPage.Add("Head", tagManager);
3555 }
35563557 if (!string.IsNullOrWhiteSpace(GoogleTagManagerID))
3558 {
3559 Block tagManager = new Block()
3560 {
3561 Id = "TagManager",
3562 SortId = 1,
3563 Template = RenderGoogleTagManager()
3564 };
3565 topSnippetsBlocksPage.Add("Head", tagManager);
35663567 Block tagManagerBodySnippet = new Block()
3568 {
3569 Id = "TagManagerBodySnippet",
3570 SortId = 1,
3571 Template = RenderGoogleTagManagerBodySnippet()
3572 };
3573 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManagerBodySnippet);
3574 }
35753576 Block facebookPixel = new Block()
3577 {
3578 Id = "FacebookPixel",
3579 SortId = 2,
3580 Template = RenderFacebookPixel()
3581 };
35823583 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel);
3584 }
35853586 @helper RenderGoogleAnalyticsSnippet()
3587 {
3588 <!-- Global site tag (gtag.js) - Google Analytics -->
3589 <script async src="https://www.googletagmanager.com/gtag/js?id=@GoogleAnalyticsID"></script>
3590 <script>
3591 window.dataLayer = window.dataLayer || [];
3592 function gtag(){dataLayer.push(arguments);}
3593 gtag('js', new Date());
35943595 gtag('config', '@GoogleAnalyticsID');
3596 </script>
35973598 }
35993600 @helper RenderGoogleTagManager()
3601 {
3602 <script>
3603 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
3604 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
3605 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
3606 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
3607 })(window,document,'script','dataLayer','@GoogleTagManagerID');
3608 </script>
3609 }
36103611 @helper RenderGoogleTagManagerBodySnippet()
3612 {
3613 <!-- Google Tag Manager (noscript) -->
3614 <noscript>
3615 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID"
3616 height="0" width="0" style="display:none;visibility:hidden"></iframe>
3617 </noscript>
3618 <!-- End Google Tag Manager (noscript) -->
3619 }
36203621 @helper RenderFacebookPixel()
3622 {
3623 string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID");
36243625 if (!string.IsNullOrWhiteSpace(FacebookPixelID))
3626 {
3627 <!-- Facebook Pixel Code -->
3628 <script>
3629 !function(f,b,e,v,n,t,s)
3630 {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
3631 n.callMethod.apply(n,arguments):n.queue.push(arguments)};
3632 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
3633 n.queue=[];t=b.createElement(e);t.async=!0;
3634 t.src=v;s=b.getElementsByTagName(e)[0];
3635 s.parentNode.insertBefore(t,s)}(window, document,'script',
3636 'https://connect.facebook.net/en_US/fbevents.js');
3637 fbq('init', '@FacebookPixelID');
3638 fbq('track', 'PageView');
3639 </script>
3640 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript>
3641 }
3642 }
3643 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
36443645 @using System
3646 @using System.Web
3647 @using System.Collections.Generic
3648 @using Dynamicweb.Rapido.Blocks
3649 @using Dynamicweb.Rapido.Blocks.Extensibility
3650 @using Dynamicweb.Security.UserManagement
3651 @using Dynamicweb.Security.UserManagement.ExternalAuthentication
3652 @using Dynamicweb.Rapido.Blocks.Components.General
36533654 @{
3655 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master");
36563657 Block loginModal = new Block()
3658 {
3659 Id = "LoginModal",
3660 SortId = 10,
3661 Component = new Modal
3662 {
3663 Id = "SignIn",
3664 Heading = new Heading
3665 {
3666 Level = 0,
3667 Title = Translate("Sign in")
3668 },
3669 Width = ModalWidth.Sm,
3670 BodyTemplate = RenderLoginForm()
3671 }
3672 };
36733674 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal);
3675 }
36763677 @helper RenderLoginForm()
3678 {
3679 int pageId = Model.TopPage.ID;
3680 string userSignedInErrorText = "";
3681 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
3682 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery";
3683 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount_custom");
3684 bool showModalOnStart = pageId != GetPageIdByNavigationTag("CustomerCenter") && Pageview.Page.ID != GetPageIdByNavigationTag("SignInPage") && Model.LogOnFailed;
3685 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");
3686 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink");
36873688 ProviderCollection providers = Provider.GetActiveProviders();
36893690 if (Model.LogOnFailed)
3691 {
3692 switch (Model.LogOnFailedReason)
3693 {
3694 case LogOnFailedReason.PasswordLengthInvalid:
3695 userSignedInErrorText = Translate("Password length is invalid");
3696 break;
3697 case LogOnFailedReason.IncorrectLogin:
3698 userSignedInErrorText = Translate("Invalid email or password");
3699 break;
3700 case LogOnFailedReason.ExceededFailedLogOnLimit:
3701 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked");
3702 break;
3703 case LogOnFailedReason.LoginLocked:
3704 userSignedInErrorText = Translate("The user account is temporarily locked");
3705 break;
3706 case LogOnFailedReason.PasswordExpired:
3707 userSignedInErrorText = Translate("The password has expired and needs to be renewed");
3708 break;
3709 default:
3710 userSignedInErrorText = Translate("An unknown error occured");
3711 break;
3712 }
3713 }
37143715 Form form = new Form { Method = FormMethod.Post, Name = "LoginModalForm" };
37163717 TextField passwordField = new TextField { Id = "login-password", Type = TextFieldType.Password, Name = "password", Label = Translate("Password"), Required = true };
37183719 if (!hideForgotPasswordLink) {
3720 passwordField.Link = new Link { Title = Translate("Forgot password?"), Href = "/Default.aspx?id=" + signInProfilePageId + "&LoginAction=Recovery" };
3721 }
37223723 form.Add(new HiddenField { Name = "ID", Value = Converter.ToString(pageId) });
3724 form.Add(new HiddenField { Name = "DWExtranetUsernameRemember", Value = "True" });
3725 form.Add(new HiddenField { Name = "DWExtranetPasswordRemember", Value = "True" });
3726 form.Add(new HiddenField { Name = "LoginAction", Value = "Login" });
3727 form.Add(new TextField { Id = "LoginUsername", Name = "username", Label = Translate("Email"), CssClass = "u-full-width", Required = true });
3728 form.Add(passwordField);
3729 form.Add(new NotificationMessage { Message = userSignedInErrorText, MessageType = NotificationMessageType.Error });
3730 form.Add(new CheckboxField { Id = "LoginRememberMe", Value = "True", Name = "Autologin", Label = Translate("Remember me") });
3731 form.Add(new Button { ButtonType = ButtonType.Submit, Title = Translate("Sign in"), CssClass = "btn--full", OnClick = "Buttons.LockButton(event)" });
37323733 foreach (Provider LoginProvider in providers)
3734 {
3735 var ProviderName = LoginProvider.Name.ToLower();
3736 form.Add(new Link {
3737 Href = "/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=" + LoginProvider.ID,
3738 Icon = new Icon { Prefix = "fab", Name = "fa-" + ProviderName, CssClass = "fa-1_5x", LabelPosition = IconLabelPosition.After },
3739 ButtonLayout = ButtonLayout.LinkClean,
3740 CssClass = "btn--condensed u-margin-bottom u-margin-right u-inline-block u-color-" + ProviderName,
3741 AltText = ProviderName
3742 });
3743 }
37443745 if (!hideCreateAccountLink) {
3746 form.Add(new Text { Content = "<div class=\"u-border-top u-full-width u-margin-bottom--lg\"></div>" });
3747 form.Add(new Link
3748 {
3749 Href = "/Default.aspx?id=" + createAccountPageId,
3750 ButtonLayout = ButtonLayout.LinkClean,
3751 Title = Translate("Create account"),
3752 CssClass = "u-full-width u-ta-center"
3753 });
3754 }
37553756 @Render(form)
37573758 if (showModalOnStart)
3759 {
3760 <script>
3761 document.getElementById("SignInModalTrigger").checked = true;
3762 </script>
3763 }
3764 }
376537663767376837693770 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet")
3771 {
3772 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
37733774 @using System
3775 @using System.Web
3776 @using System.Collections.Generic
3777 @using Dynamicweb.Rapido.Blocks.Extensibility
3778 @using Dynamicweb.Rapido.Blocks
3779 @using Dynamicweb.Rapido.Services
378037813782 @functions {
3783 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master");
3784 }
37853786 @{
3787 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";
3788 bool mobileHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");
3789 bool mobileHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart") || !Dynamicweb.Rapido.Services.User.IsBuyingAllowed();
37903791 Block mobileHeader = new Block()
3792 {
3793 Id = "MobileTop",
3794 SortId = 10,
3795 Template = RenderMobileTop(),
3796 SkipRenderBlocksList = true
3797 };
3798 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader);
37993800 Block mobileHeaderNavigation = new Block()
3801 {
3802 Id = "MobileHeaderNavigation",
3803 SortId = 10,
3804 Template = RenderMobileHeaderNavigation(),
3805 SkipRenderBlocksList = true,
3806 BlocksList = new List<Block> {
3807 new Block {
3808 Id = "MobileHeaderNavigationTrigger",
3809 SortId = 10,
3810 Template = RenderMobileHeaderNavigationTrigger()
3811 }
3812 }
3813 };
3814 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation);
38153816 Block mobileHeaderLogo = new Block()
3817 {
3818 Id = "MobileHeaderLogo",
3819 SortId = 20,
3820 Template = RenderMobileHeaderLogo(),
3821 SkipRenderBlocksList = true
3822 };
3823 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo);
38243825 Block mobileHeaderActions = new Block()
3826 {
3827 Id = "MobileHeaderActions",
3828 SortId = 30,
3829 Template = RenderMobileTopActions(),
3830 SkipRenderBlocksList = true
3831 };
3832 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions);
38333834 if (!mobileHideSearch)
3835 {
3836 Block mobileHeaderSearch = new Block
3837 {
3838 Id = "MobileHeaderSearch",
3839 SortId = 10,
3840 Template = RenderMobileTopSearch()
3841 };
3842 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch);
3843 }
38443845 Block mobileHeaderMiniCart;
38463847 if (!mobileHideCart)
3848 {
3849 mobileHeaderMiniCart = new Block
3850 {
3851 Id = "MobileHeaderMiniCart",
3852 SortId = 20,
3853 Template = RenderMobileTopMiniCart()
3854 };
38553856 Block miniCartCounterScriptTemplate = new Block
3857 {
3858 Id = "MiniCartCounterScriptTemplate",
3859 Template = RenderMobileMiniCartCounterContent()
3860 };
3861 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate);
3862 }
3863 else
3864 {
3865 mobileHeaderMiniCart = new Block
3866 {
3867 Id = "MobileHeaderMiniCart",
3868 SortId = 20
3869 };
3870 }
38713872 if (!mobileHideSearch)
3873 {
3874 Block mobileHeaderSearchBar = new Block()
3875 {
3876 Id = "MobileHeaderSearchBar",
3877 SortId = 30,
3878 Template = RenderMobileTopSearchBar()
3879 };
3880 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar);
3881 }
38823883 switch (mobileTopLayout)
3884 {
3885 case "nav-left":
3886 mobileHeaderNavigation.SortId = 10;
3887 mobileHeaderLogo.SortId = 20;
3888 mobileHeaderActions.SortId = 30;
3889 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart);
3890 break;
3891 case "nav-right":
3892 mobileHeaderLogo.SortId = 10;
3893 mobileHeaderActions.SortId = 20;
3894 mobileHeaderNavigation.SortId = 30;
3895 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart);
3896 break;
3897 case "nav-search-left":
3898 mobileHeaderNavigation.SortId = 10;
3899 mobileHeaderLogo.SortId = 20;
3900 mobileHeaderActions.SortId = 30;
3901 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart);
3902 break;
3903 case "search-left":
3904 mobileHeaderActions.SortId = 10;
3905 mobileHeaderLogo.SortId = 20;
3906 mobileHeaderNavigation.SortId = 30;
3907 mobileHeaderMiniCart.SortId = 0;
3908 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart);
3909 break;
3910 }
3911 }
391239133914 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
39153916 @using System
3917 @using System.Web
3918 @using Dynamicweb.Rapido.Blocks.Extensibility
3919 @using Dynamicweb.Rapido.Blocks
39203921 @{
3922 BlocksPage customMobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master");
3923 }
39243925392639273928 @helper RenderMobileTop() {
3929 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList();
39303931 <nav class="main-navigation-mobile dw-mod">
3932 <div class="center-container top-container__center-container dw-mod">
3933 <div class="grid grid--align-center">
3934 @RenderBlockList(subBlocks)
3935 </div>
3936 </div>
3937 </nav>
3938 }
39393940 @helper RenderMobileHeaderNavigation() {
3941 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList();
39423943 <div class="grid__col-auto-width">
3944 <ul class="menu dw-mod">
3945 @RenderBlockList(subBlocks)
3946 </ul>
3947 </div>
3948 }
39493950 @helper RenderMobileHeaderNavigationTrigger() {
3951 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">
3952 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label>
3953 </li>
3954 }
39553956 @helper RenderMobileHeaderLogo() {
3957 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList();
39583959 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";
3960 string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : "";
3961 string firstPageId = Model.Area.FirstActivePage.ID.ToString();
3962 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName");
39633964 string mobileLogo = "/Files/Images/logo-dynamicweb.png";
3965 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null)
3966 {
3967 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded;
3968 }
39693970 if (Path.GetExtension(mobileLogo).ToLower() != ".svg")
3971 {
3972 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&width=100&crop=5&Compression=75&image=" + mobileLogo;
3973 }
3974 else
3975 {
3976 mobileLogo = HttpUtility.UrlDecode(mobileLogo);
3977 }
39783979 <div class="grid__col-auto grid__col--bleed">
3980 <div class="grid__cell @centeredLogo">
3981 <a href="/Default.aspx?ID=@firstPageId" class="logo logo--mobile u-inline-block dw-mod">
3982 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" />
3983 </a>
3984 </div>
39853986 @RenderBlockList(subBlocks)
3987 </div>
3988 }
39893990 @helper RenderMobileTopActions() {
3991 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList();
39923993 <div class="grid__col-auto-width">
3994 <ul class="menu dw-mod">
3995 @RenderBlockList(subBlocks)
3996 </ul>
3997 </div>
3998 }
39994000 @helper RenderMobileTopSearch() {
4001 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">
4002 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod">
4003 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i>
4004 </label>
4005 </li>
4006 }
40074008 @helper RenderMobileTopMiniCart() {
4009 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
4010 int cartPageId = GetPageIdByNavigationTag("CartPage");
4011 double cartProductsCount = Model.Cart.TotalProductsCount;
40124013 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper">
4014 <div class="mini-cart dw-mod">
4015 <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">
4016 <div class="u-inline u-position-relative">
4017 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i>
4018 <div class="mini-cart__counter dw-mod">
4019 <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">
4020 <div class="js-mini-cart-counter-content" data-count="@cartProductsCount">
4021 @cartProductsCount
4022 </div>
4023 </div>
4024 </div>
4025 </div>
4026 </a>
4027 </div>
4028 </li>
4029 }
40304031 @helper RenderMobileTopSearchBar()
4032 {
4033 string searchFeedId = "";
4034 string searchSecondFeedId = "";
4035 string searchBlogFeedId = "";
4036 int groupsFeedId;
4037 int productsPageId = GetPageIdByNavigationTag("ProductsPage");
4038 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;
4039 string resultPageLink;
4040 string searchPlaceholder;
4041 string searchType = "product-search";
4042 string searchTemplate;
4043 string searchBlogTemplate = "";
4044 string searchContentTemplate = "";
4045 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? "";
4046 bool showGroups = true;
40474048 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch")
4049 {
4050 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true";
4051 resultPageLink = contentSearchPageLink;
4052 searchPlaceholder = Translate("Search page");
4053 groupsFeedId = 0;
4054 searchType = "content-search";
4055 searchTemplate = "SearchPagesTemplate";
4056 showGroups = false;
4057 }
4058 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch")
4059 {
4060 searchFeedId = productsPageId + "&feed=true";
4061 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true";
4062 searchBlogFeedId = GetPageIdByNavigationTag("BlogSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true";
4063 resultPageLink = Converter.ToString(productsPageId);
4064 searchPlaceholder = Translate("Search products or pages");
4065 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed");
4066 searchType = "combined-search";
4067 searchTemplate = "SearchProductsTemplateWrap";
4068 searchContentTemplate = "SearchPagesTemplateWrap";
4069 searchBlogTemplate = "SearchBlogTemplateWrap";
4070 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector");
4071 }
4072 else
4073 {
4074 resultPageLink = Converter.ToString(productsPageId);
4075 searchFeedId = productsPageId + "&feed=true";
4076 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed");
4077 searchPlaceholder = Translate("Search products");
4078 searchTemplate = "SearchProductsTemplate";
4079 searchType = "product-search";
4080 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector");
4081 }
40824083 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" />
40844085 <div class="main-navigation-mobile typeahead-mobile dw-mod">
4086 <div class="center-container top-container__center-container dw-mod">
4087 <div class="grid">
4088 <div class="typeahead-mobile__search-container">
4089 <div class="typeahead-mobile__search-field dw-mod js-typeahead" data-page-size="@(searchType == "combined-search" ? 4 : 8)" id="MobileProductSearch"
4090 data-search-feed-id="@searchFeedId"
4091 data-search-second-feed-id="@searchSecondFeedId"
4092 data-search-blog-feed-id="@searchBlogFeedId"
4093 data-result-page-id="@resultPageLink"
4094 data-search-type="@searchType">
4095 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue">
4096 @if (string.IsNullOrEmpty(searchSecondFeedId))
4097 {
4098 <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>
4099 }
4100 else
4101 {
4102 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid">
4103 <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>
4104 <div class="js-handlebars-root js-typeahead-blog-search-content" id="BlogSearchBarContent" data-template="@searchBlogTemplate" data-json-feed="/Default.aspx?ID=@searchBlogFeedId" data-init-onload="false"></div>
4105 <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>
4106 </div>
4107 }
4108 <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>
4109 </div>
4110 </div>
4111 <div class="grid__col-auto-width mobile-close-button">
4112 <ul class="menu dw-mod">
4113 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">
4114 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod">
4115 <i class="fas fa-times fa-1_5x"></i>
4116 </label>
4117 </li>
4118 </ul>
4119 </div>
4120 </div>
4121 </div>
4122 </div>
4123 }
41244125 @helper RenderMobileMiniCartCounterContent()
4126 {
4127 <script id="MiniCartCounterContent" type="text/x-template">
4128 {{#.}}
4129 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}">
4130 {{numberofproducts}}
4131 </div>
4132 {{/.}}
4133 </script>
4134 }
4135 </text>
4136 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
41374138 @using System
4139 @using System.Web
4140 @using System.Collections.Generic
4141 @using Dynamicweb.Rapido.Blocks.Extensibility
4142 @using Dynamicweb.Rapido.Blocks
41434144 @functions {
4145 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master");
4146 }
41474148 @{
4149 bool mobileNavigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn");
4150 bool mobileHideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");
4151 bool mobileHideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile");
4152 bool mobileHideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders");
4153 bool mobileHideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards");
4154 bool mobileHideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites");
41554156 Block mobileNavigation = new Block()
4157 {
4158 Id = "MobileNavigation",
4159 SortId = 10,
4160 Template = MobileNavigation(),
4161 SkipRenderBlocksList = true
4162 };
4163 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation);
41644165 if (Model.CurrentUser.ID > 0 && !mobileHideMyProfileLink)
4166 {
4167 Block mobileNavigationSignIn = new Block
4168 {
4169 Id = "MobileNavigationSignIn",
4170 SortId = 10,
4171 Template = RenderMobileNavigationSignIn()
4172 };
4173 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn);
4174 }
41754176 Block mobileNavigationMenu = new Block
4177 {
4178 Id = "MobileNavigationMenu",
4179 SortId = 20,
4180 Template = RenderMobileNavigationMenu()
4181 };
4182 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu);
41834184 Block mobileNavigationActions = new Block
4185 {
4186 Id = "MobileNavigationActions",
4187 SortId = 30,
4188 Template = RenderMobileNavigationActions(),
4189 SkipRenderBlocksList = true
4190 };
4191 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions);
41924193 if (!mobileNavigationItemsHideSignIn)
4194 {
4195 if (Model.CurrentUser.ID <= 0)
4196 {
4197 Block mobileNavigationSignInAction = new Block
4198 {
4199 Id = "MobileNavigationSignInAction",
4200 SortId = 10,
4201 Template = RenderMobileNavigationSignInAction()
4202 };
4203 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction);
42044205 if (!mobileHideCreateAccountLink)
4206 {
4207 Block mobileNavigationCreateAccountAction = new Block
4208 {
4209 Id = "MobileNavigationCreateAccountAction",
4210 SortId = 20,
4211 Template = RenderMobileNavigationCreateAccountAction()
4212 };
4213 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction);
4214 }
4215 }
4216 else
4217 {
4218 if (!mobileHideMyOrdersLink)
4219 {
4220 Block mobileNavigationOrdersAction = new Block
4221 {
4222 Id = "MobileNavigationOrdersAction",
4223 SortId = 20,
4224 Template = RenderMobileNavigationOrdersAction()
4225 };
4226 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction);
4227 }
4228 if (!mobileHideMyFavoritesLink)
4229 {
4230 Block mobileNavigationFavoritesAction = new Block
4231 {
4232 Id = "MobileNavigationFavoritesAction",
4233 SortId = 30,
4234 Template = RenderMobileNavigationFavoritesAction()
4235 };
4236 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction);
4237 }
4238 if (!mobileHideMySavedCardsLink)
4239 {
4240 Block mobileNavigationSavedCardsAction = new Block
4241 {
4242 Id = "MobileNavigationFavoritesAction",
4243 SortId = 30,
4244 Template = RenderMobileNavigationSavedCardsAction()
4245 };
4246 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction);
4247 }
42484249 Block mobileNavigationSignOutAction = new Block
4250 {
4251 Id = "MobileNavigationSignOutAction",
4252 SortId = 40,
4253 Template = RenderMobileNavigationSignOutAction()
4254 };
4255 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction);
4256 }
4257 }
42584259 if (Model.Area.Languages.Count > 1)
4260 {
4261 Block mobileNavigationLanguagesAction = new Block
4262 {
4263 Id = "MobileNavigationLanguagesAction",
4264 SortId = 50,
4265 Template = RenderMobileNavigationLanguagesAction()
4266 };
4267 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction);
4268 }
4269 }
427042714272 @helper MobileNavigation()
4273 {
4274 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList();
4275 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left";
4276 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right";
42774278 <!-- Trigger for mobile navigation -->
4279 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" />
42804281 <!-- Mobile navigation -->
4282 <nav class="mobile-navigation mobile-navigation--@position dw-mod">
4283 <div class="mobile-navigation__wrapper" id="mobileNavigationWrapper">
4284 @RenderBlockList(subBlocks)
4285 </div>
4286 </nav>
42874288 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label>
4289 }
42904291 @helper RenderMobileNavigationSignIn()
4292 {
4293 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4294 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");
4295 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
4296 string myProfilePageLink = linkStart + myProfilePageId;
4297 string userName = Model.CurrentUser.FirstName;
4298 if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(Model.CurrentUser.LastName))
4299 {
4300 userName += " " + Model.CurrentUser.LastName;
4301 }
4302 if (string.IsNullOrEmpty(userName))
4303 {
4304 userName = Model.CurrentUser.Name;
4305 }
4306 if (string.IsNullOrEmpty(userName))
4307 {
4308 userName = Model.CurrentUser.UserName;
4309 }
4310 if (string.IsNullOrEmpty(userName))
4311 {
4312 userName = Model.CurrentUser.Email;
4313 }
43144315 <ul class="menu menu-mobile">
4316 <li class="menu-mobile__item">
4317 <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>
4318 </li>
4319 </ul>
4320 }
43214322 @helper RenderMobileNavigationMenu()
4323 {
4324 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides";
4325 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt";
4326 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3";
4327 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");
4328 int startLevel = 0;
43294330 @RenderNavigation(new
4331 {
4332 id = "mobilenavigation",
4333 cssclass = "menu menu-mobile dwnavigation",
4334 startLevel = @startLevel,
4335 ecomStartLevel = @startLevel + 1,
4336 endlevel = @levels,
4337 expandmode = "all",
4338 template = @menuTemplate
4339 })
43404341 if (isSlidesDesign)
4342 {
4343 <script>
4344 function goToLevel(level) {
4345 document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%";
4346 }
43474348 document.addEventListener('DOMContentLoaded', function () {
4349 goToLevel(document.getElementById('mobileNavigationWrapper').querySelectorAll('input[type=radio]:checked').length);
4350 });
4351 </script>
4352 }
43534354 if (renderPagesInToolBar)
4355 {
4356 @RenderNavigation(new
4357 {
4358 id = "topToolsMobileNavigation",
4359 cssclass = "menu menu-mobile dwnavigation",
4360 template = "ToolsMenuForMobile.xslt"
4361 })
4362 }
4363 }
43644365 @helper RenderMobileNavigationActions()
4366 {
4367 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ;
43684369 <ul class="menu menu-mobile">
4370 @RenderBlockList(subBlocks)
4371 </ul>
4372 }
43734374 @helper RenderMobileNavigationSignInAction()
4375 {
4376 <li class="menu-mobile__item">
4377 <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>
4378 </li>
4379 }
43804381 @helper RenderMobileNavigationCreateAccountAction()
4382 {
4383 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount_custom");
43844385 <li class="menu-mobile__item">
4386 <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>
4387 </li>
4388 }
43894390 @helper RenderMobileNavigationProfileAction()
4391 {
4392 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4393 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
4394 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");
4395 string myProfilePageLink = linkStart + myProfilePageId;
43964397 <li class="menu-mobile__item">
4398 <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>
4399 </li>
4400 }
44014402 @helper RenderMobileNavigationOrdersAction()
4403 {
4404 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4405 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
4406 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders");
4407 string myOrdersPageLink = linkStart + myOrdersPageId;
4408 string ordersIcon = "fas fa-list";
44094410 <li class="menu-mobile__item">
4411 <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>
4412 </li>
4413 }
44144415 @helper RenderMobileNavigationFavoritesAction()
4416 {
4417 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4418 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
4419 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");
4420 string myFavoritesPageLink = linkStart + myFavoritesPageId;
4421 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";
442244234424 <li class="menu-mobile__item">
4425 <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>
4426 </li>
4427 }
44284429 @helper RenderMobileNavigationSavedCardsAction()
4430 {
4431 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4432 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
4433 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards");
4434 string mySavedCardsPageLink = linkStart + mySavedCardsPageId;
4435 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";
44364437 <li class="menu-mobile__item">
4438 <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>
4439 </li>
4440 }
44414442 @helper RenderMobileNavigationSignOutAction()
4443 {
4444 int pageId = Model.TopPage.ID;
4445 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";
44464447 <li class="menu-mobile__item">
4448 <!-- <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> -->
4449 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId"><i class="@signOutIcon menu-mobile__link-icon"></i> @Translate("Sign out")</a>
4450 </li>
4451 }
44524453 @helper RenderMobileNavigationLanguagesAction()
4454 {
4455 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides";
44564457 string selectedLanguage = "";
4458 foreach (var lang in Model.Languages)
4459 {
4460 if (lang.IsCurrent)
4461 {
4462 selectedLanguage = lang.Name;
4463 }
4464 }
44654466 <li class="menu-mobile__item dw-mod">
4467 @if (isSlidesDesign)
4468 {
4469 <input id="MobileMenuCheck_Language" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(1);">
4470 }
4471 else
4472 {
4473 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger">
4474 }
4475 <div class="menu-mobile__link__wrap">
4476 <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> @Translate("Language")</label>
4477 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label>
4478 </div>
4479 <ul class="menu-mobile menu-mobile__submenu expand-menu">
4480 @if (isSlidesDesign)
4481 {
4482 <li class="menu-mobile__item dw-mod">
4483 <div class="menu-mobile__link__wrap">
4484 <input id="MobileMenuCheck_Language_back" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(0);" />
4485 <label for="MobileMenuCheck_Language_back" class="menu-mobile__trigger menu-mobile__trigger--back"></label>
4486 <label for="MobileMenuCheck_Language_back" class="menu-mobile__link dw-mod ">@Translate("Back")</label>
4487 </div>
4488 </li>
4489 }
4490 @foreach (var lang in Model.Area.Languages)
4491 {
4492 <li class="menu-mobile__item dw-mod">
4493 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod menu-mobile__link--level-1" href="/Default.aspx?AreaID=@lang.ID">@lang.Name</a>
4494 </li>
4495 }
4496 </ul>
4497 </li>
4498 }</text>
4499 }
4500 else
4501 {
4502 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4503 @using System
4504 @using System.Web
4505 @using System.Collections.Generic
4506 @using Dynamicweb.Rapido.Blocks.Extensibility
4507 @using Dynamicweb.Rapido.Blocks
4508 @using Dynamicweb.Frontend.Navigation
45094510 @functions {
4511 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master");
4512 }
45134514 @{
4515 Block masterTools = new Block()
4516 {
4517 Id = "MasterDesktopTools",
4518 SortId = 10,
4519 Template = RenderDesktopTools(),
4520 SkipRenderBlocksList = true,
4521 BlocksList = new List<Block>
4522 {
4523 new Block {
4524 Id = "MasterDesktopToolsText",
4525 SortId = 10,
4526 Template = RenderDesktopToolsText(),
4527 Design = new Design
4528 {
4529 Size = "auto",
4530 HidePadding = true,
4531 RenderType = RenderType.Column
4532 }
4533 },
4534 new Block {
4535 Id = "MasterDesktopToolsNavigation",
4536 SortId = 20,
4537 Template = RenderDesktopToolsNavigation(),
4538 Design = new Design
4539 {
4540 Size = "auto-width",
4541 HidePadding = true,
4542 RenderType = RenderType.Column
4543 }
4544 }
4545 }
4546 };
4547 headerBlocksPage.Add("MasterHeader", masterTools);
45484549 Block masterDesktopExtra = new Block()
4550 {
4551 Id = "MasterDesktopExtra",
4552 SortId = 10,
4553 Template = RenderDesktopExtra(),
4554 SkipRenderBlocksList = true
4555 };
4556 headerBlocksPage.Add("MasterHeader", masterDesktopExtra);
45574558 Block masterDesktopNavigation = new Block()
4559 {
4560 Id = "MasterDesktopNavigation",
4561 SortId = 20,
4562 Template = RenderDesktopNavigation(),
4563 SkipRenderBlocksList = true
4564 };
4565 headerBlocksPage.Add("MasterHeader", masterDesktopNavigation);
4566 }
45674568 @* Include the Blocks for the page *@
4569 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
45704571 @using System
4572 @using System.Web
4573 @using Dynamicweb.Rapido.Blocks.Extensibility
4574 @using Dynamicweb.Rapido.Blocks
45754576 @{
4577 Block masterDesktopLogo = new Block
4578 {
4579 Id = "MasterDesktopLogo",
4580 SortId = 10,
4581 Template = RenderDesktopLogo(),
4582 Design = new Design
4583 {
4584 Size = "auto-width",
4585 HidePadding = true,
4586 RenderType = RenderType.Column,
4587 CssClass = "grid--align-self-center"
4588 }
4589 };
45904591 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo);
4592 }
459345944595 @helper RenderDesktopLogo()
4596 {
4597 string firstPageId = Model.Area.FirstActivePage.ID.ToString();
4598 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4599 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : "";
4600 alignClass = topLayout == "splitted-center" ? "u-middle" : alignClass;
4601 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png";
4602 if (Path.GetExtension(logo).ToLower() != ".svg")
4603 {
4604 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight");
4605 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40;
4606 logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&crop=5&Compression=75&image=" + logo;
4607 }
4608 else
4609 {
4610 logo = HttpUtility.UrlDecode(logo);
4611 }
46124613 <div class="logo @alignClass dw-mod">
4614 <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block">
4615 <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" />
4616 </a>
4617 </div>
4618 }
4619 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
46204621 @using System
4622 @using System.Web
4623 @using Dynamicweb.Ecommerce.Cart
4624 @using Dynamicweb.Rapido.Blocks.Extensibility
4625 @using Dynamicweb.Rapido.Blocks
4626 @using Dynamicweb.Rapido.Blocks.Components.General
46274628 @functions {
4629 bool isMegaMenu;
4630 }
46314632 @{
4633 isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false;
4634 Block masterDesktopMenu = new Block
4635 {
4636 Id = "MasterDesktopMenu",
4637 SortId = 10,
4638 Template = RenderDesktopMenu(),
4639 Design = new Design
4640 {
4641 Size = "auto",
4642 HidePadding = true,
4643 RenderType = RenderType.Column
4644 }
4645 };
46464647 if (isMegaMenu)
4648 {
4649 masterDesktopMenu.Design.CssClass = "u-reset-position";
4650 }
46514652 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu);
4653 }
46544655 @helper RenderDesktopMenu()
4656 {
4657 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4658 string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : "";
4659 menuAlignment = topLayout == "minimal-center" ? "grid--align-self-center" : topLayout;
4660 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : "";
4661 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");
4662 bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders");
4663 int startLevel = renderPagesInToolBar ? 1 : 0;
46644665 string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink");
46664667 <div class="grid__cell u-flex @(isMegaMenu ? "u-reset-position" : "") @menuAlignment">
4668 @if (!isMegaMenu)
4669 {
4670 @RenderNavigation(new
4671 {
4672 id = "topnavigation",
4673 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap",
4674 startLevel = startLevel,
4675 ecomStartLevel = startLevel + 1,
4676 endlevel = 5,
4677 expandmode = "all",
4678 template = "BaseMenuWithDropdown.xslt"
4679 });
4680 }
4681 else
4682 {
4683 @RenderNavigation(new
4684 {
4685 id = "topnavigation",
4686 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap",
4687 startLevel = startLevel,
4688 ecomStartLevel = startLevel + 1,
4689 endlevel = 5,
4690 promotionImage = megamenuPromotionImage,
4691 promotionLink = promotionLink,
4692 expandmode = "all",
4693 showOnlyHeaders = showOnlyHeaders.ToString().ToLower(),
4694 template = "BaseMegaMenu.xslt"
4695 });
4696 }
4697 </div>
46984699 }
47004701 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
47024703 @using System
4704 @using System.Web
4705 @using Dynamicweb.Rapido.Blocks.Extensibility
4706 @using Dynamicweb.Rapido.Blocks
47074708 @{
4709 Block masterDesktopActionsMenu = new Block
4710 {
4711 Id = "MasterDesktopActionsMenu",
4712 SortId = 10,
4713 Template = RenderDesktopActionsMenu(),
4714 Design = new Design
4715 {
4716 CssClass = "u-flex"
4717 },
4718 SkipRenderBlocksList = true
47194720 };
4721 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu);
47224723 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink")))
4724 {
4725 Block masterDesktopActionsHeaderButton = new Block
4726 {
4727 Id = "MasterDesktopActionsHeaderButton",
4728 SortId = 60,
4729 Template = RenderHeaderButton()
4730 };
4731 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton);
4732 }
4733 }
47344735 @helper RenderDesktopActionsMenu()
4736 {
4737 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList();
47384739 <ul class="menu u-flex dw-mod">
4740 @RenderBlockList(subBlocks)
4741 </ul>
4742 }
47434744 @helper RenderHeaderButton()
4745 {
4746 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText");
4747 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink");
4748 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : "";
47494750 if (Pageview.User == null)
4751 {
4752 <li class="menu__item menu__item--horizontal menu--clean dw-mod">
4753 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-left" href="@headerButtonLink">@headerButtonText</a>
4754 </li>
47554756 }
47574758 }
4759 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
47604761 @using System
4762 @using System.Web
4763 @using Dynamicweb.Core;
4764 @using System.Text.RegularExpressions
4765 @using Dynamicweb.Rapido.Blocks.Extensibility
4766 @using Dynamicweb.Rapido.Blocks
47674768 @{
4769 Block masterDesktopActionsMenuLanguageSelector = new Block
4770 {
4771 Id = "MasterDesktopActionsMenuLanguageSelector",
4772 SortId = 40,
4773 Template = RenderLanguageSelector()
4774 };
47754776 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector);
4777 }
47784779 @helper RenderLanguageSelector()
4780 {
4781 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4782 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
4783 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
4784 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() : "";
47854786 var allAreas = Dynamicweb.Services.Areas.GetAreas();
4787 var currentArea = Dynamicweb.Services.Areas.GetArea(Model.Area.ID);
4788 List<Dynamicweb.Content.Area> areasMenu = new List<Dynamicweb.Content.Area>();
47894790 foreach (var area in allAreas)
4791 {
4792 // Display current area
4793 if (area.ID == Model.Area.ID)
4794 {
4795 areasMenu.Add(area);
4796 }
4797 // Display language versions under a current master
4798 else if (currentArea.IsMaster && area.MasterAreaId == currentArea.ID)
4799 {
4800 areasMenu.Add(area);
4801 }
4802 // Display a master to a current language version
4803 else if (area.ID == currentArea.MasterAreaId)
4804 {
4805 areasMenu.Add(area);
4806 }
4807 // Display other language versions with the same master as current
4808 else if (area.IsLanguage && area.MasterAreaId == currentArea.MasterAreaId)
4809 {
4810 areasMenu.Add(area);
4811 }
4812 }
48134814 if (areasMenu.Count > 1)
4815 {
4816 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod">
4817 <div class="@menuLinkClass dw-mod" title="@Translate("Language")">
4818 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i>
4819 </div>
4820 <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell">
4821 @foreach (var lang in areasMenu)
4822 {
4823 string widthClass = "menu__item--fixed-width";
4824 string langInfo = "<span class=\"flag-icon flag-icon-" + lang.Culture.Substring(3,2).ToLower() + " u-margin-right\"></span>" + lang.Name;
4825 string cultureName = Regex.Replace(lang.CultureInfo.NativeName, @" ?\(.*?\)", string.Empty);
4826 cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1);
48274828 if (languageViewType == "flag-culture")
4829 {
4830 langInfo = "<span class=\"flag-icon flag-icon-" + lang.Culture.Substring(3,2).ToLower() + " \"></span> " + cultureName;
4831 }
48324833 if (languageViewType == "flag")
4834 {
4835 langInfo = "<span class=\"flag-icon flag-icon-" + lang.Culture.Substring(3,2).ToLower() + " \"></span>";
4836 widthClass = "";
4837 }
48384839 if (languageViewType == "name")
4840 {
4841 langInfo = lang.Name;
4842 }
48434844 if (languageViewType == "culture")
4845 {
4846 langInfo = cultureName;
4847 widthClass = "";
4848 }
48494850 <div class="menu__item dw-mod @widthClass">
4851 <a href="/Default.aspx?AreaID=@lang.ID" class="menu-dropdown__link dw-mod">@langInfo</a>
4852 </div>
4853 }
4854 </div>
4855 </li>
4856 }
4857 }
4858 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
48594860 @using System
4861 @using System.Web
4862 @using Dynamicweb.Rapido.Blocks.Extensibility
4863 @using Dynamicweb.Rapido.Blocks
48644865 @{
4866 Block masterDesktopActionsMenuSignIn = new Block
4867 {
4868 Id = "MasterDesktopActionsMenuSignIn",
4869 SortId = 20,
4870 Template = RenderSignIn()
4871 };
48724873 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuSignIn);
4874 }
48754876 @helper RenderSignIn()
4877 {
4878 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn");
4879 string userInitials = "";
4880 int pageId = GetPageIdByNavigationTag("SignInPage");
4881 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount_custom");
4882 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard");
4883 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");
4884 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders");
4885 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");
4886 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards");
4887 int myOrderDraftsPageId = GetPageIdByNavigationTag("OrderDraft");
4888 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4889 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");
4890 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile");
4891 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders");
4892 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards");
4893 bool hideMyOrderDraftsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrderDrafts");
4894 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites");
4895 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink");
48964897 string linkStart = "/Default.aspx?ID=";
4898 if (Model.CurrentUser.ID <= 0)
4899 {
4900 linkStart += signInProfilePageId + "&RedirectPageId=";
4901 }
49024903 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery";
4904 string myProfilePageLink = linkStart + myProfilePageId;
4905 string myOrdersPageLink = linkStart + myOrdersPageId;
4906 string myFavoritesPageLink = linkStart + myFavoritesPageId;
4907 string mySavedCardsPageLink = linkStart + mySavedCardsPageId;
4908 string myOrderDraftsLink = linkStart + myOrderDraftsPageId;
49094910 string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user";
4911 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";
4912 string orderDraftsIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon").SelectedValue : "fa fa-clipboard";
49134914 if (Model.CurrentUser.ID != 0)
4915 {
4916 userInitials = Dynamicweb.Rapido.Services.User.GetInitials(Model.CurrentUser.Name, Model.CurrentUser.FirstName, Model.CurrentUser.LastName, Model.CurrentUser.Email, Model.CurrentUser.UserName);
4917 }
49184919 if (!navigationItemsHideSignIn)
4920 {
4921 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4922 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean";
4923 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
49244925 <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod">
4926 <div class="@menuLinkClass dw-mod">
4927 @if (Model.CurrentUser.ID <= 0)
4928 {
4929 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x" title="@Translate("Sign in")"></i>
4930 }
4931 else
4932 {
4933 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit" title="@Model.CurrentUser.Name - @Model.CurrentUser.Company"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a>
4934 }
4935 </div>
4936 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod">
4937 <ul class="list list--clean dw-mod">
4938 @if (Model.CurrentUser.ID <= 0)
4939 {
4940 <li>
4941 <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>
4942 </li>
49434944 if (!hideCreateAccountLink)
4945 {
4946 @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account"));
4947 }
4948 if (!hideForgotPasswordLink)
4949 {
4950 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?"))
4951 }
4952 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink)
4953 {
4954 @RenderSeparator()
4955 }
4956 }
4957 @if (!hideMyProfileLink)
4958 {
4959 @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon)
4960 }
4961 @if (!hideMyOrdersLink)
4962 {
4963 @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list")
4964 }
4965 @if (!hideMyFavoritesLink)
4966 {
4967 @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon)
4968 }
4969 @if (!hideMySavedCardsLink)
4970 {
4971 @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card")
4972 }
4973 @if (!hideMyOrderDraftsLink)
4974 {
4975 @RenderListItem(myOrderDraftsLink, Translate("My Order drafts"), orderDraftsIcon)
4976 }
4977 @if (Model.CurrentUser.ID > 0)
4978 {
4979 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink)
4980 {
4981 @RenderSeparator()
4982 }
49834984 //Check if impersonation is on
4985 if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0)
4986 {
4987 <li>
4988 <div class="list__link dw-mod" onclick="document.getElementById('StopImpersonationModalTrigger').checked = true;">
4989 @Translate("Sign out")
4990 </div>
4991 </li>
4992 } else {
4993 @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out"))
4994 }
4995 }
4996 </ul>
4997 </div>
4998 </li>
4999 }
5000 }
50015002 @helper RenderListItem(string link, string text, string icon = null) {
5003 <li>
5004 <!-- <a href="@link" class="list__link dw-mod" onclick="RememberState.SetCookie('useAnotherAddress', false)"> -->
5005 <a href="@link" class="list__link dw-mod">
5006 @if (!string.IsNullOrEmpty(icon)){<i class="@icon u-margin-right"></i>}@text
5007 </a>
5008 </li>
5009 }
50105011 @helper RenderSeparator()
5012 {
5013 <li class="list__seperator dw-mod"></li>
5014 }
5015 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
50165017 @using System
5018 @using System.Web
5019 @using Dynamicweb.Rapido.Blocks.Extensibility
5020 @using Dynamicweb.Rapido.Blocks
50215022 @{
5023 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites");
50245025 Block masterDesktopActionsMenuFavorites = new Block
5026 {
5027 Id = "MasterDesktopActionsMenuFavorites",
5028 SortId = 30,
5029 Template = RenderFavorites()
5030 };
50315032 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0)
5033 {
5034 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites);
5035 }
5036 }
50375038 @helper RenderFavorites()
5039 {
5040 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");
5041 string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId;
50425043 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5044 string liClasses = topLayout != "normal" && topLayout != "splitted-center" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
5045 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
50465047 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod">
5048 <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod" title="@Translate("Favorites")">
5049 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i>
5050 </a>
5051 </li>
5052 }
5053 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
50545055 @using System
5056 @using System.Web
5057 @using Dynamicweb.Rapido.Blocks.Extensibility
5058 @using Dynamicweb.Rapido.Blocks
5059 @using Dynamicweb.Rapido.Services
50605061 @{
5062 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart");
5063 string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown";
50645065 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !hideCart)
5066 {
5067 Block masterDesktopActionsMenuMiniCart = new Block
5068 {
5069 Id = "MasterDesktopActionsMenuMiniCart",
5070 SortId = 60,
5071 Template = RenderMiniCart(miniCartLayout == "dropdown"),
5072 SkipRenderBlocksList = true,
5073 BlocksList = new List<Block>()
5074 };
50755076 Block miniCartCounterScriptTemplate = new Block
5077 {
5078 Id = "MiniCartCounterScriptTemplate",
5079 Template = RenderMiniCartCounterContent()
5080 };
50815082 //dropdown layout is default
5083 RazorEngine.Templating.TemplateWriter layoutTemplate;
5084 RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate;
50855086 switch (miniCartLayout)
5087 {
5088 case "dropdown":
5089 layoutTemplate = RenderMiniCartDropdownLayout();
5090 miniCartTriggerTemplate = RenderMiniCartTriggerLink();
5091 break;
5092 case "panel":
5093 layoutTemplate = RenderMiniCartPanelLayout();
5094 miniCartTriggerTemplate = RenderMiniCartTriggerLabel();
5095 break;
5096 case "modal":
5097 layoutTemplate = RenderMiniCartModalLayout();
5098 miniCartTriggerTemplate = RenderMiniCartTriggerLabel();
5099 break;
5100 case "none":
5101 default:
5102 layoutTemplate = RenderMiniCartDropdownLayout();
5103 miniCartTriggerTemplate = RenderMiniCartTriggerLink();
5104 break;
5105 }
51065107 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block
5108 {
5109 Id = "MiniCartTrigger",
5110 Template = miniCartTriggerTemplate
5111 });
51125113 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
5114 {
5115 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block
5116 {
5117 Id = "MiniCartLayout",
5118 Template = layoutTemplate
5119 });
5120 }
51215122 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuMiniCart);
5123 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate);
5124 }
51255126 if (hideCart && Dynamicweb.Rapido.Services.User.IsBuyingAllowed())
5127 {
5128 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block {
5129 Id = "CartInitialization"
5130 });
5131 }
5132 }
51335134 @helper RenderMiniCart(bool hasMouseEnterEvent)
5135 {
5136 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterDesktopActionsMenuMiniCart").OrderBy(item => item.SortId).ToList();
5137 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5138 string liClasses = topLayout != "normal" ? "menu__item--top-level" : "menu--clean";
5139 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5140 string mouseEvent = "";
5141 string id = "MiniCart";
5142 if (hasMouseEnterEvent)
5143 {
5144 mouseEvent = "onmouseenter=\"Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=" + miniCartFeedPageId + "&feedType=MiniCart')\"";
5145 id = "miniCartTrigger";
5146 }
5147 <li class="menu__item menu__item--horizontal menu__item--icon @liClasses dw-mod" id="@id" @mouseEvent>
5148 @RenderBlockList(subBlocks)
5149 </li>
5150 }
51515152 @helper RenderMiniCartTriggerLabel()
5153 {
5154 int cartPageId = GetPageIdByNavigationTag("CartPage");
5155 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart";
5156 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5157 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5158 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
51595160 <div class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')" title="@Translate("Cart")">
5161 <div class="u-inline u-position-relative">
5162 <i class="@cartIcon fa-1_5x"></i>
5163 @RenderMiniCartCounter()
5164 </div>
5165 </div>
5166 }
51675168 @helper RenderMiniCartTriggerLink()
5169 {
5170 int cartPageId = GetPageIdByNavigationTag("CartPage");
5171 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart";
5172 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5173 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
51745175 <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button" title="@Translate("Cart")">
5176 <span class="u-inline u-position-relative">
5177 <i class="@cartIcon fa-1_5x"></i>
5178 @RenderMiniCartCounter()
5179 </span>
5180 </a>
5181 }
51825183 @helper RenderMiniCartCounter()
5184 {
5185 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5186 string cartProductsCount = Model.Cart.TotalProductsCount.ToString();
5187 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";
5188 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice");
5189 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : "";
5190 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : "";
51915192 if (showPrice && counterPosition == "right")
5193 {
5194 cartProductsCount = Translate("Cart") + " (" + cartProductsCount + ")";
5195 }
51965197 <span class="mini-cart__counter @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod">
5198 <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">
5199 <span class="js-mini-cart-counter-content" data-count="@Model.Cart.TotalProductsCount.ToString()">
5200 @cartProductsCount @cartProductsTotalPrice
5201 </span>
5202 </span>
5203 </span>
5204 }
52055206 @helper RenderMiniCartCounterContent()
5207 {
5208 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice");
5209 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";
5210 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice;
52115212 <script id="MiniCartCounterContent" type="text/x-template">
5213 {{#.}}
5214 <span class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}">
5215 @if (showPriceInMiniCartCounter)
5216 {
5217 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text>
5218 }
5219 else
5220 {
5221 <text>{{numberofproducts}}</text>
5222 }
5223 </span>
5224 {{/.}}
5225 </script>
5226 }
52275228 @helper RenderMiniCartDropdownLayout()
5229 {
5230 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5231 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");
52325233 <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">
5234 <div class="mini-cart-dropdown__inner dw-mod">
5235 <h3 class="u-ta-center dw-mod">@Translate("Shopping cart")</h3>
5236 <div class="mini-cart-dropdown__body u-flex dw-mod">
5237 <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>
5238 </div>
5239 </div>
5240 </div>
5241 }
52425243 @helper RenderMiniCartPanelLayout()
5244 {
5245 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5246 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");
52475248 <div class="mini-cart grid__cell dw-mod">
5249 <input type="checkbox" id="miniCartTrigger" class="panel-trigger" />
5250 <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">
5251 <label for="miniCartTrigger" class="panel__close-btn" title="@Translate("Close panel")"><i class="fas fa-times"></i></label>
5252 <div class="panel__content u-full-width dw-mod">
5253 <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3>
5254 <div class="panel__content-body panel__content-body--cart dw-mod">
5255 <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>
5256 </div>
5257 </div>
5258 </div>
5259 </div>
5260 }
52615262 @helper RenderMiniCartModalLayout()
5263 {
5264 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5265 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");
52665267 <div class="mini-cart grid__cell dw-mod">
5268 <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" />
5269 <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink">
5270 <label for="miniCartTrigger" class="modal-overlay"></label>
5271 <div class="modal modal--md modal--top-right dw-mod">
5272 <div class="modal__body u-flex grid--direction-column dw-mod">
5273 <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3>
5274 <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>
5275 </div>
5276 <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label>
5277 </div>
5278 </div>
5279 </div>
5280 }
5281 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
52825283 @using System
5284 @using System.Web
5285 @using Dynamicweb.Rapido.Blocks.Extensibility
5286 @using Dynamicweb.Rapido.Blocks
52875288 @{
5289 bool showOrderDraftLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOrderDraftIcon");
52905291 Block masterDesktopActionsMenuOrderDraft = new Block
5292 {
5293 Id = "MasterDesktopActionsMenuOrderDraft",
5294 SortId = 40,
5295 Template = RenderOrderDraft()
5296 };
52975298 if (showOrderDraftLink && Model.CurrentUser.ID > 0)
5299 {
5300 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuOrderDraft);
5301 }
5302 }
53035304 @helper RenderOrderDraft()
5305 {
5306 int OrderDraftPageId = GetPageIdByNavigationTag("OrderDraft");
5307 string OrderDraftPageLink = "/Default.aspx?ID=" + OrderDraftPageId;
5308 string draftIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon").SelectedValue : "fa fa-clipboard";
530953105311 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5312 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
5313 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
53145315 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod">
5316 <a href="@OrderDraftPageLink" class="@menuLinkClass dw-mod" title="@Translate("My order drafts")">
5317 <span class="u-inline u-position-relative">
5318 <i class="@draftIcon fa-1_5x"></i>
5319 </span>
5320 </a>
5321 </li>
5322 }
5323 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
53245325 @using System
5326 @using System.Web
5327 @using Dynamicweb.Rapido.Blocks.Extensibility
5328 @using Dynamicweb.Rapido.Blocks
53295330 @{
5331 bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart");
53325333 Block masterDesktopActionsMenuDownloadCart = new Block
5334 {
5335 Id = "MasterDesktopActionsMenuDownloadCart",
5336 SortId = 50,
5337 Template = RenderDownloadCart()
5338 };
53395340 if (showDownloadCartLink && Model.CurrentUser.ID > 0)
5341 {
5342 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuDownloadCart);
5343 }
5344 }
53455346 @helper RenderDownloadCart()
5347 {
5348 int downloadCartPageId = GetPageIdByNavigationTag("DownloadCart");
5349 string downloadCartPageLink = "/Default.aspx?ID=" + downloadCartPageId;
53505351 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5352 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
5353 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5354 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";
53555356 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod">
5357 <a href="@downloadCartPageLink" class="@menuLinkClass dw-mod" title="@Translate("Download cart")">
5358 <span class="u-inline u-position-relative">
5359 <i class="fas fa-cart-arrow-down fa-1_5x"></i>
5360 <span class="mini-cart__counter u-hidden @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod js-download-cart-counter"></span>
5361 </span>
5362 </a>
5363 </li>
5364 }
5365 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
53665367 @using System
5368 @using System.Web
5369 @using Dynamicweb.Rapido.Blocks.Extensibility
5370 @using Dynamicweb.Rapido.Blocks
53715372 @functions {
5373 public class SearchConfiguration
5374 {
5375 public string searchFeedId { get; set; }
5376 public string searchSecondFeedId { get; set; }
5377 public string searchBlogFeedId { get; set; }
5378 public int groupsFeedId { get; set; }
5379 public string resultPageLink { get; set; }
5380 public string searchPlaceholder { get; set; }
5381 public string searchType { get; set; }
5382 public string searchTemplate { get; set; }
5383 public string searchBlogTemplate { get; set; }
5384 public string searchContentTemplate { get; set; }
5385 public string searchValue { get; set; }
5386 public bool showGroups { get; set; }
53875388 public SearchConfiguration()
5389 {
5390 searchFeedId = "";
5391 searchSecondFeedId = "";
5392 searchBlogFeedId = "";
5393 searchType = "product-search";
5394 searchContentTemplate = "";
5395 searchBlogTemplate = "";
5396 showGroups = true;
5397 }
5398 }
5399 }
5400 @{
5401 Block masterSearchBar = new Block
5402 {
5403 Id = "MasterSearchBar",
5404 SortId = 40,
5405 Template = RenderSearch("bar"),
5406 Design = new Design
5407 {
5408 Size = "auto",
5409 HidePadding = true,
5410 RenderType = RenderType.Column
5411 }
5412 };
54135414 Block masterSearchAction = new Block
5415 {
5416 Id = "MasterDesktopActionsMenuSearch",
5417 SortId = 10,
5418 Template = RenderSearch()
5419 };
54205421 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar);
5422 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction);
5423 }
54245425 @helper RenderSearch(string type = "mini-search")
5426 {
5427 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage"));
5428 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;
5429 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch";
54305431 SearchConfiguration searchConfiguration = null;
54325433 switch (searchType) {
5434 case "contentSearch":
5435 searchConfiguration = new SearchConfiguration() {
5436 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true",
5437 resultPageLink = contentSearchPageLink,
5438 searchPlaceholder = Translate("Search page"),
5439 groupsFeedId = 0,
5440 searchType = "content-search",
5441 searchTemplate = "SearchPagesTemplate",
5442 showGroups = false
5443 };
5444 break;
5445 case "combinedSearch":
5446 searchConfiguration = new SearchConfiguration() {
5447 searchFeedId = productsPageId + "&feed=true",
5448 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true",
5449 searchBlogFeedId = GetPageIdByNavigationTag("BlogSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true",
5450 resultPageLink = Converter.ToString(productsPageId),
5451 searchPlaceholder = Translate("Search products or pages"),
5452 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"),
5453 searchType = "combined-search",
5454 searchTemplate = "SearchProductsTemplateWrap",
5455 searchContentTemplate = "SearchPagesTemplateWrap",
5456 searchBlogTemplate = "SearchBlogTemplateWrap",
5457 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector")
5458 };
5459 break;
5460 default: //productSearch
5461 searchConfiguration = new SearchConfiguration() {
5462 resultPageLink = Converter.ToString(productsPageId),
5463 searchFeedId = productsPageId + "&feed=true",
5464 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"),
5465 searchPlaceholder = Translate("Search products"),
5466 searchTemplate = "SearchProductsTemplate",
5467 searchType = "product-search",
5468 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector")
5469 };
5470 break;
5471 }
5472 searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? "";
54735474 if (type == "mini-search") {
5475 @RenderMiniSearch(searchConfiguration)
5476 } else {
5477 @RenderSearchBar(searchConfiguration)
5478 }
5479 }
54805481 @helper RenderSearchBar(SearchConfiguration options)
5482 {
5483 <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar"
5484 data-page-size="7"
5485 data-search-feed-id="@options.searchFeedId"
5486 data-search-second-feed-id="@options.searchSecondFeedId"
5487 data-search-blog-feed-id="@options.searchBlogFeedId"
5488 data-result-page-id="@options.resultPageLink"
5489 data-groups-page-id="@options.groupsFeedId"
5490 data-search-type="@options.searchType">
5491 @if (options.showGroups)
5492 {
5493 <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>
5494 <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>
5495 }
5496 <div class="typeahead-search-field">
5497 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue">
5498 @if (string.IsNullOrEmpty(options.searchSecondFeedId))
5499 {
5500 <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>
5501 }
5502 else
5503 {
5504 <div class="dropdown dropdown--absolute-position dropdown--combined grid">
5505 <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>
5506 <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>
5507 </div>
5508 }
5509 </div>
5510 <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>
5511 </div>
5512 }
55135514 @helper RenderMiniSearch(SearchConfiguration options)
5515 {
5516 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5517 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
55185519 <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">
5520 <div onclick="toggleSearchBar()" class="@menuLinkClass dw-mod" title="@Translate("Search")" id="search-button-nav">
5521 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i>
5522 </div>
55235524 <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod search-bar" id="search-bar">
5525 <div class="typeahead js-typeahead" id="ProductSearchBar"
5526 data-page-size="7"
5527 data-search-feed-id="@options.searchFeedId"
5528 data-search-second-feed-id="@options.searchSecondFeedId"
5529 data-search-blog-feed-id="@options.searchBlogFeedId"
5530 data-result-page-id="@options.resultPageLink"
5531 data-search-type="@options.searchType">
5532 <div class="typeahead-search-field">
5533 <div class="input-container">
5534 <i class="fal fa-search"></i>
5535 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue" autocomplete="off">
5536 </div>
55375538 <i onclick="toggleSearchBar()" class="fa-times fas close-search-bar"></i>
5539 </div>
55405541 <div class="typeahead-search-result">
5542 <div class="dropdown">
5543 <div class="js-handlebars-root js-typeahead-search-content" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></div>
5544 <div class="js-handlebars-root js-typeahead-blog-search-content" id="BlogSearchBarContent" data-template="@options.searchBlogTemplate" data-json-feed="/Default.aspx?ID=@options.searchBlogFeedId" data-init-onload="false"></div>
5545 <div class="js-handlebars-root js-typeahead-additional-search-content" id="ContentSearchBarContent" data-template="@options.searchContentTemplate" data-json-feed="/Default.aspx?ID=@options.searchSecondFeedId" data-init-onload="false"></div>
5546 </div>
5547 </div>
5548 </div>
5549 </div>
5550 </li>
5551 }
5552 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
55535554 @using System
5555 @using System.Web
5556 @using Dynamicweb.Rapido.Blocks.Extensibility
5557 @using Dynamicweb.Rapido.Blocks
55585559 @{
5560 string headerConfigurationTopLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5561 bool headerConfigurationHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");
55625563 BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master");
55645565 Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo");
5566 headerConfigurationPage.RemoveBlock(configDesktopLogo);
55675568 Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu");
5569 headerConfigurationPage.RemoveBlock(configDesktopMenu);
55705571 Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar");
5572 headerConfigurationPage.RemoveBlock(configSearchBar);
55735574 Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch");
5575 headerConfigurationPage.RemoveBlock(configSearchAction);
55765577 Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu");
5578 headerConfigurationPage.RemoveBlock(configDesktopActionsMenu);
55795580 Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra");
55815582 switch (headerConfigurationTopLayout)
5583 {
5584 case "condensed": //2
5585 configDesktopLogo.Design.Size = "auto-width";
5586 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
55875588 configDesktopMenu.SortId = 20;
5589 configDesktopMenu.Design.Size = "auto";
5590 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
55915592 configDesktopActionsMenu.SortId = 30;
5593 configDesktopActionsMenu.Design.Size = "auto-width";
5594 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
55955596 if (!headerConfigurationHideSearch)
5597 {
5598 configSearchBar.SortId = 40;
5599 configSearchBar.Design.Size = "12";
5600 configDesktopExtra.SortId = 50;
5601 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);
5602 }
5603 break;
5604 case "splitted": //3
5605 configDesktopLogo.Design.Size = "auto";
5606 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
56075608 if (!headerConfigurationHideSearch)
5609 {
5610 configSearchBar.SortId = 20;
5611 configSearchBar.Design.Size = "auto";
5612 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);
5613 }
56145615 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
56165617 configDesktopActionsMenu.SortId = 20;
5618 configDesktopActionsMenu.Design.Size = "auto-width";
5619 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
5620 break;
5621 case "splitted-center": //4
5622 configDesktopLogo.Design.Size = "auto";
5623 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
5624 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
56255626 configDesktopActionsMenu.SortId = 30;
5627 configDesktopActionsMenu.Design.Size = "auto-width";
5628 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu);
56295630 if (!headerConfigurationHideSearch)
5631 {
5632 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
5633 }
5634 break;
5635 case "minimal": //5
5636 configDesktopLogo.Design.Size = "auto-width";
5637 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
56385639 configDesktopMenu.Design.Size = "auto";
5640 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
56415642 configDesktopActionsMenu.SortId = 20;
5643 configDesktopActionsMenu.Design.Size = "auto-width";
5644 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
56455646 if (!headerConfigurationHideSearch)
5647 {
5648 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
5649 }
5650 break;
5651 case "minimal-center": //6
5652 configDesktopLogo.Design.Size = "auto-width";
5653 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
56545655 configDesktopMenu.Design.Size = "auto";
5656 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
56575658 configDesktopActionsMenu.SortId = 20;
5659 configDesktopActionsMenu.Design.Size = "auto-width";
5660 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
56615662 if (!headerConfigurationHideSearch)
5663 {
5664 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
5665 }
5666 break;
5667 case "minimal-right": //7
5668 configDesktopLogo.Design.Size = "auto-width";
5669 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
56705671 configDesktopMenu.Design.Size = "auto";
5672 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
56735674 configDesktopActionsMenu.SortId = 20;
5675 configDesktopActionsMenu.Design.Size = "auto-width";
5676 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
56775678 if (!headerConfigurationHideSearch)
5679 {
5680 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
5681 }
5682 break;
5683 case "two-lines": //8
5684 configDesktopLogo.Design.Size = "auto";
5685 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
56865687 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
56885689 configDesktopActionsMenu.SortId = 20;
5690 configDesktopActionsMenu.Design.Size = "auto-width";
5691 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
56925693 if (!headerConfigurationHideSearch)
5694 {
5695 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
5696 }
5697 break;
5698 case "two-lines-centered": //9
5699 configDesktopLogo.Design.Size = "auto";
5700 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
57015702 configDesktopMenu.Design.Size = "auto-width";
5703 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
57045705 configDesktopActionsMenu.SortId = 20;
5706 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
57075708 if (!headerConfigurationHideSearch)
5709 {
5710 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
5711 }
5712 break;
5713 case "normal": //1
5714 default:
5715 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
57165717 if (!headerConfigurationHideSearch)
5718 {
5719 configSearchBar.SortId = 20;
5720 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);
5721 }
57225723 configDesktopActionsMenu.SortId = 30;
5724 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu);
57255726 configDesktopActionsMenu.Design.Size = "auto-width";
5727 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
5728 break;
5729 }
5730 }
5731 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
57325733 @using System
5734 @using System.Web
5735 @using Dynamicweb.Rapido.Blocks.Extensibility
5736 @using Dynamicweb.Rapido.Blocks
57375738 @{
57395740 }
574157425743 @helper RenderDesktopTools()
5744 {
5745 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList();
57465747 <div class="tools-navigation dw-mod">
5748 <div class="center-container grid top-container__center-container dw-mod">
5749 @RenderBlockList(subBlocks)
5750 </div>
5751 </div>
5752 }
57535754 @helper RenderDesktopToolsText()
5755 {
5756 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText");
5757 if (!string.IsNullOrEmpty(toolsText))
5758 {
5759 <div class="u-margin-top u-margin-bottom">@toolsText</div>
5760 }
5761 }
57625763 @helper RenderDesktopToolsNavigation()
5764 {
5765 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");
57665767 if (renderPagesInToolBar)
5768 {
5769 @RenderNavigation(new
5770 {
5771 id = "topToolsNavigation",
5772 cssclass = "menu menu-tools dw-mod dwnavigation",
5773 template = "TopMenu.xslt"
5774 })
5775 }
5776 }
57775778 @helper RenderDesktopNavigation()
5779 {
5780 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList();
5781 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5782 string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : "";
5783 <nav class="main-navigation dw-mod">
5784 <div class="center-container top-container__center-container grid @alignClass dw-mod">
5785 @RenderBlockList(subBlocks)
5786 </div>
57875788 @* ---------- Breadcrumb ---------- *@
5789 @{
5790 Dynamicweb.Content.PageService ps = new Dynamicweb.Content.PageService();
5791 Dynamicweb.Content.Page startPage = ps.GetFirstPageForArea(Pageview.AreaID);
5792 if (startPage.ID != Pageview.Page.ID)
5793 {
5794 var navigationSettings = new NavigationSettings();
5795 navigationSettings.ExpandMode = ExpandMode.PathOnly;
5796 @Navigation.RenderNavigation("Navigation/Breadcrumbs.cshtml", navigationSettings)
5797 }
5798 }
57995800 </nav>
5801 }
58025803 @helper RenderDesktopExtra()
5804 {
5805 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList();
58065807 if (subBlocks.Count > 0)
5808 {
5809 <div class="header header-top dw-mod">
5810 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod">
5811 @RenderBlockList(subBlocks)
5812 </div>
5813 </div>
5814 }
5815 }</text>
5816 }
58175818 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
58195820 @using System
5821 @using System.Web
5822 @using Dynamicweb.Rapido.Blocks.Extensibility
5823 @using Dynamicweb.Rapido.Blocks
5824 @using Dynamicweb.Rapido.Blocks.Components.General
5825 @using Dynamicweb.Frontend
58265827 @functions {
5828 int impersonationPageId;
5829 string impersonationLayout;
5830 int impersonationFeed;
5831 Block impersonationBar;
58325833 string getUserNameFromParams(string firstName, string middleName, string lastName, string name, string email, string userName)
5834 {
5835 string username = "";
58365837 if (!string.IsNullOrEmpty(firstName) && !string.IsNullOrEmpty(lastName))
5838 {
5839 username = firstName + " " + (!string.IsNullOrEmpty(middleName) ? middleName + " " : "") + lastName;
5840 }
5841 else if (!string.IsNullOrEmpty(name))
5842 {
5843 username = name;
5844 }
5845 else if (!string.IsNullOrEmpty(email))
5846 {
5847 username = email;
5848 }
5849 else
5850 {
5851 username = userName;
5852 }
5853 return username;
5854 }
58555856 string getUserName(UserViewModel user)
5857 {
5858 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName);
5859 }
58605861 string getUserName(Dynamicweb.Security.UserManagement.User user)
5862 {
5863 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName);
5864 }
5865 }
58665867 @{
5868 impersonationPageId = GetPageIdByNavigationTag("Impersonation");
5869 impersonationLayout = Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout") != null ? Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout").SelectedValue : "bar";
5870 impersonationFeed = GetPageIdByNavigationTag("UsersFeed");
58715872 /*
5873 Capo fix för extremt trögt login för user med många secondary users som denne kan göra impersonte på. I Rapido används metod Model.SecondaryUsers.Count som orsakar en SELECT * FROM [AccessUserAddress] för varje
5874 impersonate user och extremt slö prestnada / application crash på tex Blinkfyarar. Workaround med annan metod att kontrollera om impersonateBar ska synas eller inte.
5875 */
5876 bool canImpersonate = Pageview.User != null ? Pageview.User.CanImpersonate() || (Pageview.User.CurrentSecondaryUser != null && Pageview.User.CurrentSecondaryUser.ID > 0) : false;
5877 if (Model.CurrentUser.ID > 0 && canImpersonate)
5878 //if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0)
5879 {
5880 impersonationBar = new Block
5881 {
5882 Id = "ImpersonationBar",
5883 SortId = 50,
5884 Template = RenderImpersonation(),
5885 SkipRenderBlocksList = true,
5886 Design = new Design
5887 {
5888 Size = "auto-width",
5889 HidePadding = true,
5890 RenderType = RenderType.Column
5891 }
5892 };
58935894 if (impersonationLayout == "top-bar") {
5895 impersonationBar.SortId = 9;
5896 }
58975898 Block impersonationContent = new Block
5899 {
5900 Id = "ImpersonationContent",
5901 SortId = 20
5902 };
59035904 if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0)
5905 {
5906 //Render stop impersonation view
5907 impersonationContent.Template = RenderStopImpersonationView();
590859095910 Modal stopImpersonation = new Modal
5911 {
5912 Id = "StopImpersonation",
5913 Heading = new Heading {
5914 Level = 2,
5915 Title = Translate("Sign out"),
5916 Icon = new Icon {
5917 Name = "fa-sign-out",
5918 Prefix = "fas",
5919 LabelPosition = IconLabelPosition.After
5920 }
5921 },
5922 Width = ModalWidth.Sm,
5923 BodyTemplate = RenderStopImpersonationForm()
5924 };
59255926 Block stopImpersonationBlock = new Block
5927 {
5928 Id = "StopImpersonationBlock",
5929 SortId = 10,
5930 Component = stopImpersonation
5931 };
5932 impersonationBar.BlocksList.Add(stopImpersonationBlock);
5933 }
5934 else
5935 {
5936 //Render main view
5937 switch (impersonationLayout)
5938 {
5939 case "right-lower-box":
5940 impersonationContent.BlocksList.Add(
5941 new Block {
5942 Id = "RightLowerBoxHeader",
5943 SortId = 10,
5944 Component = new Heading {
5945 Level = 5,
5946 Title = Translate("View the list of users you can sign in as"),
5947 CssClass = "impersonation-text"
5948 }
5949 }
5950 );
5951 impersonationContent.BlocksList.Add(
5952 new Block {
5953 Id = "RightLowerBoxContent",
5954 SortId = 20,
5955 Template = RenderImpersonationControls()
5956 }
5957 );
5958 break;
5959 case "right-lower-bar":
5960 impersonationContent.BlocksList.Add(
5961 new Block {
5962 Id = "RightLowerBarContent",
5963 SortId = 10,
5964 Template = RenderImpersonationControls()
5965 }
5966 );
5967 break;
5968 case "bar":
5969 default:
5970 impersonationContent.BlocksList.Add(
5971 new Block {
5972 Id = "ViewListLink",
5973 SortId = 20,
5974 Template = RenderViewListLink()
5975 }
5976 );
5977 impersonationContent.BlocksList.Add(
5978 new Block {
5979 Id = "BarTypeaheadSearch",
5980 SortId = 30,
5981 Template = RenderTypeaheadSearch()
5982 }
5983 );
5984 break;
5985 }
5986 }
5987 impersonationBar.BlocksList.Add(impersonationContent);
59885989 impersonationBar.BlocksList.Add(
5990 new Block
5991 {
5992 Id = "ImpersonationSearchTemplates",
5993 SortId = 30,
5994 Template = RenderSearchResultTemplate()
5995 }
5996 );
5997 if (impersonationLayout != "bar" && impersonationLayout != "top-bar")
5998 {
5999 impersonationBar.BlocksList.Add(
6000 new Block
6001 {
6002 Id = "ImpersonationSearchScripts",
6003 SortId = 40,
6004 Template = RenderSearchScripts()
6005 }
6006 );
6007 }
6008 BlocksPage.GetBlockPage("Master").Add("MasterHeader", impersonationBar);
6009 }
6010 }
60116012 @helper RenderImpersonation()
6013 {
6014 List<Block> subBlocks = impersonationBar.BlocksList.OrderBy(item => item.SortId).ToList();
6015 <input type="checkbox" class="impersonation-trigger js-remember-state" id="ImpersonationMinimizeTrigger" />
6016 <div class="impersonation impersonation--@(impersonationLayout)-layout dw-mod" id="Impersonation">
6017 @if (impersonationLayout == "right-lower-box")
6018 {
6019 @RenderRightLowerBoxHeader()
6020 }
6021 <div class="center-container top-container__center-container impersonation__container @(impersonationLayout != "bar" && impersonationLayout != "top-bar" ? "impersonation__container--box" : "") dw-mod">
6022 @*Impersonation*@
6023 @RenderBlockList(subBlocks)
6024 </div>
6025 </div>
6026 }
60276028 @helper RenderRightLowerBoxHeader()
6029 {
6030 <div class="impersonation__header dw-mod">
6031 <div class="impersonation__title">@Translate("Impersonation")</div>
6032 <label for="ImpersonationMinimizeTrigger" class="btn btn--impersonation impersonation__minimize-btn dw-mod" onclick="this.blur();">
6033 @Render(new Icon
6034 {
6035 Prefix = "fas",
6036 Name = "fa-window-minimize"
6037 })
6038 </label>
6039 </div>
6040 }
60416042 @helper RenderStopImpersonationView()
6043 {
6044 string secondaryUserName = getUserName(Model.CurrentSecondaryUser);
6045 string userName = getUserName(Pageview.User);
6046 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> ";
6047 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;
60486049 if (impersonationLayout == "right-lower-box")
6050 {
6051 <div class="u-margin-bottom--lg u-ta-center">
6052 @impersonationText
6053 </div>
6054 <div class="u-margin-bottom--lg u-ta-center">
6055 @RenderSwitchAccountButton()
6056 </div>
6057 @RenderStopImpersonationButton()
6058 }
6059 else
6060 {
6061 <div class="grid grid--align-center impersonation__stop-wrap">
6062 <div class="impersonation-bar-item dw-mod">
6063 @impersonationText
6064 </div>
6065 <div class="impersonation-bar-item dw-mod">
6066 @RenderSwitchAccountButton()
6067 </div>
6068 <div class="impersonation-bar-item dw-mod">
6069 @RenderStopImpersonationButton()
6070 </div>
6071 </div>
6072 }
6073 }
60746075 @helper RenderSwitchAccountButton() {
6076 @Render(new Button
6077 {
6078 Href = "/Default.aspx?ID=" + impersonationPageId,
6079 ButtonType = ButtonType.Button,
6080 ButtonLayout = ButtonLayout.Clean,
6081 Title = Translate("Switch account"),
6082 Icon = new Icon {
6083 Name = "fa-users",
6084 Prefix = "fal",
6085 LabelPosition = IconLabelPosition.After
6086 },
6087 CssClass = "u-no-margin u-color-inherit"
6088 })
6089 }
60906091 @helper RenderStopImpersonationForm()
6092 {
6093 string secondaryUserName = getUserName(Model.CurrentSecondaryUser);
6094 string userName = getUserName(Pageview.User);
6095 int pageId = Model.TopPage.ID;
60966097 <form method="post" class="u-no-margin">
6098 @Render(new Button
6099 {
6100 ButtonType = ButtonType.Submit,
6101 ButtonLayout = ButtonLayout.Secondary,
6102 Title = Translate("Sign out as") + " " + userName,
6103 Href = "/Default.aspx?ID=" + impersonationPageId,
6104 CssClass = "btn--full",
6105 Name = "DwExtranetRemoveSecondaryUser"
6106 })
61076108 @Render(new Button
6109 {
6110 ButtonType = ButtonType.Submit,
6111 ButtonLayout = ButtonLayout.Secondary,
6112 Title = Translate("Sign out as") + " " + secondaryUserName,
6113 Href = "/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId,
6114 CssClass = "btn--full",
6115 Name = "DwExtranetRemoveSecondaryUser"
6116 })
6117 </form>
6118 }
61196120 @helper RenderStopImpersonationButton() {
6121 @Render(new Button
6122 {
6123 ButtonType = ButtonType.Button,
6124 ButtonLayout = ButtonLayout.Clean,
6125 Title = Translate("Sign out"),
6126 Icon = new Icon {
6127 Name = "fa-sign-out",
6128 Prefix = "fal",
6129 LabelPosition = IconLabelPosition.After
6130 },
6131 OnClick = "document.getElementById('StopImpersonationModalTrigger').checked = true",
6132 CssClass = "u-no-margin"
6133 })
6134 }
61356136 @helper RenderImpersonationControls()
6137 {
6138 <div class="impersonation__controls">
6139 @RenderViewListLink()
6140 @RenderSearchBox()
6141 </div>
6142 @RenderResultsList()
6143 }
61446145 @helper RenderViewListLink()
6146 {
6147 string title = impersonationLayout == "right-lower-box" ? Translate("View the list") : Translate("View the list of users you can sign in as");
6148 string buttonClasses = impersonationLayout == "right-lower-box" ? "impersonation__button btn btn--impersonation" : "impersonation__link impersonation__link";
61496150 @Render(new Link {
6151 ButtonLayout = ButtonLayout.None,
6152 Title = title,
6153 Href = "/Default.aspx?ID=" + impersonationPageId,
6154 CssClass = buttonClasses
6155 })
6156 }
61576158 @helper RenderSearchBox()
6159 {
6160 <div class="impersonation__search-wrap">
6161 <input placeholder="@Translate("Search users")" type="text" class="impersonation__search-field dw-mod" onkeyup="searchKeyUpHandler(event)" id="ImpersonationBoxSearchField">
6162 <div id="ImpersonationBoxSearchFind" class="impersonation__search-icon dw-mod" onclick="updateResults(document.getElementById('ImpersonationBoxSearchField').value)">
6163 <i class="fal fa-search"></i>
6164 </div>
6165 <div id="ImpersonationBoxSearchClear" class="impersonation__search-icon u-hidden dw-mod" onclick="clearResults();">
6166 <i class="fal fa-times"></i>
6167 </div>
6168 </div>
6169 }
61706171 @helper RenderTypeaheadSearch()
6172 {
6173 <div class="typeahead u-ta-right impersonation__typeahead js-typeahead dw-mod" id="ImpersonationSearchBar"
6174 data-page-size="5"
6175 data-search-feed-id="@impersonationFeed"
6176 data-result-page-id="@impersonationPageId"
6177 data-search-type="user-search"
6178 data-search-parameter-name="q">
61796180 <div class="typeahead-search-field">
6181 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" placeholder="@Translate("Search users")">
6182 <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>
6183 </div>
6184 </div>
6185 }
61866187 @helper RenderResultsList()
6188 {
6189 <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>
6190 }
61916192 @helper RenderSearchResultTemplate()
6193 {
6194 <script id="ImpersonationSearchResult" type="text/x-template">
6195 {{#.}}
6196 {{#Users}}
6197 <li class="impersonation__search-results-item impersonation-user">
6198 <form method="post" class="impersonation-user__form" name="account{{id}}">
6199 <input type="hidden" id="DWExtranetSecondaryUserSelector" name="DWExtranetSecondaryUserSelector" value="{{id}}">
6200 <div class="impersonation-user__info">
6201 <div class="impersonation-user__name">{{userName}}</div>
6202 <div class="impersonation-user__number">{{customerNumber}} {{company}}</div>
6203 </div>
6204 @Render(new Button
6205 {
6206 ButtonType = ButtonType.Submit,
6207 ButtonLayout = ButtonLayout.Secondary,
6208 Title = Translate("Sign in as"),
6209 CssClass = "btn btn--secondary impersonation-user__sign-in-btn" + (impersonationLayout != "bar" ? "" : "")
6210 })
6211 </form>
6212 </li>
6213 {{/Users}}
6214 {{#unless Users}}
6215 <li class="impersonation__search-results-item impersonation__search-results-item--not-found">
6216 @Translate("Your search gave 0 results")
6217 </li>
6218 {{/unless}}
6219 {{/.}}
6220 </script>
6221 }
62226223 @helper RenderSearchScripts()
6224 {
6225 <script>
6226 let inputDelayTimer;
6227 function searchKeyUpHandler(e) {
6228 clearTimeout(inputDelayTimer);
6229 let value = e.target.value;
6230 if (value != "") {
6231 inputDelayTimer = setTimeout(function () {
6232 updateResults(value);
6233 }, 500);
6234 } else {
6235 clearResults();
6236 }
6237 };
62386239 function updateResults(value) {
6240 if (value == "") {
6241 return null;
6242 }
6243 HandlebarsBolt.UpdateContent("ImpersonationBoxSearchResults", "/Default.aspx?ID=@impersonationFeed&q=" + value);
6244 document.getElementById("ImpersonationBoxSearchFind").classList.add("u-hidden");
6245 document.getElementById("ImpersonationBoxSearchClear").classList.remove("u-hidden");
6246 }
62476248 function clearResults() {
6249 document.getElementById("ImpersonationBoxSearchField").value = "";
6250 HandlebarsBolt.CleanContainer("ImpersonationBoxSearchResults");
6251 document.getElementById("ImpersonationBoxSearchFind").classList.remove("u-hidden");
6252 document.getElementById("ImpersonationBoxSearchClear").classList.add("u-hidden");
6253 }
6254 </script>
6255 }
6256 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
62576258 @using System
6259 @using System.Web
6260 @using System.Collections.Generic
6261 @using Dynamicweb.Rapido.Blocks.Extensibility
6262 @using Dynamicweb.Rapido.Blocks
62636264 @{
6265 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master");
6266 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table";
62676268 Block orderLines = new Block
6269 {
6270 Id = "MiniCartOrderLines",
6271 SkipRenderBlocksList = true,
6272 BlocksList = new List<Block>
6273 {
6274 new Block {
6275 Id = "MiniCartOrderLinesList",
6276 SortId = 20,
6277 Template = RenderMiniCartOrderLinesList()
6278 }
6279 }
6280 };
62816282 Block orderlinesScriptTemplates = new Block
6283 {
6284 Id = "OrderlinesScriptTemplates"
6285 };
62866287 if (orderlinesView == "table")
6288 {
6289 orderLines.Template = RenderMiniCartOrderLinesTable();
6290 orderLines.BlocksList.Add(
6291 new Block
6292 {
6293 Id = "MiniCartOrderlinesTableHeader",
6294 SortId = 10,
6295 Template = RenderMiniCartOrderLinesHeader()
6296 }
6297 );
62986299 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates();
6300 }
6301 else
6302 {
6303 orderLines.Template = RenderMiniCartOrderLinesBlocks();
6304 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates();
6305 }
63066307 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates);
63086309 Block miniCartScriptTemplates = new Block()
6310 {
6311 Id = "MasterMiniCartTemplates",
6312 SortId = 1,
6313 Template = RenderMiniCartScriptTemplates(),
6314 SkipRenderBlocksList = true,
6315 BlocksList = new List<Block>
6316 {
6317 orderLines,
6318 new Block {
6319 Id = "MiniCartFooter",
6320 Template = RenderMiniCartFooter(),
6321 SortId = 50,
6322 SkipRenderBlocksList = true,
6323 BlocksList = new List<Block>
6324 {
6325 new Block {
6326 Id = "MiniCartSubTotal",
6327 Template = RenderMiniCartSubTotal(),
6328 SortId = 30
6329 },
6330 new Block {
6331 Id = "MiniCartFees",
6332 Template = RenderMiniCartFees(),
6333 SortId = 40
6334 },
6335 new Block {
6336 Id = "MiniCartPoints",
6337 Template = RenderMiniCartPoints(),
6338 SortId = 50
6339 },
6340 new Block {
6341 Id = "MiniCartTotal",
6342 Template = RenderMiniCartTotal(),
6343 SortId = 60
6344 },
6345 new Block {
6346 Id = "MiniCartDisclaimer",
6347 Template = RenderMiniCartDisclaimer(),
6348 SortId = 70
6349 },
6350 new Block {
6351 Id = "MiniCartActions",
6352 Template = RenderMiniCartActions(),
6353 SortId = 80
6354 }
6355 }
6356 }
6357 }
6358 };
63596360 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates);
6361 }
63626363 @helper RenderMiniCartScriptsTableTemplates()
6364 {
6365 <script id="MiniCartOrderline" type="text/x-template">
6366 {{#unless isEmpty}}
6367 <tr>
6368 <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>
6369 <td class="u-va-middle">
6370 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a>
6371 {{#if variantname}}
6372 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a>
6373 {{/if}}
6374 {{#if unitname}}
6375 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div>
6376 {{/if}}
6377 </td>
6378 <td class="u-ta-right u-va-middle">{{quantity}}</td>
6379 <td class="u-ta-right u-va-middle">
6380 {{#if pointsTotal}}
6381 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points")
6382 {{else}}
6383 {{totalprice}}
6384 {{/if}}
6385 </td>
6386 </tr>
6387 {{/unless}}
6388 </script>
63896390 <script id="MiniCartOrderlineDiscount" type="text/x-template">
6391 {{#unless isEmpty}}
6392 <tr class="table__row--no-border">
6393 <td class="u-w60px"> </td>
6394 <td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td>
6395 <td class="u-ta-right"> </td>
6396 <td class="u-ta-right">{{totalprice}}</td>
6397 </tr>
6398 {{/unless}}
6399 </script>
6400 }
64016402 @helper RenderMiniCartScriptsListTemplates()
6403 {
6404 int cartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
64056406 <script id="MiniCartOrderline" type="text/x-template">
6407 {{#unless isEmpty}}
6408 <div class="mini-cart-orderline grid dw-mod">
6409 <div class="grid__col-4">
6410 <a href="{{link}}" class="{{hideimage}}">
6411 <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}}">
6412 </a>
6413 </div>
6414 <div class="grid__col-8">
6415 <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>
6416 {{#if variantname}}
6417 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div>
6418 {{/if}}
6419 {{#if unitname}}
6420 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div>
6421 {{/if}}
6422 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div>
64236424 <div class="grid__cell-footer">
6425 <div class="grid__cell">
6426 <div class="u-pull--left mini-cart-orderline__price dw-mod">
6427 {{#if pointsTotal}}
6428 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points")
6429 {{else}}
6430 {{totalprice}}
6431 {{/if}}
6432 </div>
6433 <button type="button"
6434 title="@Translate("Remove orderline")"
6435 class="btn btn--clean btn--condensed u-pull--right mini-cart-orderline__remove-btn dw-mod"
6436 onclick="{{#if googleImpression}}googleImpressionRemoveFromCart({{googleImpression}});{{/if}}Cart.UpdateCart('miniCartContent', '/Default.aspx?ID=@cartFeedPageId', 'CartCmd=DelOrderLine&key={{orderLineId}}&redirect=false', true);">
6437 @Translate("Remove")
6438 </button>
6439 </div>
6440 </div>
6441 </div>
6442 </div>
6443 {{/unless}}
64446445 </script>
64466447 <script id="MiniCartOrderlineDiscount" type="text/x-template">
6448 {{#unless isEmpty}}
6449 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod">
6450 <div class="grid__col-4">
6451 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div>
6452 </div>
6453 <div class="grid__col-8">{{totalprice}}</div>
6454 </div>
6455 {{/unless}}
6456 </script>
6457 }
64586459 @helper RenderMiniCartScriptTemplates()
6460 {
6461 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList();
6462 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));
6463 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage"));
6464 bool miniCartUseGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));
64656466 <script id="MiniCartContent" type="text/x-template">
6467 {{#.}}
6468 {{#unless isEmpty}}
6469 @if (miniCartUseGoogleTagManager)
6470 {
6471 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text>
6472 }
6473 @RenderBlockList(subBlocks)
6474 {{/unless}}
6475 {{/.}}
6476 </script>
6477 }
64786479 @helper RenderMiniCartOrderLinesTable()
6480 {
6481 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList();
64826483 <div class="u-overflow-auto">
6484 <table class="table mini-cart-table dw-mod">
6485 @RenderBlockList(subBlocks)
6486 </table>
6487 </div>
6488 }
64896490 @helper RenderMiniCartOrderLinesBlocks()
6491 {
6492 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList();
64936494 <div class="u-overflow-auto">
6495 @RenderBlockList(subBlocks)
6496 </div>
6497 }
64986499 @helper RenderMiniCartOrderLinesHeader()
6500 {
6501 <thead>
6502 <tr>
6503 <td> </td>
6504 <td>@Translate("Product")</td>
6505 <td class="u-ta-right">@Translate("Qty")</td>
6506 <td class="u-ta-right" width="120">@Translate("Price")</td>
6507 </tr>
6508 </thead>
6509 }
65106511 @helper RenderMiniCartOrderLinesList()
6512 {
6513 <text>
6514 {{#OrderLines}}
6515 {{#ifCond template "===" "CartOrderline"}}
6516 {{>MiniCartOrderline}}
6517 {{/ifCond}}
6518 {{#ifCond template "===" "CartOrderlineMobile"}}
6519 {{>MiniCartOrderline}}
6520 {{/ifCond}}
6521 {{#ifCond template "===" "CartOrderlineDiscount"}}
6522 {{>MiniCartOrderlineDiscount}}
6523 {{/ifCond}}
6524 {{/OrderLines}}
6525 </text>
6526 }
65276528 @helper RenderMiniCartFees()
6529 {
6530 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
6531 if (!pointShop)
6532 {
6533 <text>
6534 {{#unless hidePaymentfee}}
6535 @*<div class="grid">
6536 <div class="grid__col-6 grid__col--bleed-y">
6537 {{paymentmethod}}
6538 </div>
6539 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{paymentfee}}</div>
6540 </div>*@
6541 {{/unless}}
6542 </text>
6543 }
6544 <text>
6545 {{#unless hideShippingfee}}
6546 <div class="grid">
6547 <div class="grid__col-6 grid__col--bleed-y">
6548 {{shippingmethod}}
6549 </div>
6550 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{shippingfee}}</div>
6551 </div>
6552 {{/unless}}
6553 </text>
6554 <text>
6555 {{#if hasTaxSettings}}
6556 <div class="grid">
6557 <div class="grid__col-6 grid__col--bleed-y">@Translate("Sales Tax")</div>
6558 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{totaltaxes}}</div>
6559 </div>
6560 {{/if}}
6561 </text>
6562 }
65636564 @helper RenderMiniCartFooter()
6565 {
6566 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList();
65676568 <div class="mini-cart__footer u-border-top u-padding-top dw-mod">
6569 @RenderBlockList(subBlocks)
6570 </div>
6571 }
65726573 @helper RenderMiniCartActions()
6574 {
6575 int cartPageId = GetPageIdByNavigationTag("CartPage");
6576 string confirmMessage = @Translate("Empty cart");
6577657865796580 <!-- <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> -->
6581 <a
6582 onclick="RememberState.SetCookie('useAnotherAddress', '', {'max-age': -1});"
6583 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>
6584 <button type="button" title="@Translate("Empty cart")" class="empty-cart mini btn u-no-margin u-margin-bottom" onclick="confirmEmptyCart('@confirmMessage')">@Translate("Empty cart")</button>
6585 }
65866587 @helper RenderMiniCartPoints()
6588 {
6589 <text>
6590 {{#if earnings}}
6591 <div class="grid">
6592 <div class="grid__col-6 grid__col--bleed-y">@Translate("Earnings")</div>
6593 <div class="grid__col-6 grid__col--bleed-y grid--align-end">
6594 <div>
6595 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points")
6596 </div>
6597 </div>
6598 </div>
6599 {{/if}}
6600 </text>
6601 }
66026603 @helper RenderMiniCartSubTotal()
6604 {
6605 bool hasTaxSettings = Dynamicweb.Rapido.Services.Countries.HasTaxSettings(Model.Cart.ID);
6606 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
6607 if (!pointShop)
6608 {
6609 <text>
6610 {{#unless hideShippingfee}}
6611 {{#unless hideFreeShippingText}}
6612 <div class="dw-mod u-border-bottom"><h5 class="u-ta-center">@Translate("FreeshippingLimit-A", "Du är") {{freeShippingBalance}} @Translate("FreeshippingLimit-B", "kronor från att få din order fraktfri.")</h5></div>
6613 {{/unless}}
6614 {{/unless}}
6615 </text>
6616 <text>
6617 {{#unless hideSubTotal}}
6618 <div class="grid dw-mod u-bold">
6619 <div class="grid__col-6 grid__col--bleed-y">@Translate("Subtotal")</div>
6620 <div class="grid__col-6 grid__col--bleed-y grid--align-end">
6621 @if (hasTaxSettings)
6622 {
6623 <text>{{subtotalpricewithouttaxes}}</text>
6624 }
6625 else
6626 {
6627 <text>{{subtotalprice}}</text>
6628 }
6629 </div>
6630 </div>
6631 {{/unless}}
6632 </text>
6633 }
6634 }
66356636 @helper RenderMiniCartTotal()
6637 {
6638 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
66396640 <div class="mini-cart-totals grid u-border-top u-margin-top dw-mod">
6641 <div class="grid__col-6">@Translate("Total")</div>
6642 <div class="grid__col-6 grid--align-end">
6643 <div>
6644 @if (pointShop)
6645 {
6646 <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points")
6647 }
6648 else
6649 {
6650 <text>{{totalprice}}</text>
6651 }
6652 </div>
6653 </div>
6654 </div>
6655 }
66566657 @helper RenderMiniCartDisclaimer()
6658 {
6659 <text>
6660 {{#if showCheckoutDisclaimer}}
6661 <div class="grid u-margin-bottom u-ta-right">
6662 <small class="grid__col-12">{{checkoutDisclaimer}}</small>
6663 </div>
6664 {{/if}}
6665 </text>
6666 }
6667 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
66686669 @using Dynamicweb.Rapido.Blocks.Extensibility
6670 @using Dynamicweb.Rapido.Blocks
6671 @using Dynamicweb.Rapido.Blocks.Components.General
6672 @using Dynamicweb.Rapido.Blocks.Components
6673 @using Dynamicweb.Rapido.Services
66746675 @{
6676 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : "";
6677 string addToCartNotificationMiniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown";
6678 bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart");
66796680 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !string.IsNullOrEmpty(addToCartNotificationType))
6681 {
6682 if (addToCartNotificationType == "modal")
6683 {
6684 Block addToCartNotificationModal = new Block
6685 {
6686 Id = "AddToCartNotificationModal",
6687 Template = RenderAddToCartNotificationModal()
6688 };
66896690 Block addToCartNotificationScript = new Block
6691 {
6692 Id = "AddToCartNotificationScript",
6693 Template = RenderAddToCartNotificationModalScript()
6694 };
6695 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal);
6696 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript);
6697 }
6698 else if (addToCartNotificationType == "toggle" && addToCartNotificationMiniCartLayout != "none" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
6699 {
6700 Block addToCartNotificationScript = new Block
6701 {
6702 Id = "AddToCartNotificationScript",
6703 Template = RenderAddToCartNotificationToggleScript()
6704 };
6705 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript);
6706 }
6707 }
6708 }
67096710 @helper RenderAddToCartNotificationModal()
6711 {
6712 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div>
6713 }
67146715 @helper RenderAddToCartNotificationModalScript()
6716 {
6717 int cartPageId = GetPageIdByNavigationTag("CartPage");
67186719 <script id="LastAddedProductTemplate" type="text/x-template">
6720 @{
67216722 Modal lastAddedProduct = new Modal
6723 {
6724 Id = "LastAddedProduct",
6725 Heading = new Heading
6726 {
6727 Level = 2,
6728 Title = Translate("Product is added to the cart")
6729 },
6730 Width = ModalWidth.Md,
6731 BodyTemplate = RenderModalContent()
6732 };
67336734 lastAddedProduct.AddActions(
6735 new Button
6736 {
6737 ButtonType = ButtonType.Button,
6738 ButtonLayout = ButtonLayout.Secondary,
6739 Title = Translate("Continue shopping"),
6740 CssClass = "u-pull--left u-no-margin btn--sm",
6741 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false"
6742 },
6743 new Link
6744 {
6745 Href = "/Default.aspx?ID=" + cartPageId,
6746 ButtonLayout = ButtonLayout.Secondary,
6747 CssClass = "u-pull--right u-no-margin btn--sm",
6748 Title = Translate("Proceed to checkout"),
6749 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false"
6750 }
6751 );
67526753 @Render(lastAddedProduct)
6754 }
6755 </script>
6756 <script>
6757 document.addEventListener('addToCart', function (event) {
6758 Cart.ShowLastAddedProductModal(event.detail);
6759 });
6760 </script>
6761 }
67626763 @helper RenderModalContent()
6764 {
6765 <div class="grid">
6766 <div class="grid__col-2">
6767 @Render(new Image { Path = "{{ productInfo.image }}", Link = "{{ productInfo.link }}", Title = "{{ productInfo.name }}", DisableImageEngine = true })
6768 </div>
6769 <div class="u-padding grid--align-self-center">
6770 <span>{{quantity}}</span> x
6771 </div>
6772 <div class="grid__col-auto grid--align-self-center">
6773 <div>{{productInfo.name}}</div>
6774 {{#if productInfo.variantName}}
6775 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small>
6776 {{/if}}
6777 {{#if productInfo.unitName}}
6778 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small>
6779 {{/if}}
6780 </div>
6781 </div>
6782 }
67836784 @helper RenderAddToCartNotificationToggleScript()
6785 {
6786 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
67876788 <script>
6789 document.addEventListener('addToCart', function () {
6790 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId');
6791 });
6792 </script>
6793 }
6794 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
67956796 @using System
6797 @using System.Web
6798 @using System.Collections.Generic
6799 @using Dynamicweb.Admin
6800 @using Dynamicweb.Ecommerce.Frontend
6801 @using Dynamicweb.Frontend
6802 @using Dynamicweb.Rapido.Blocks.Extensibility
6803 @using Dynamicweb.Rapido.Blocks
6804 @using Dynamicweb.Rapido.Blocks.Components.General
6805 @using Renderer = Dynamicweb.Forms.Renderer
68066807 @functions {
6808 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master");
6809 }
68106811 @{
6812 //string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("BrandsLIstFooter").GetString("Content");
6813 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content");
6814 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content");
6815 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header");
6816 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header");
6817 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header");
6818 var count = 0;
6819 Block masterFooterContent = new Block()
6820 {
6821 Id = "MasterFooterContent",
6822 SortId = 10,
6823 Template = RenderFooter(),
6824 SkipRenderBlocksList = true
6825 };
68266827 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent);
6828 if (!string.IsNullOrEmpty(footerColumnOneHeader))
6829 {
6830 Block masterFooterColumnOne = new Block
6831 {
6832 Id = "MasterFooterColumnOne",
6833 SortId = 10,
6834 Template = RenderFooterBrandLinks(footerColumnOneHeader),
6835 Design = new Design
6836 {
6837 Size = "auto",
6838 RenderType = RenderType.Column
6839 }
6840 };
6841 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne);
6842 }
68436844 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader))
6845 {
6846 Block masterFooterColumnTwo = new Block
6847 {
6848 Id = "MasterFooterColumnTwo",
6849 SortId = 20,
6850 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent),
6851 Design = new Design
6852 {
6853 Size = "auto",
6854 RenderType = RenderType.Column
6855 }
6856 };
6857 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo);
6858 }
68596860 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader))
6861 {
6862 Block masterFooterColumnThree = new Block
6863 {
6864 Id = "MasterFooterColumnThree",
6865 SortId = 30,
6866 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent),
6867 Design = new Design
6868 {
6869 Size = "auto",
6870 RenderType = RenderType.Column
6871 }
6872 };
687368746875 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree);
68766877 }
687868796880 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0)
6881 {
6882 Block masterFooterPayments = new Block
6883 {
6884 Id = "MasterFooterPayments",
6885 SortId = 60,
6886 Template = RenderFooterPayments(),
6887 Design = new Design
6888 {
6889 Size = "12",
6890 RenderType = RenderType.Column
6891 }
6892 };
6893 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments);
6894 }
68956896 Block masterFooterCopyright = new Block
6897 {
6898 Id = "MasterFooterCopyright",
6899 SortId = 70,
6900 Template = RenderFooterCopyright(),
6901 Design = new Design
6902 {
6903 Size = "12",
6904 RenderType = RenderType.Column
6905 }
6906 };
6907 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright);
6908 }
69096910 @helper RenderFooter()
6911 {
6912 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList();
69136914 <footer class="footer no-print dw-mod">
6915 <div class="center-container top-container__center-container dw-mod">
6916 <div class="grid grid--external-bleed-x">
6917 @RenderBlockList(subBlocks)
6918 </div>
6919 </div>
6920 <div id="orderitem-modal" class="orderitem-modal">
6921 <div class="orderitem-modal__container">
6922 <div class="orderitem-modal__content" id="orderitem-modal__content">
6923 <div class="orderitem-modal__header">
6924 <h3 class="p-b-5">@Translate("Notice of interest", "Send a notice of interest")</h3>
6925 <span class="close" id="orderitem-modal__close">×</span>
6926 </div>
6927 <div id="orderItemForm" class="orderitem-form">
6928 @RenderGrid(Dynamicweb.Services.Pages.GetPageByNavigationTag(PageView.Current().AreaID, "OrderItemForm").ID)
6929 </div>
6930 </div>
6931 </div>
6932 </div>
69336934 </footer>
6935 }
69366937 @helper RenderFooterColumn(string header, string content)
6938 {
69396940 <h3 class="footer__heading dw-mod">@header</h3>
6941 <div class="footer__content dw-mod">
69426943 @content
69446945 @if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0 && header == Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header"))
6946 {
6947 <h3 class="footer__heading dw-mod">@Translate("Social links")</h3>
6948 <div class="footer__content dw-mod">
6949 <div class="collection dw-mod">
6950 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks"))
6951 {
6952 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel;
6953 string socialIconClass = socialIcon.SelectedValue;
6954 string socialIconTitle = socialIcon.SelectedName;
6955 string socialLink = socialitem.GetString("Link");
69566957 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a>
6958 }
6959 </div>
6960 </div>
6961 }
6962 </div>
6963 }
696469656966 @helper RenderFooterBrandLinks(string footerColumnOneHeader)
6967 {
69686969 <style>
6970 /* logo hover efects and greyscale Can move to css*/
6971 img.flex {
6972 -webkit-filter: grayscale(100%);
6973 filter: grayscale(100%);
6974 }
6975 img.flex {
6976 display: flex;
6977 }
6978 img.flex {
6979 flex: 1;
6980 margin: 5px;
6981 width: 70px;
69826983 }
6984 img.flex:hover {
6985 filter: grayscale(0);
6986 }
6987 </style>
69886989 <h3 class="footer__heading dw-mod">@footerColumnOneHeader</h3>
6990 <div class="footer__content dw-mod">
6991 <div class="collection dw-mod">
6992 @{ var count = 0;}
6993 @foreach (var brandItem in Model.Area.Item.GetItem("Layout").GetItems("BrandsListFooter"))
6994 {
6995 count++;
69966997 var image = brandItem.GetRawValueString("Loggo");
6998 var brandText = brandItem.GetRawValueString("Text");
6999 var brandLink = brandItem.GetRawValueString("Page_Link");
70007001 <a href="@brandLink" target="_self" title="@brandText" class="u-margin-bottom-5px" rel="noopener"><img src="@image" class="flex"></a>
70027003 if (count == 6)
7004 {
7005 <br />
7006 count = 0;
7007 }
7008 }
7009 </div>
7010 @if (Model.CurrentUser.UserName != null)
7011 {
7012 <div class="footer__NewsLetterSignUp dw-mod">
7013 @if (Dynamicweb.Services.Pages.GetPageByNavigationTag(PageView.Current().AreaID, "NewsletterSignUp_Custom") != null)
7014 {
7015 @RenderGrid(Dynamicweb.Services.Pages.GetPageByNavigationTag(PageView.Current().AreaID, "NewsletterSignUp_Custom").ID)
7016 }
7017 </div>
7018 }
7019 </div>
7020 }
70217022 @helper RenderFooterPayments()
7023 {
7024 <div class="footer__content dw-mod">
7025 <div class="collection dw-mod">
7026 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments"))
7027 {
7028 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel;
7029 string paymentImage = null;
7030 string paymentTitle = paymentItem.SelectedName;
7031 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault();
7032 if (selected != null)
7033 {
7034 paymentImage = selected.Icon;
7035 }
70367037 <div class="footer__card-type">
7038 <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" />
7039 </div>
7040 }
7041 </div>
7042 </div>
7043 }
7044704570467047 @helper RenderFooterCopyright()
7048 {
7049 <div class="grid__col-12 footer__copyright dw-mod">
7050 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p>
7051 </div>
7052 }
70537054 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
70557056 @using System
7057 @using System.Web
7058 @using System.Collections.Generic
7059 @using Dynamicweb.Rapido.Blocks.Extensibility
7060 @using Dynamicweb.Rapido.Blocks
7061 @using Dynamicweb.Ecommerce.Common
70627063 @{
7064 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master");
70657066 Block masterScriptReferences = new Block()
7067 {
7068 Id = "MasterScriptReferences",
7069 SortId = 1,
7070 Template = RenderMasterScriptReferences()
7071 };
7072 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences);
7073 }
70747075 @helper RenderMasterScriptReferences() {
7076 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script>
7077 <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script>
70787079 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript"))
7080 {
7081 <script src="/Files/Templates/Designs/Rapido/js/custom.min.js"></script>
7082 PushPromise("/Files/Templates/Designs/Rapido/js/custom.min.js");
7083 }
70847085 PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js");
7086 PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js");
7087 }
7088 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
70897090 @using System
7091 @using System.Web
7092 @using System.Collections.Generic
7093 @using Dynamicweb.Rapido.Blocks.Extensibility
7094 @using Dynamicweb.Rapido.Blocks
7095 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
7096 @using Dynamicweb.Rapido.Services
70977098 @{
7099 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master");
7100 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");
7101 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID"));
71027103 if (!navigationItemsHideSearch || isFavoriteList)
7104 {
7105 Block masterSearchScriptTemplates = new Block()
7106 {
7107 Id = "MasterSearchScriptTemplates",
7108 SortId = 1,
7109 Template = RenderSearchScriptTemplates()
7110 };
71117112 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates);
7113 }
7114 }
71157116 @helper RenderSearchScriptTemplates()
7117 {
7118 int productsPageId = GetPageIdByNavigationTag("ProductsPage");
7119 int blogListPageId = GetPageIdByNavigationTag("BlogListPage");
7120 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;
7121 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID"));
7122 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID"));
7123 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults");
7124 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton");
7125 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton");
7126 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton");
7127 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
71287129 <script id="SearchGroupsTemplate" type="text/x-template">
7130 {{#.}}
7131 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li>
7132 {{/.}}
7133 </script>
71347135 <script id="SearchProductsTemplate" type="text/x-template">
7136 {{#each .}}
7137 {{#Product}}
7138 {{#ifCond template "!==" "SearchMore"}}
7139 <li class="dropdown__item dropdown__item--seperator dw-mod">
7140 @if (useFacebookPixel)
7141 {
7142 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text>
7143 }
7144 @if (useGoogleTagManager)
7145 {
7146 <text>{{{googleEnchantImpression googleImpression}}}</text>
7147 }
7148 <div>
7149 <a href="{{link}}"
7150 class="js-typeahead-link u-color-inherit u-pull--left"
7151 onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}"
7152 title="{{name}}{{#if variantName}}, {{variantName}}{{/if}}">
7153 <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=60&height=60&crop=5&FillCanvas=True&Compression=75&image={{image}}" alt="{{name}}{{#if variantName}}, {{variantName}}{{/if}}"></div>
7154 <div class="u-pull--left">
7155 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}{{#if variantName}}, {{variantName}}{{/if}}</div>
7156 @if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed())
7157 {
7158 <text>{{#unless orderItemState}}</text>
7159 if (pointShopOnly)
7160 {
7161 <text>
7162 {{#if havePointPrice}}
7163 <div>
7164 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points")
7165 </div>
7166 {{else}}
7167 <small class="help-text u-no-margin">@Translate("Not available")</small>
7168 {{/if}}
7169 {{#unless canBePurchasedWithPoints}}
7170 {{#if havePointPrice}}
7171 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small>
7172 {{/if}}
7173 {{/unless}}
7174 </text>
7175 }
7176 else
7177 {
7178 <div>{{price}}</div>
7179 }
7180 <text>{{/unless}}</text>
7181 }
7182 </div>
7183 </a>
7184 <div class="u-margin-left u-pull--right">
7185 @{
7186 var viewBtn = new Link
7187 {
7188 Href = "{{link}}",
7189 OnClick = "{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}",
7190 ButtonLayout = ButtonLayout.Secondary,
7191 CssClass = "btn--condensed u-no-margin js-ignore-click-outside",
7192 Title = Translate("View")
7193 };
7194 }
7195 @if (showAddToCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed())
7196 {
7197 <text>{{#if hideAddToCartButton}}</text>
7198 @Render(viewBtn)
7199 <text>{{else}}</text>
7200 @Render(new AddToCartButton
7201 {
7202 HideTitle = true,
7203 ProductId = "{{productId}}",
7204 ProductInfo = "{{productInfo}}",
7205 BuyForPoints = pointShopOnly,
7206 OnClick = "{{facebookPixelAction}}",
7207 CssClass = "u-w80px u-no-margin js-ignore-click-outside",
7208 Icon = new Icon {
7209 CssClass = "js-ignore-click-outside"
7210 },
7211 ExtraAttributes = new Dictionary<string, string>
7212 {
7213 { "{{disabledBuyButton}}", "" }
7214 }
7215 })
7216 <text>{{/if}}</text>
7217 }
7218 else if (showViewButton)
7219 {
7220 @Render(viewBtn)
7221 }
7222 @if (showAddToDownloadButton)
7223 {
7224 <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}}">
7225 <i class="fas fa-plus js-button-icon"></i>
7226 </button>
7227 }
7228 </div>
7229 </div>
7230 </li>
7231 {{/ifCond}}
7232 {{#ifCond template "===" "SearchMore"}}
7233 {{>SearchMoreProducts}}
7234 {{/ifCond}}
7235 {{/Product}}
7236 {{else}}
7237 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod">
7238 @Translate("Your search gave 0 results")
7239 </li>
7240 {{/each}}
7241 </script>
72427243 <script id="SearchMoreProducts" type="text/x-template">
7244 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod">
7245 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link">
7246 @Translate("View all")
7247 </a>
7248 </li>
7249 </script>
72507251 <script id="SearchMorePages" type="text/x-template">
7252 <li class="dropdown__item dropdown__item--not-selectable dw-mod">
7253 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link">
7254 @Translate("View all")
7255 </a>
7256 </li>
7257 </script>
72587259 <script id="SearchMoreBlogposts" type="text/x-template">
7260 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod">
7261 <a href="/Default.aspx?ID=@blogListPageId&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link">
7262 @Translate("View all")
7263 </a>
7264 </li>
7265 </script>
72667267 <script id="SearchPagesTemplate" type="text/x-template">
7268 {{#each .}}
7269 {{#ifCond template "!==" "SearchMore"}}
7270 <li class="dropdown__item dropdown__item--seperator dropdown__item--no-padding dw-mod">
7271 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link dropdown__link u-color-inherit">
7272 <div class="u-margin-right u-inline"><i class="fa {{icon}} u-w20px u-ta-center"></i></div>
7273 <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>
7274 </a>
7275 </li>
7276 {{/ifCond}}
7277 {{#ifCond template "===" "SearchMore"}}
7278 {{>SearchMorePages}}
7279 {{/ifCond}}
7280 {{else}}
7281 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod">
7282 @Translate("Your search gave 0 results")
7283 </li>
7284 {{/each}}
7285 </script>
72867287 <script id="SearchPagesTemplateWrap" type="text/x-template">
7288 <div class="dropdown__column-header">@Translate("Pages")</div>
7289 <ul class="dropdown__list dw-mod">
7290 {{>SearchPagesTemplate}}
7291 </ul>
7292 </script>
72937294 <script id="SearchBlogTemplate" type="text/x-template">
7295 {{#each .}}
7296 {{#ifCond template "!==" "SearchMore"}}
7297 <li class="dropdown__item dropdown__item--seperator dropdown__item--no-padding dw-mod">
7298 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link dropdown__link u-color-inherit">
7299 <div class="title">
7300 <img src="{{Imagemain}}" alt="{{name}}" loading="lazy">
7301 <span style="font-weight: bold;">{{name}}</span>
7302 </div>
73037304 <p class="intro-text">{{IntroText}}</p>
7305 </a>
7306 </li>
7307 {{/ifCond}}
73087309 {{#ifCond template "===" "SearchMore"}}
7310 {{>SearchMoreBlogposts}}
7311 {{/ifCond}}
73127313 {{else}}
7314 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod">
7315 @Translate("Your search gave 0 results")
7316 </li>
7317 {{/each}}
7318 </script>
73197320 <script id="SearchBlogTemplateWrap" type="text/x-template">
7321 <div class="dropdown__column-header">@Translate("Blog posts")</div>
7322 <ul class="dropdown__list dw-mod">
7323 {{>SearchBlogTemplate}}
7324 </ul>
7325 </script>
732673277328 <script id="SearchProductsTemplateWrap" type="text/x-template">
7329 <div class="dropdown__column-header">@Translate("Products")</div>
7330 <ul class="dropdown__list dw-mod">
7331 {{>SearchProductsTemplate}}
7332 </ul>
7333 </script>
7334 }
73357336 @using Dynamicweb.Rapido.Blocks.Components
7337 @using Dynamicweb.Rapido.Blocks.Components.General
7338 @using Dynamicweb.Rapido.Blocks
7339 @using System.IO
734073417342 @using Dynamicweb.Rapido.Blocks.Components.General
7343 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
734473457346 @* Component *@
73477348 @helper RenderVariantMatrix(VariantMatrix settings) {
7349 if (settings != null)
7350 {
7351 int productLoopCounter = 0;
7352 int groupCount = 0;
7353 List<VariantOption> firstDimension = new List<VariantOption>();
7354 List<VariantOption> secondDimension = new List<VariantOption>();
7355 List<VariantOption> thirdDimension = new List<VariantOption>();
73567357 foreach (VariantGroup variantGroup in settings.GetVariantGroups())
7358 {
7359 foreach (VariantOption variantOptions in variantGroup.GetVariantOptions())
7360 {
7361 if (groupCount == 0) {
7362 firstDimension.Add(variantOptions);
7363 }
7364 if (groupCount == 1)
7365 {
7366 secondDimension.Add(variantOptions);
7367 }
7368 if (groupCount == 2)
7369 {
7370 thirdDimension.Add(variantOptions);
7371 }
7372 }
7373 groupCount++;
7374 }
73757376 int rowCount = 0;
7377 int columnCount = 0;
73787379 <script>
7380 var variantsCollection = [];
7381 </script>
73827383 <table class="table table--compact js-variants-matrix dw-mod" id="VariantMatrixTable_@settings.ProductId">
7384 @if (groupCount == 1)
7385 {
7386 <tbody>
7387 @foreach (VariantOption firstVariantOption in firstDimension)
7388 {
7389 var variantId = firstVariantOption.Id;
7390 <tr>
7391 <td class="u-bold">
7392 @firstVariantOption.Name
7393 </td>
7394 <td>
7395 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount)
7396 </td>
7397 </tr>
7398 productLoopCounter++;
7399 }
74007401 <tr>
7402 <td> </td>
7403 <td>
7404 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div>
7405 </td>
7406 </tr>
7407 </tbody>
7408 }
7409 @if (groupCount == 2)
7410 {
7411 <thead>
7412 <tr>
7413 <td> </td>
7414 @foreach (VariantOption variant in secondDimension)
7415 {
7416 <td>@variant.Name</td>
7417 }
7418 </tr>
7419 </thead>
7420 <tbody>
7421 @foreach (VariantOption firstVariantOption in firstDimension)
7422 {
7423 string variantId = "";
7424 columnCount = 0;
74257426 <tr>
7427 <td class="u-min-w120px">@firstVariantOption.Name</td>
74287429 @foreach (VariantOption secondVariantOption in secondDimension)
7430 {
7431 variantId = firstVariantOption.Id + "." + secondVariantOption.Id;
7432 <td>
7433 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount)
7434 </td>
74357436 columnCount++;
74377438 productLoopCounter++;
7439 }
74407441 <td>
7442 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div>
7443 </td>
7444 </tr>
74457446 rowCount++;
7447 }
74487449 @{
7450 columnCount = 0;
7451 }
74527453 <tr>
7454 <td> </td>
7455 @foreach (VariantOption secondVariantOption in secondDimension)
7456 {
7457 <td>
7458 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div>
7459 </td>
74607461 columnCount++;
7462 }
7463 <td> </td>
7464 </tr>
7465 </tbody>
7466 }
7467 @if (groupCount == 3)
7468 {
7469 <thead>
7470 <tr>
7471 <td> </td>
7472 @foreach (VariantOption thirdVariantOption in thirdDimension)
7473 {
7474 <td>@thirdVariantOption.Name</td>
7475 }
7476 </tr>
7477 </thead>
7478 <tbody>
7479 @foreach (VariantOption firstVariantOption in firstDimension)
7480 {
7481 int colspan = (thirdDimension.Count + 1);
74827483 <tr>
7484 <td colspan="@colspan" class="u-color-light-gray--bg u-bold">@firstVariantOption.Name</td>
7485 </tr>
74867487 foreach (VariantOption secondVariantOption in secondDimension)
7488 {
7489 string variantId = "";
7490 columnCount = 0;
74917492 <tr>
7493 <td class="u-min-w120px">@secondVariantOption.Name</td>
74947495 @foreach (VariantOption thirdVariantOption in thirdDimension)
7496 {
7497 variantId = firstVariantOption.Id + "." + secondVariantOption.Id + "." + thirdVariantOption.Id;
74987499 <td>
7500 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount)
7501 </td>
75027503 columnCount++;
7504 productLoopCounter++;
7505 }
75067507 <td>
7508 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div>
7509 </td>
7510 </tr>
7511 rowCount++;
7512 }
7513 }
75147515 @{
7516 columnCount = 0;
7517 }
75187519 <tr>
7520 <td> </td>
7521 @foreach (VariantOption thirdVariantOption in thirdDimension)
7522 {
7523 <td>
7524 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div>
7525 </td>
75267527 columnCount++;
7528 }
7529 <td> </td>
7530 </tr>
7531 </tbody>
7532 }
7533 </table>
75347535 <script>
7536 document.addEventListener("DOMContentLoaded", function (event) {
7537 MatrixUpdateQuantity("@settings.ProductId");
7538 });
75397540 MatrixUpdateQuantity = function (productId) {
7541 var currentMatrix = document.getElementById("VariantMatrixTable_" + productId);
7542 var allQtyFields = currentMatrix.getElementsByClassName("js-qty");
75437544 var qtyRowArr = [];
7545 var qtyColumnArr = [];
75467547 var totalQty = 0;
75487549 for (var i = 0; i < allQtyFields.length; i++) {
7550 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] = 0;
7551 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] = 0;
7552 }
75537554 for (var i = 0; i < allQtyFields.length; i++) {
7555 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] += parseFloat(allQtyFields[i].value);
7556 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] += parseFloat(allQtyFields[i].value);
7557 totalQty += parseFloat(allQtyFields[i].value);
7558 }
75597560 //Update row counters
7561 for (var i = 0; i < qtyRowArr.length; i++) {
7562 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0];
75637564 if (qtyRowArr[i] != undefined && qtyCounter != null) {
7565 var currentCount = qtyCounter.innerHTML;
7566 qtyCounter.innerHTML = qtyRowArr[i];
75677568 if (currentCount != qtyCounter.innerHTML) {
7569 qtyCounter.classList.add("qty-field--active");
7570 }
7571 }
75727573 }
75747575 //Update column counters
7576 for (var i = 0; i < qtyColumnArr.length; i++) {
7577 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0];
75787579 if (qtyColumnArr[i] != undefined && qtyCounter != null) {
7580 var currentCount = qtyCounter.innerHTML;
7581 qtyCounter.innerHTML = qtyColumnArr[i];
75827583 if (currentCount != qtyCounter.innerHTML) {
7584 qtyCounter.classList.add("qty-field--active");
7585 }
7586 }
7587 }
75887589 if (document.getElementById("TotalQtyCount_" + productId)) {
7590 document.getElementById("TotalQtyCount_" + productId).innerHTML = totalQty;
7591 }
75927593 //Clean up animations
7594 setTimeout(function () {
7595 for (var i = 0; i < qtyRowArr.length; i++) {
7596 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0];
7597 if (qtyCounter != null) {
7598 qtyCounter.classList.remove("qty-field--active");
7599 }
7600 }
7601 for (var i = 0; i < qtyColumnArr.length; i++) {
7602 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0];
7603 if (qtyCounter != null) {
7604 qtyCounter.classList.remove("qty-field--active");
7605 }
7606 }
7607 }, 1000);
7608 }
7609 </script>
7610 }
7611 }
76127613 @helper RenderVariantMatrixQuantityField(string variantId, VariantMatrix settings, int productLoopCounter, int rowCount, int columnCount)
7614 {
7615 string loopCount = productLoopCounter.ToString();
76167617 bool combinationFound = false;
7618 double stock = 0;
7619 double quantityValue = 0;
7620 string note = "";
76217622 VariantProduct variantProduct = null;
76237624 if (settings.GetVariantProducts().TryGetValue(variantId, out variantProduct))
7625 {
7626 stock = variantProduct.Stock;
7627 quantityValue = variantProduct.Quantity;
7628 combinationFound = true;
7629 }
76307631 if (combinationFound)
7632 {
7633 <input type="hidden" name="ProductLoopCounter@(loopCount)" value="@loopCount" />
7634 <input type="hidden" name="ProductID@(loopCount)" value="@settings.ProductId" />
7635 <input type="hidden" name="VariantID@(loopCount)" value="@variantId" />
7636 <input type="hidden" name="CurrentNote@(loopCount)" id="CurrentNote_@(settings.ProductId)_@variantId" value="@note" />
7637 <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">
76387639 if (stock != 0)
7640 {
7641 <small>@Translate("Stock") @stock</small>
7642 }
76437644 <script>
7645 var variants = '{ "ProductId" :' + '"@settings.ProductId"' + ', "VariantId": ' + '"@variantId"' +'}';
7646 variantsCollection.push(variants);
7647 document.getElementById("Quantity_@(settings.ProductId)_@variantId").closest(".js-variants-matrix").setAttribute("data-variants-collection", "[" + variantsCollection + "]" );
7648 </script>
7649 }
7650 else
7651 {
7652 <div class="use-btn-height" style="background-color: #a8a8a8"></div>
7653 }
7654 }
7655 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
76567657 @* Component *@
76587659 @helper RenderAddToCart(AddToCart settings)
7660 {
7661 //set Id for quantity selector to get it's value from button
7662 if (settings.QuantitySelector != null)
7663 {
7664 if (string.IsNullOrEmpty(settings.QuantitySelector.Id))
7665 {
7666 settings.QuantitySelector.Id = Guid.NewGuid().ToString("N");
7667 }
76687669 settings.AddButton.QuantitySelectorId = settings.QuantitySelector.Id;
76707671 if (settings.Disabled)
7672 {
7673 settings.QuantitySelector.Disabled = true;
7674 }
76757676 if (string.IsNullOrEmpty(settings.QuantitySelector.Name))
7677 {
7678 settings.QuantitySelector.Name = settings.QuantitySelector.Id;
7679 }
7680 }
76817682 if (settings.Disabled)
7683 {
7684 settings.AddButton.Disabled = true;
7685 }
76867687 settings.AddButton.CssClass += " btn--condensed";
76887689 //unitsSelector
7690 if (settings.UnitSelector != null)
7691 {
7692 if (settings.Disabled)
7693 {
7694 settings.QuantitySelector.Disabled = true;
7695 }
7696 }
76977698 if (Pageview.Device.ToString() == "Mobile") {
7699 if (settings.UnitSelector != null)
7700 {
7701 <div class="margin-sm margin-position-bottom">
7702 @Render(settings.UnitSelector)
7703 </div>
7704 }
7705 }
77067707 <div class="buttons-collection @settings.WrapperCssClass" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
7708 @if (Pageview.Device.ToString() != "Mobile") {
7709 if (settings.UnitSelector != null)
7710 {
7711 @Render(settings.UnitSelector)
7712 }
7713 }
7714 @if (settings.QuantitySelector != null)
7715 {
7716 @Render(settings.QuantitySelector)
7717 }
7718 @Render(settings.AddButton)
7719 </div>
7720 }
7721 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
77227723 @* Component *@
77247725 @helper RenderAddToCartButton(AddToCartButton settings)
7726 {
7727 if (!settings.HideTitle)
7728 {
7729 if (string.IsNullOrEmpty(settings.Title))
7730 {
7731 if (settings.BuyForPoints)
7732 {
7733 settings.Title = Translate("Buy with points");
7734 }
7735 else
7736 {
7737 settings.Title = Translate("Add to cart");
7738 }
7739 }
7740 }
7741 else
7742 {
7743 settings.Title = "";
7744 }
77457746 if (settings.Icon == null)
7747 {
7748 settings.Icon = new Icon();
7749 settings.Icon.LabelPosition = Dynamicweb.Rapido.Blocks.Components.General.IconLabelPosition.After;
7750 }
77517752 if (string.IsNullOrEmpty(settings.Icon.Name))
7753 {
7754 settings.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue;
7755 }
77567757 settings.OnClick = "Cart.AddToCart(event, { " +
7758 "id: '" + settings.ProductId + "'," +
7759 (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") +
7760 (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") +
7761 (settings.BuyForPoints ? "buyForPoints: true," : "") +
7762 (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") +
7763 "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value)") +
7764 "});" + settings.OnClick;
77657766 @RenderButton(settings)
7767 }
7768 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
77697770 @* Component *@
77717772 @helper RenderUnitSelector(UnitSelector settings)
7773 {
7774 if (string.IsNullOrEmpty(settings.Id))
7775 {
7776 settings.Id = Guid.NewGuid().ToString("N");
7777 }
7778 var disabledClass = settings.Disabled ? "disabled" : "";
77797780 <input type="checkbox" id="@settings.Id" class="dropdown-trigger" />
7781 <div class="dropdown unit-selector @settings.CssClass @disabledClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
7782 <label class="dropdown__header dropdown__btn dropdown__btn--unit-selector dw-mod" for="@settings.Id">@settings.SelectedOption</label>
7783 <div class="dropdown__content dw-mod">
7784 @settings.OptionsContent
7785 </div>
7786 <label class="dropdown-trigger-off" for="@settings.Id"></label>
7787 </div>
7788 }
7789 @using System.Reflection
7790 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
77917792 @* Component *@
77937794 @helper RenderQuantitySelector(QuantitySelector settings)
7795 {
7796 var attributes = new Dictionary<string, string>();
77977798 /*base settings*/
7799 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
7800 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
7801 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
7802 if (settings.Disabled) { attributes.Add("disabled", "true"); }
7803 if (settings.Required) { attributes.Add("required", "true"); }
7804 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
7805 /*end*/
78067807 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
7808 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
7809 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
7810 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
7811 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); }
7812 if (settings.Min == null) { settings.Min = 1; }
7813 attributes.Add("min", settings.Min.ToString());
7814 if (settings.Step != null && !string.IsNullOrEmpty(settings.Step.ToString())) { attributes.Add("step", settings.Step.ToString()); }
7815 if (settings.Value == null) { settings.Value = 1; }
7816 attributes.Add("value", settings.Value.ToString());
7817 attributes.Add("type", "number");
78187819 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
78207821 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
7822 }
7823 @using Dynamicweb.Rapido.Blocks.Components
78247825 @using Dynamicweb.Frontend
7826 @using Dynamicweb.Frontend.Devices
7827 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
7828 @using Dynamicweb.Rapido.Blocks.Components.General
7829 @using System.Collections.Generic;
78307831 @* Component *@
78327833 @helper RenderCustomerCenterList(CustomerCenterList settings)
7834 {
7835 bool isTouchDevice = Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet" ? true : false;
7836 string hideActions = isTouchDevice ? "u-block" : "";
78377838 <table class="table data-list dw-mod">
7839 @if (settings.GetHeaders().Length > 0) {
7840 <thead>
7841 <tr class="u-bold">
7842 @foreach (CustomerCenterListHeaderItem header in settings.GetHeaders())
7843 {
7844 var attributes = new Dictionary<string, string>();
7845 if (!string.IsNullOrEmpty(header.Id)) { attributes.Add("id", header.Id); }
7846 if (!string.IsNullOrEmpty(header.CssClass)) { attributes.Add("class", header.CssClass); }
7847 attributes.Add("align", header.Align.ToString());
7848 attributes = attributes.Concat(header.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
78497850 <td @ComponentMethods.AddAttributes(attributes)>@header.Title</td>
7851 }
7852 </tr>
7853 </thead>
7854 }
7855 @foreach (CustomerCenterListItem listItem in settings.GetItems())
7856 {
7857 int columnCount = 0;
7858 int totalColumns = listItem.GetInfoItems().Length;
7859 string rowHasActions = listItem.GetActions().Length > 0 ? "data-list__item--has-actions" : "";
7860 listItem.Id = !string.IsNullOrEmpty(listItem.Id) ? listItem.Id : Guid.NewGuid().ToString("N");
78617862 var attributes = new Dictionary<string, string>();
7863 if (!string.IsNullOrEmpty(listItem.Title)) { attributes.Add("title", listItem.Title); };
78647865 attributes = attributes.Concat(listItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
7866 <tbody class="data-list__item @rowHasActions @listItem.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes)>
7867 <tr>
7868 @if (!string.IsNullOrEmpty(listItem.Title) || !string.IsNullOrEmpty(listItem.Description)) {
7869 string onClick = !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : "";
78707871 <td rowspan="2" @onClick class="data-list__main-item dw-mod">
7872 @if (!string.IsNullOrEmpty(listItem.Title)) {
7873 <div class="u-bold">@listItem.Title</div>
7874 }
7875 @if (!string.IsNullOrEmpty(listItem.Description)) {
7876 <div>@listItem.Description</div>
7877 }
7878 </td>
7879 }
78807881 @foreach (CustomerCenterListInfoItem infoItem in listItem.GetInfoItems())
7882 {
7883 var infoAttributes = new Dictionary<string, string>();
7884 if (!string.IsNullOrEmpty(infoItem.Id)) { infoAttributes.Add("id", infoItem.Id); };
7885 if (!string.IsNullOrEmpty(infoItem.OnClick)) { infoAttributes.Add("onclick", infoItem.OnClick); };
7886 infoAttributes.Add("align", infoItem.Align.ToString());
78877888 infoAttributes = infoAttributes.Concat(infoItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
7889 string columnClick = columnCount < (totalColumns-1) && !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : "";
78907891 <td @ComponentMethods.AddAttributes(infoAttributes) @columnClick class="data-list__info-item dw-mod">
7892 @if (!string.IsNullOrEmpty(infoItem.Title)) {
7893 <div>@infoItem.Title</div>
7894 }
7895 @if (!string.IsNullOrEmpty(infoItem.Subtitle)) {
7896 <div><small>@infoItem.Subtitle</small></div>
7897 }
7898 </td>
78997900 columnCount++;
7901 }
7902 </tr>
7903 <tr>
7904 <td colspan="7" align="right" class="u-va-bottom u-no-border">
7905 <div class="data-list__actions @hideActions dw-mod" id="ActionsMenu_@listItem.Id">
7906 @foreach (ButtonBase action in listItem.GetActions())
7907 {
7908 action.ButtonLayout = ButtonLayout.LinkClean;
7909 action.Icon.CssClass += " u-full-height";
7910 action.CssClass += " data-list__action-button link";
79117912 @Render(action)
7913 }
7914 </div>
7915 </td>
7916 </tr>
7917 </tbody>
7918 }
7919 </table>
7920 }
7921 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
79227923 @using System
7924 @using System.Web
7925 @using System.Collections.Generic
7926 @using Dynamicweb.Rapido.Blocks.Extensibility
7927 @using Dynamicweb.Rapido.Blocks
79287929 @{
7930 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master");
79317932 Block primaryBottomSnippets = new Block()
7933 {
7934 Id = "MasterJavascriptInitializers",
7935 SortId = 100,
7936 Template = RenderPrimaryBottomSnippets()
7937 };
7938 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets);
79397940 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed())
7941 {
7942 Block miniCartPageId = new Block
7943 {
7944 Id = "MiniCartPageId",
7945 Template = RenderMiniCartPageId()
7946 };
7947 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, miniCartPageId);
7948 }
7949 }
79507951 @helper RenderPrimaryBottomSnippets()
7952 {
7953 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode");
7954 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));
79557956 if (isWireframeMode)
7957 {
7958 <script>
7959 Wireframe.Init(true);
7960 </script>
7961 }
796279637964 if (useGoogleTagManager)
7965 {
7966 <script>
7967 document.addEventListener('addToCart', function(event) {
7968 var googleImpression = JSON.parse(event.detail.productInfo.googleImpression);
7969 if (typeof googleImpression == "string") {
7970 googleImpression = JSON.parse(event.detail.productInfo.googleImpression);
7971 }
7972 dataLayer.push({
7973 'event': 'addToCart',
7974 'ecommerce': {
7975 'currencyCode': googleImpression.currency,
7976 'add': {
7977 'products': [{
7978 'name': googleImpression.name,
7979 'id': googleImpression.id,
7980 'price': googleImpression.price,
7981 'brand': googleImpression.brand,
7982 'category': googleImpression.category,
7983 'variant': googleImpression.variant,
7984 'quantity': event.detail.quantity
7985 }]
7986 }
7987 }
7988 });
7989 });
7990 </script>
7991 }
79927993 //if digitalwarehouse
7994 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart"))
7995 {
7996 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]);
79977998 if (string.IsNullOrEmpty(cartContextId))
7999 {
8000 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2");
8001 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps);
8002 cartContextId = cartSettings.OrderContextID;
8003 HttpContext.Current.Application["DownloadCartContext"] = cartContextId;
8004 }
80058006 <script>
8007 let downloadCart = new DownloadCart({
8008 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"),
8009 contextId: "@cartContextId",
8010 addButtonText: "@Translate("Add")",
8011 removeButtonText: "@Translate("Remove")"
8012 });
8013 </script>
8014 }
80158016 <!--$$Javascripts-->
8017 }
80188019 @helper RenderMiniCartPageId()
8020 {
8021 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
8022 <script>
8023 window.cartId = "@miniCartFeedPageId";
8024 </script>
8025 }
8026 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
80278028 @using System
8029 @using System.Web
8030 @using System.Collections.Generic
8031 @using Dynamicweb.Rapido.Blocks
80328033 @{
8034 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master");
80358036 }
803780388039 @functions {
8040 public class ManifestIcon
8041 {
8042 public string src { get; set; }
8043 public string type { get; set; }
8044 public string sizes { get; set; }
8045 }
80468047 public class Manifest
8048 {
8049 public string name { get; set; }
8050 public string short_name { get; set; }
8051 public string start_url { get; set; }
8052 public string display { get; set; }
8053 public string background_color { get; set; }
8054 public string theme_color { get; set; }
8055 public List<ManifestIcon> icons { get; set; }
8056 }
8057 }
80588059 <!DOCTYPE html>
80608061 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName">
8062806380648065 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@
8066 @RenderBlockList(masterPage.BlocksRoot.BlocksList)
8067806880698070 @helper RenderMasterHead() {
8071 List<Block> subBlocks = this.masterPage.GetBlockListById("Head").OrderBy(item => item.SortId).ToList();
80728073 <head>
8074 <!-- Rapido version 3.4.3 -->
80758076 @RenderBlockList(subBlocks)
8077 </head>
8078 }
80798080 @helper RenderMasterMetadata() {
8081 var swatches = new Dynamicweb.Content.Items.ColorSwatchService();
8082 var brandColors = swatches.GetColorSwatch(1);
8083 string brandColorOne = brandColors.Palette["BrandColor1"];
80848085 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) {
8086 Manifest manifest = new Manifest
8087 {
8088 name = Model.Area.Item.GetItem("Settings").GetString("AppName"),
8089 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"),
8090 start_url = "/",
8091 display = "standalone",
8092 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"),
8093 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor")
8094 };
80958096 manifest.icons = new List<ManifestIcon> {
8097 new ManifestIcon {
8098 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,
8099 sizes = "192x192",
8100 type = "image/png"
8101 },
8102 new ManifestIcon {
8103 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,
8104 sizes = "512x512",
8105 type = "image/png"
8106 },
8107 new ManifestIcon {
8108 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,
8109 sizes = "1024x1024",
8110 type = "image/png"
8111 }
8112 };
81138114 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json");
8115 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest);
8116 string currentManifest = File.ReadAllText(manifestFilePath);
81178118 if (manifestJSON != currentManifest)
8119 {
8120 File.WriteAllText(manifestFilePath, manifestJSON);
8121 }
8122 }
81238124 <meta charset="utf-8" />
8125 <title>@Model.Title</title>
8126 <meta name="viewport" content="width=device-width, initial-scale=1.0">
8127 <meta name="robots" content="index, follow">
8128 <meta name="theme-color" content="@brandColorOne" />
8129 if (Model.ItemType == "Blogpost")
8130 {
8131 string metaImage = "/Admin/Public/GetImage.ashx?Image=" + Model.Item.GetRawValueString("ImageMain") + "&Format=jpg&Width=500&Height=500&Crop=0";
8132 Pageview.Meta.AddTag("og:image", metaImage);
8133 Pageview.Meta.AddTag("og:type","article");
8134 @* Pageview.Meta.AddTag("og:image", Model.Item.GetRawValueString("ImageMain")); *@
8135 Pageview.Meta.AddTag("og:title", Model.Item.GetRawValueString("Header"));
8136 Pageview.Meta.AddTag("og:description", Model.Item.GetRawValueString("IntroText"));
8137 }
8138 else
8139 {
8140 if (Model.MetaTags != null && !Model.MetaTags.Contains("og:image") && Model.PropertyItem != null && Model.PropertyItem.GetFile("OpenGraphImage") != null)
8141 {
8142 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")));
8143 }
8144 if (!Model.MetaTags.Contains("og:description") && !string.IsNullOrEmpty(Model.Description))
8145 {
8146 Pageview.Meta.AddTag("og:description", Model.Description);
8147 }
8148 Pageview.Meta.AddTag("og:type", "Website");
8149 Pageview.Meta.AddTag("og:title", Model.Title);
8150 }
8151 Pageview.Meta.AddTag("og:site_name", Model.Name);
8152 @* Pageview.Meta.AddTag("og:url", HttpContext.Current.Request.Url.ToString()); *@
8153 Pageview.Meta.AddTag("og:url", string.Format("{0}://{1}{2}", Dynamicweb.Context.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(Pageview.ID)));
8154 if (!string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("FacebookAppID"))) {
8155 Pageview.Meta.AddTag("fb:app_id", Model.Area.Item.GetItem("Settings").GetString("FacebookAppID"));
8156 }
8157 @Model.MetaTags
8158 }
81598160 @helper RenderMasterCss() {
8161 var fonts = new string[] {
8162 getFontFamily("Layout", "HeaderFont"),
8163 getFontFamily("Layout", "SubheaderFont"),
8164 getFontFamily("Layout", "TertiaryHeaderFont"),
8165 getFontFamily("Layout", "BodyText"),
8166 getFontFamily("Layout", "Header", "ToolsFont"),
8167 getFontFamily("Layout", "Header", "NavigationFont"),
8168 getFontFamily("Layout", "MobileNavigation", "Font"),
8169 getFontFamily("ProductList", "Facets", "HeaderFont"),
8170 getFontFamily("ProductPage", "PriceFontDesign"),
8171 getFontFamily("Ecommerce", "SaleSticker", "Font"),
8172 getFontFamily("Ecommerce", "NewSticker", "Font"),
8173 getFontFamily("Ecommerce", "CustomSticker", "Font")
8174 };
81758176 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks;
8177 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png";
8178 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro");
8179 string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css";
8180 if (useFontAwesomePro)
8181 {
8182 fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css";
8183 }
81848185 //Favicon
8186 <link href="@favicon" rel="icon" type="image/png">
81878188 //Base (Default, wireframe) styles
8189 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css">
81908191 //Rapido Css from Website Settings
8192 <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css">
81938194 //Ignite Css (Custom site specific styles)
8195 <link rel="stylesheet" id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css">
81968197 //Font awesome
8198 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css">
81998200 //Flag icon
8201 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css">
82028203 //Google fonts
8204 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)));
82058206 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet">
82078208 PushPromise(favicon);
8209 PushPromise(fontAwesomeCssLink);
8210 PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css");
8211 PushPromise(autoCssLink);
8212 PushPromise("/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css");
8213 PushPromise("/Files/Images/placeholder.gif");
8214 PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css");
8215 }
82168217 @helper RenderMasterManifest() {
8218 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")))
8219 {
8220 <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json">
8221 PushPromise("/Files/Templates/Designs/Rapido/manifest.json");
8222 }
8223 }
82248225 @helper RenderMasterBody() {
8226 List<Block> subBlocks = this.masterPage.GetBlockListById("Body").OrderBy(item => item.SortId).ToList();
8227 string designLayout = Model.PropertyItem.GetItem("CustomSettings") != null ? Model.PropertyItem.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.PropertyItem.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : "";
8228 if (!String.IsNullOrEmpty(designLayout)) {
8229 designLayout = "class=\"" + designLayout + "\"";
8230 }
82318232 <body @designLayout>
8233 @RenderBlockList(subBlocks)
8234 </body>
8235 }
82368237 @helper RenderMasterHeader()
8238 {
8239 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList();
8240 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop");
8241 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : "";
82428243 <header class="top-container @stickyTop no-print dw-mod" id="Top">
8244 @if (Dynamicweb.Context.Current.Items["IsWebServiceConnectionAvailable"].ToString().ToLower() == "false")
8245 {
8246 if (Model.CurrentUser.ID > 0)
8247 {
8248 <div style="background-color:yellow;text-align:center;">@Translate("No connection to ERP", "Enbart generella priser kan visas just nu på sajten. Du kan ändå lägga order och dina avtalspriser gäller givetvis vid fakturering.")</div>
8249 }
8250 }
8251 @RenderBlockList(subBlocks)
8252 </header>
8253 }
82548255 @helper RenderMain()
8256 {
8257 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList();
82588259 <main class="site dw-mod">
8260 @RenderBlockList(subBlocks)
8261 </main>
8262 }
82638264 @helper RenderPageContent()
8265 {
8266 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop");
8267 string pagePos = isNavigationStickyMenu ? "js-page-pos" : "";
8268 string bodyClass = Pageview.Page.NavigationTag;
8269 bodyClass = bodyClass;
82708271 <div id="Page" class="page @pagePos @bodyClass">
8272 <div id="content">
8273 @RenderSnippet("Content")
8274 </div>
8275 </div>
8276 }
82778278 @* Hack to support nested helpers *@
8279 @SnippetStart("Content")
8280 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
8281828282838284 @* Render the grid *@
8285 @Model.Grid("Grid", "Grid", "default:true;sort:1", "Pages")
82868287 @SnippetEnd("Content")
82888289 @helper RenderIosTabletFix() {
8290 if (Pageview.Device != Dynamicweb.Frontend.Devices.DeviceType.Tablet && Pageview.Platform != Dynamicweb.Frontend.Devices.PlatformType.Ios)
8291 {
8292 <script>
8293 let isIpadIOS = (/iPad/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) && !window.MSStream;
8294 if (isIpadIOS) {
8295 var separator = (window.location.href.indexOf("?") === -1) ? "?" : "&";
8296 window.location.href = window.location.href + separator + "DeviceType=Tablet&PlatformType=Ios";
8297 }
8298 </script>
8299 }
8300 }
83018302 </html>
83038304