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