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