Error executing template "Designs/Rapido/_parsed/ContentPage.parsed.cshtml"
System.Data.SqlClient.SqlException (0x80131904): SHUTDOWN is in progress.
Login failed for user 'riisfort.cloud.dynamicweb-cms.com'.
Cannot continue the execution because the session is in the kill state.
A severe error occurred on the current command. The results, if any, should be discarded.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at Dynamicweb.Data.Database.CreateDataReader(IDbCommand command, CommandBehavior behavior)
at Dynamicweb.Data.Database.CreateDataReader(CommandBuilder commandBuilder, IDbConnection connection, IDbTransaction transaction, CommandBehavior behavior, Int32 commandTimeout)
at Dynamicweb.Data.Database.CreateDataReader(CommandBuilder commandBuilder, IDbConnection connection, IDbTransaction transaction, Int32 commandTimeout)
at Dynamicweb.Content.Items.Queries.Repository.SelectInternal(IEnumerable`1 ids, Query query)
at Dynamicweb.Content.Items.Queries.Repository.SelectByIds(IEnumerable`1 ids, Query query, Boolean checkPermissions, Boolean includeInheritedItems)
at Dynamicweb.Content.Items.Queries.Repository.SelectByIds(IEnumerable`1 ids, Query query, Boolean checkPermissions)
at Dynamicweb.Content.Items.Queries.Repository.SelectById(String id, Query query)
at Dynamicweb.Content.Items.Queries.StorageManager.GetById(String systemName, String id)
at Dynamicweb.Content.Items.Queries.StorageManager.GetById(String systemName, String id, Boolean draft, DateTime previewDate)
at Dynamicweb.Content.Items.Editors.ItemTypeEditor.GetItem(String itemId)
at Dynamicweb.Content.Items.Editors.ItemTypeEditor.GetViewModelValue(Object value)
at System.Lazy`1.CreateValue()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Lazy`1.get_Value()
at Dynamicweb.Frontend.ItemFieldViewModel.GetValue[T]()
at Dynamicweb.Frontend.ItemViewModel.GetItem(String systemName)
at CompiledRazorTemplates.Dynamic.RazorEngine_1cb3cefdd9c34446a6eb4a7597601157.Execute() in D:\dynamicweb.net\Solutions\Skabertrang\riisfort.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 4643
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()
ClientConnectionId:f8014713-680c-437d-9e4f-8d5c24dd4431
Error Number:6005,State:1,Class:14
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 @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 @settings.CssClass" placeholder="@settings.Placeholder" value="@searchValue" id="@settings.Id-Test">
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 if (settings != null)
1887 {
1888 string modalId = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N");
1889
1890 string onchange = !string.IsNullOrEmpty(settings.OnClose) ? "onchange=\"if(!this.checked){" + settings.OnClose + "}\"" : "";
1891
1892 <input type="checkbox" id="@(modalId)ModalTrigger" class="modal-trigger" @onchange />
1893
1894 <div class="modal-container">
1895 @if (!settings.DisableDarkOverlay)
1896 {
1897 <label for="@(modalId)ModalTrigger" id="@(modalId)ModalOverlay" class="modal-overlay"></label>
1898 }
1899 <div class="modal modal--@settings.Width.ToString().ToLower() modal-height--@settings.Height.ToString().ToLower()" id="@(modalId)Modal">
1900 @if (settings.Heading != null)
1901 {
1902 if (!string.IsNullOrEmpty(settings.Heading.Title))
1903 {
1904 <div class="modal__header">
1905 @Render(settings.Heading)
1906 </div>
1907 }
1908 }
1909 <div class="modal__body @(settings.Width.ToString().ToLower() == "full" ? "modal__body--full" : "")">
1910 @if (!string.IsNullOrEmpty(settings.BodyText))
1911 {
1912 @settings.BodyText
1913 }
1914 @if (settings.BodyTemplate != null)
1915 {
1916 @settings.BodyTemplate
1917 }
1918 @{
1919 var actions = settings.GetActions();
1920 }
1921 </div>
1922 @if (actions.Length > 0)
1923 {
1924 <div class="modal__footer">
1925 @foreach (var action in actions)
1926 {
1927 if (Pageview.Device.ToString() != "Mobile") {
1928 action.CssClass += " u-no-margin";
1929 } else {
1930 action.CssClass += " u-full-width u-margin-bottom";
1931 }
1932
1933 @Render(action)
1934 }
1935 </div>
1936 }
1937 <label class="modal__close-btn" for="@(modalId)ModalTrigger"></label>
1938 </div>
1939 </div>
1940 }
1941 }
1942 @using Dynamicweb.Rapido.Blocks.Components.General
1943
1944 @* Component *@
1945
1946 @helper RenderMediaListItem(MediaListItem settings)
1947 {
1948 <div class="media-list-item @settings.CssClass dw-mod" @(!string.IsNullOrEmpty(settings.Id) ? "id=\"" + settings.Id + "\"" : "")>
1949 @if (!string.IsNullOrEmpty(settings.Label))
1950 {
1951 if (!string.IsNullOrEmpty(settings.Link))
1952 {
1953 @Render(new Link
1954 {
1955 Href = settings.Link,
1956 CssClass = "media-list-item__sticker dw-mod",
1957 ButtonLayout = ButtonLayout.None,
1958 Title = settings.Label,
1959 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : ""
1960 })
1961 }
1962 else if (!string.IsNullOrEmpty(settings.OnClick))
1963 {
1964 <span class="media-list-item__sticker dw-mod" onclick="@(settings.OnClick)">
1965 <span class="u-uppercase">@settings.Label</span>
1966 </span>
1967 }
1968 else
1969 {
1970 <span class="media-list-item__sticker media-list-item__sticker--no-link dw-mod">
1971 <span class="u-uppercase">@settings.Label</span>
1972 </span>
1973 }
1974 }
1975 <div class="media-list-item__wrap">
1976 <div class="media-list-item__info dw-mod">
1977 <div class="media-list-item__header dw-mod">
1978 @if (!string.IsNullOrEmpty(settings.Title))
1979 {
1980 if (!string.IsNullOrEmpty(settings.Link))
1981 {
1982 @Render(new Link
1983 {
1984 Href = settings.Link,
1985 CssClass = "media-list-item__name dw-mod",
1986 ButtonLayout = ButtonLayout.None,
1987 Title = settings.Title,
1988 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : ""
1989 })
1990 }
1991 else if (!string.IsNullOrEmpty(settings.OnClick))
1992 {
1993 <span class="media-list-item__name dw-mod" onclick="@(settings.OnClick)">@settings.Title</span>
1994 }
1995 else
1996 {
1997 <span class="media-list-item__name media-list-item__name--no-link dw-mod">@settings.Title</span>
1998 }
1999 }
2000
2001 @if (!string.IsNullOrEmpty(settings.Status))
2002 {
2003 <div class="media-list-item__state dw-mod">@settings.Status</div>
2004 }
2005 </div>
2006 @{
2007 settings.InfoTable.CssClass += " media-list-item__parameters-table";
2008 }
2009
2010 @Render(settings.InfoTable)
2011 </div>
2012 <div class="media-list-item__actions dw-mod">
2013 <div class="media-list-item__actions-list dw-mod">
2014 @{
2015 var actions = settings.GetActions();
2016
2017 foreach (ButtonBase action in actions)
2018 {
2019 action.ButtonLayout = ButtonLayout.None;
2020 action.CssClass += " media-list-item__action link";
2021
2022 @Render(action)
2023 }
2024 }
2025 </div>
2026
2027 @if (settings.SelectButton != null && !string.IsNullOrEmpty(settings.SelectButton.Title))
2028 {
2029 settings.SelectButton.CssClass += " u-no-margin";
2030
2031 <div class="media-list-item__action-button">
2032 @Render(settings.SelectButton)
2033 </div>
2034 }
2035 </div>
2036 </div>
2037 </div>
2038 }
2039 @using Dynamicweb.Rapido.Blocks.Components.General
2040 @using Dynamicweb.Rapido.Blocks.Components
2041
2042 @helper RenderTable(Table settings)
2043 {
2044 Dictionary<string, string> attributes = new Dictionary<string, string>();
2045 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
2046
2047 var enumToClasses = new Dictionary<TableDesign, string>
2048 {
2049 { TableDesign.Clean, "table--clean" },
2050 { TableDesign.Bordered, "table--bordered" },
2051 { TableDesign.Striped, "table--striped" },
2052 { TableDesign.Hover, "table--hover" },
2053 { TableDesign.Compact, "table--compact" },
2054 { TableDesign.Condensed, "table--condensed" },
2055 { TableDesign.NoTopBorder, "table--no-top-border" }
2056 };
2057 string tableDesignClass = "";
2058 if (settings.Design != TableDesign.None)
2059 {
2060 tableDesignClass = enumToClasses[settings.Design];
2061 }
2062
2063 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableDesign.None) { attributes.Add("class", "table " + tableDesignClass + " " + settings.CssClass + " dw-mod"); }
2064
2065 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);
2066
2067 <table @ComponentMethods.AddAttributes(resultAttributes)>
2068 @if (settings.Header != null)
2069 {
2070 <thead>
2071 @Render(settings.Header)
2072 </thead>
2073 }
2074 <tbody>
2075 @foreach (var row in settings.Rows)
2076 {
2077 @Render(row)
2078 }
2079 </tbody>
2080 @if (settings.Footer != null)
2081 {
2082 <tfoot>
2083 @Render(settings.Footer)
2084 </tfoot>
2085 }
2086 </table>
2087 }
2088 @using Dynamicweb.Rapido.Blocks.Components.General
2089 @using Dynamicweb.Rapido.Blocks.Components
2090
2091 @helper RenderTableRow(TableRow settings)
2092 {
2093 Dictionary<string, string> attributes = new Dictionary<string, string>();
2094 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
2095
2096 var enumToClasses = new Dictionary<TableRowDesign, string>
2097 {
2098 { TableRowDesign.NoBorder, "table__row--no-border" },
2099 { TableRowDesign.Border, "table__row--border" },
2100 { TableRowDesign.TopBorder, "table__row--top-line" },
2101 { TableRowDesign.BottomBorder, "table__row--bottom-line" },
2102 { TableRowDesign.Solid, "table__row--solid" }
2103 };
2104
2105 string tableRowDesignClass = "";
2106 if (settings.Design != TableRowDesign.None)
2107 {
2108 tableRowDesignClass = enumToClasses[settings.Design];
2109 }
2110
2111 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableRowDesign.None) { attributes.Add("class", "table__row " + tableRowDesignClass + " " + settings.CssClass + " dw-mod"); }
2112
2113 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);
2114
2115 <tr @ComponentMethods.AddAttributes(resultAttributes)>
2116 @foreach (var cell in settings.Cells)
2117 {
2118 if (settings.IsHeaderRow)
2119 {
2120 cell.IsHeader = true;
2121 }
2122 @Render(cell)
2123 }
2124 </tr>
2125 }
2126 @using Dynamicweb.Rapido.Blocks.Components.General
2127 @using Dynamicweb.Rapido.Blocks.Components
2128 @using Dynamicweb.Core
2129
2130 @helper RenderTableCell(TableCell settings)
2131 {
2132 Dictionary<string, string> attributes = new Dictionary<string, string>();
2133 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
2134 if (settings.Colspan != 0) { attributes.Add("colspan", Converter.ToString(settings.Colspan)); }
2135 if (settings.Rowspan != 0) { attributes.Add("rowspan", Converter.ToString(settings.Rowspan)); }
2136 if (!string.IsNullOrEmpty(settings.CssClass)) { attributes.Add("class", settings.CssClass + " dw-mod"); }
2137
2138 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);
2139
2140 string tagName = settings.IsHeader ? "th" : "td";
2141
2142 @("<" + tagName + " " + ComponentMethods.AddAttributes(resultAttributes) + ">")
2143 @settings.Content
2144 @("</" + tagName + ">");
2145 }
2146 @using System.Linq
2147 @using Dynamicweb.Rapido.Blocks.Components.General
2148
2149 @* Component *@
2150
2151 @helper RenderPagination(Dynamicweb.Rapido.Blocks.Components.General.Pagination settings)
2152 {
2153 var pageNumberQueryStringName = Dynamicweb.Rapido.Services.Pagination.GetPageNumberQueryStringName(settings); // Get the proper 'page number' query string parameter
2154 var queryParameters = Dynamicweb.Rapido.Services.Url.GetQueryParameters(pageNumberQueryStringName); // Get the NameValueCollection from the querystring
2155
2156 if (settings.NumberOfPages > 1)
2157 {
2158 string url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/Default.aspx";
2159 string ariaLabel = !string.IsNullOrWhiteSpace(settings.AriaLabel) ? settings.AriaLabel : Translate("Page navigation");
2160 Dictionary<string, int> startAndEndPageNumber = Dynamicweb.Rapido.Services.Pagination.GetStartAndEndPageNumber(settings);
2161
2162 <div class="pager u-margin-top dw-mod @settings.CssClass" aria-label="@ariaLabel">
2163 @if (settings.ShowPagingInfo)
2164 {
2165 <div class="pager__info dw-mod">
2166 @Translate("Page") @settings.CurrentPageNumber @Translate("of") @settings.NumberOfPages
2167 </div>
2168 }
2169 <ul class="pager__list dw-mod">
2170 @if (!string.IsNullOrWhiteSpace(settings.FirstPageUrl) && settings.ShowFirstAndLastControls)
2171 {
2172 @Render(new PaginationItem { Link = settings.FirstPageUrl, Icon = settings.FirstIcon })
2173 }
2174 @if (!string.IsNullOrWhiteSpace(settings.PreviousPageUrl) && settings.ShowNextAndPrevControls)
2175 {
2176 @Render(new PaginationItem { Link = settings.PreviousPageUrl, Icon = settings.PrevIcon })
2177 }
2178 @if (settings.GetPages().Any())
2179 {
2180 foreach (var page in settings.GetPages())
2181 {
2182 @Render(page)
2183 }
2184 }
2185 else
2186 {
2187 for (var page = startAndEndPageNumber["StartPage"]; page <= startAndEndPageNumber["EndPage"]; page++)
2188 {
2189 queryParameters = Dynamicweb.Rapido.Services.Url.UpdateQueryStringParameter(queryParameters, pageNumberQueryStringName, page.ToString());
2190 @Render(new PaginationItem { Label = page.ToString(), Link = Dynamicweb.Rapido.Services.Url.BuildUri(url, queryParameters).PathAndQuery, IsActive = (settings.CurrentPageNumber == page) });
2191 }
2192 }
2193 @if (!string.IsNullOrWhiteSpace(settings.NextPageUrl) && settings.ShowNextAndPrevControls)
2194 {
2195 @Render(new PaginationItem { Link = settings.NextPageUrl, Icon = settings.NextIcon })
2196 }
2197 @if (!string.IsNullOrWhiteSpace(settings.LastPageUrl) && settings.ShowFirstAndLastControls)
2198 {
2199 @Render(new PaginationItem { Link = settings.LastPageUrl, Icon = settings.LastIcon })
2200 }
2201 </ul>
2202 </div>
2203 }
2204 }
2205
2206 @helper RenderPaginationItem(PaginationItem settings)
2207 {
2208 if (settings.Icon == null)
2209 {
2210 settings.Icon = new Icon();
2211 }
2212
2213 settings.Icon.Label = settings.Label;
2214 <li class="pager__btn dw-mod">
2215 @if (settings.IsActive)
2216 {
2217 <span class="pager__num pager__num--current dw-mod">
2218 @Render(settings.Icon)
2219 </span>
2220 }
2221 else
2222 {
2223 <a href="@settings.Link" class="pager__num dw-mod">
2224 @Render(settings.Icon)
2225 </a>
2226 }
2227 </li>
2228 }
2229
2230
2231 @using Dynamicweb.Rapido.Blocks.Components.General
2232 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
2233
2234
2235 @using Dynamicweb.Frontend
2236 @using System.Reflection
2237 @using Dynamicweb.Content.Items
2238 @using System.Web.UI.HtmlControls
2239 @using Dynamicweb.Rapido.Blocks.Components
2240 @using Dynamicweb.Rapido.Blocks
2241 @using Dynamicweb.Rapido.Blocks.Components.Articles
2242
2243 @* Components for the articles *@
2244 @using System.Reflection
2245 @using Dynamicweb.Rapido.Blocks.Components.Articles
2246
2247
2248 @* Component for the articles *@
2249
2250 @helper RenderArticleBanner(dynamic settings) {
2251 string filterClasses = "image-filter image-filter--darken";
2252 settings.Layout = ArticleHeaderLayout.Banner;
2253
2254 if (settings.Image != null)
2255 {
2256 if (settings.Image.Path != null)
2257 {
2258 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width">
2259 <div class="background-image @filterClasses dw-mod">
2260 <div class="background-image__wrapper @filterClasses dw-mod">
2261 @{
2262 settings.Image.CssClass += "background-image__cover dw-mod";
2263 }
2264 @Render(settings.Image)
2265 </div>
2266 </div>
2267 <div class="center-container dw-mod">
2268 <div class="grid">
2269 <div class="grid__col-md-8 grid__col-xs-12 paragraph-container paragraph-container--height-lg">
2270 <div class="u-left-middle">
2271 <div>
2272 @if (!String.IsNullOrEmpty(settings.Heading))
2273 {
2274 <h1 class="article__header article__header--giant dw-mod" style="color: @settings.TextColor">@settings.Heading</h1>
2275 }
2276 @if (!String.IsNullOrEmpty(settings.Subheading))
2277 {
2278 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div>
2279 }
2280 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2281 {
2282 <small class="article__post-info u-margin-bottom--lg dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small>
2283 }
2284 @if (!String.IsNullOrEmpty(settings.Link)) {
2285 <div class="grid__cell">
2286 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2287 </div>
2288 }
2289 </div>
2290 </div>
2291 </div>
2292 @if (settings.ExternalParagraphId != 0)
2293 {
2294 <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod">
2295 <div class="u-color-light-gray--bg u-color-dark dw-mod">
2296 @RenderParagraphContent(settings.ExternalParagraphId)
2297 </div>
2298 </div>
2299 }
2300
2301 </div>
2302 </div>
2303 </section>
2304 if (!String.IsNullOrEmpty(settings.Image.Caption)) {
2305 <div class="image-caption dw-mod">@settings.Image.Caption</div>
2306 }
2307 }
2308 else
2309 {
2310 settings.Layout = ArticleHeaderLayout.Clean;
2311 @RenderArticleCleanHeader(settings);
2312 }
2313 }
2314 else
2315 {
2316 settings.Layout = ArticleHeaderLayout.Clean;
2317 @RenderArticleCleanHeader(settings);
2318 }
2319 }
2320 @using System.Reflection
2321 @using Dynamicweb.Rapido.Blocks.Components
2322 @using Dynamicweb.Rapido.Blocks.Components.General
2323 @using Dynamicweb.Rapido.Blocks.Components.Articles
2324 @using Dynamicweb.Rapido.Blocks
2325
2326
2327 @* Component for the articles *@
2328
2329 @helper RenderArticleHeader(ArticleHeader settings) {
2330 dynamic[] methodParameters = new dynamic[1];
2331 methodParameters[0] = settings;
2332 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleHeaderCustom");
2333
2334 if (customMethod != null)
2335 {
2336 @customMethod.Invoke(this, methodParameters).ToString();
2337 } else {
2338 switch (settings.Layout)
2339 {
2340 case ArticleHeaderLayout.Clean:
2341 @RenderArticleCleanHeader(settings);
2342 break;
2343 case ArticleHeaderLayout.Split:
2344 @RenderArticleSplitHeader(settings);
2345 break;
2346 case ArticleHeaderLayout.Banner:
2347 @RenderArticleBannerHeader(settings);
2348 break;
2349 case ArticleHeaderLayout.Overlay:
2350 @RenderArticleOverlayHeader(settings);
2351 break;
2352 default:
2353 @RenderArticleCleanHeader(settings);
2354 break;
2355 }
2356 }
2357 }
2358
2359 @helper RenderArticleCleanHeader(ArticleHeader settings) {
2360 dynamic[] methodParameters = new dynamic[1];
2361 methodParameters[0] = settings;
2362 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom");
2363
2364 if (customMethod != null)
2365 {
2366 @customMethod.Invoke(this, methodParameters).ToString();
2367 }
2368 else
2369 {
2370 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12";
2371
2372 <div class="grid grid--align-content-start grid--justify-start">
2373 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod">
2374 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0)
2375 {
2376 <div class="u-border-bottom u-padding-bottom">
2377 @if (!String.IsNullOrEmpty(settings.Category))
2378 {
2379 <div class="u-pull--left">
2380 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div>
2381 </div>
2382 }
2383 <div class="u-pull--right">
2384 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2385 {
2386 <small class="article__post-info dw-mod">@settings.Author @settings.Date</small>
2387 }
2388 @if (settings.RatingOutOf != 0)
2389 {
2390 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })
2391 }
2392 </div>
2393 </div>
2394 }
2395
2396 <div class="grid__cell">
2397 @if (!String.IsNullOrEmpty(settings.Heading))
2398 {
2399 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1>
2400 }
2401 @if (settings.Image != null)
2402 {
2403 if (settings.Image.Path != null)
2404 {
2405 <div class="u-padding-bottom--lg">
2406 @Render(settings.Image)
2407 </div>
2408 }
2409 }
2410 @if (!String.IsNullOrEmpty(settings.Subheading))
2411 {
2412 <div class="article__leadtext dw-mod">@settings.Subheading</div>
2413 }
2414 @if (!String.IsNullOrEmpty(settings.Link))
2415 {
2416 <div class="grid__cell">
2417 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2418 </div>
2419 }
2420 </div>
2421 </div>
2422 @if (settings.ExternalParagraphId != 0)
2423 {
2424 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod">
2425 @RenderParagraphContent(settings.ExternalParagraphId)
2426 </div>
2427 }
2428 </div>
2429 }
2430 }
2431
2432 @helper RenderArticleSplitHeader(ArticleHeader settings) {
2433 dynamic[] methodParameters = new dynamic[1];
2434 methodParameters[0] = settings;
2435 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSplitHeaderCustom");
2436
2437 if (customMethod != null)
2438 {
2439 @customMethod.Invoke(this, methodParameters).ToString();
2440 }
2441 else
2442 {
2443 string headerColumnWidth = settings.ExternalParagraphId != 0 ? "4" : "6";
2444
2445 if (settings.Image != null)
2446 {
2447 if (settings.Image.Path != null)
2448 {
2449 <section class="multiple-paragraphs-container paragraph-container--full-width">
2450 <div class="grid">
2451 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod">
2452 <div class="u-left-middle u-padding--lg">
2453 <div>
2454 @if (!String.IsNullOrEmpty(settings.Category))
2455 {
2456 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div>
2457 }
2458 @if (!String.IsNullOrEmpty(settings.Heading))
2459 {
2460 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1>
2461 }
2462 @if (!String.IsNullOrEmpty(settings.Subheading))
2463 {
2464 <div class="article__leadtext dw-mod">@settings.Subheading</div>
2465 }
2466 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2467 {
2468 <small class="article__post-info u-pull--left dw-mod">@settings.Author @settings.Date</small>
2469 }
2470 @if (settings.RatingOutOf != 0)
2471 {
2472 <div class="u-pull--right">
2473 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })
2474 </div>
2475 }
2476 @if (!String.IsNullOrEmpty(settings.Link)) {
2477 <div class="u-full-width u-pull--left u-margin-top">
2478 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2479 </div>
2480 }
2481 </div>
2482 </div>
2483 </div>
2484 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod" style="background-image:url(/Admin/Public/GetImage.ashx?width=1800&height=1100&crop=0&Compression=85&DoNotUpscale=true&image=@settings.Image.Path); background-position: center center; background-size: cover;"></div>
2485 @if (settings.ExternalParagraphId != 0)
2486 {
2487 <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">
2488 @RenderParagraphContent(settings.ExternalParagraphId)
2489 </div>
2490 }
2491 </div>
2492 </section>
2493 }
2494 }
2495 else
2496 {
2497 @RenderArticleCleanHeader(settings);
2498 }
2499 }
2500 }
2501
2502 @helper RenderArticleOverlayHeader(ArticleHeader settings) {
2503 dynamic[] methodParameters = new dynamic[1];
2504 methodParameters[0] = settings;
2505 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleOverlayHeaderCustom");
2506
2507 if (customMethod != null)
2508 {
2509 @customMethod.Invoke(this, methodParameters).ToString();
2510 }
2511 else
2512 {
2513 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12";
2514 string contentAlignment = settings.TextLayout == ArticleHeaderTextLayout.Center ? "grid--justify-center" : "";
2515
2516 if (settings.Image != null)
2517 {
2518 if (settings.Image.Path != null)
2519 {
2520 if (settings.ExternalParagraphId == 0)
2521 {
2522 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width">
2523 <div class="background-image image-filter image-filter--darken dw-mod">
2524 <div class="background-image__wrapper image-filter image-filter--darken dw-mod">
2525 @{
2526 settings.Image.CssClass += "background-image__cover dw-mod";
2527 }
2528 @Render(settings.Image)
2529 </div>
2530 </div>
2531 <div class="center-container dw-mod">
2532 <div class="grid @contentAlignment">
2533 <div class="grid__col-md-@contentColumns grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod">
2534 @if (!string.IsNullOrEmpty(settings.Heading))
2535 {
2536 <h1 class="article__header article__header--giant u-padding-top--lg dw-mod" style="color: @settings.TextColor">@settings.Heading</h1>
2537 }
2538 @if (!String.IsNullOrEmpty(settings.Subheading))
2539 {
2540 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div>
2541 }
2542 <div class="u-margin-top">
2543 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2544 {
2545 <small class="article__post-info u-pull--left dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small>
2546 }
2547 @if (settings.RatingOutOf != 0)
2548 {
2549 <div class="u-pull--right">
2550 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })
2551 </div>
2552 }
2553 </div>
2554 @if (!String.IsNullOrEmpty(settings.Link))
2555 {
2556 <div class="grid__cell">
2557 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2558 </div>
2559 }
2560 </div>
2561 </div>
2562 </div>
2563 </section>
2564 }
2565 else
2566 {
2567 @RenderArticleBanner(settings);
2568 }
2569 }
2570 }
2571 else
2572 {
2573 @RenderArticleCleanHeader(settings);
2574 }
2575 }
2576 }
2577
2578 @helper RenderArticleBannerHeader(dynamic settings) {
2579 dynamic[] methodParameters = new dynamic[1];
2580 methodParameters[0] = settings;
2581 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerHeaderCustom");
2582
2583 if (customMethod != null)
2584 {
2585 @customMethod.Invoke(this, methodParameters).ToString();
2586 }
2587 else
2588 {
2589 @RenderArticleBanner(settings);
2590 }
2591 }
2592 @using System.Reflection
2593 @using System.Text.RegularExpressions;
2594 @using Dynamicweb.Frontend
2595 @using Dynamicweb.Content.Items
2596 @using Dynamicweb.Rapido.Blocks.Components
2597 @using Dynamicweb.Rapido.Blocks.Components.Articles
2598 @using Dynamicweb.Rapido.Blocks
2599
2600 @* Component for the articles *@
2601
2602 @helper RenderArticleBodyRow(ArticleBodyRow settings)
2603 {
2604 string position = settings.TopLayout == "overlay" ? "article__overlay-offset" : "";
2605 string contentAlignment = settings.TextLayout == "center" ? "grid--justify-center" : "";
2606
2607 <div class="grid grid--align-content-start @contentAlignment @position dw-mod">
2608 @RenderBlockList(settings.SubBlocks)
2609 </div>
2610 }
2611 @using System.Reflection
2612 @using Dynamicweb.Rapido.Blocks.Components
2613 @using Dynamicweb.Rapido.Blocks.Components.General
2614 @using Dynamicweb.Rapido.Blocks.Components.Articles
2615 @using Dynamicweb.Rapido.Blocks
2616
2617 @* Component for the articles *@
2618
2619 @helper RenderArticleImage(ArticleImage settings)
2620 {
2621 if (settings.Image != null)
2622 {
2623 if (settings.Image.Path != null)
2624 {
2625 <div class="u-margin-bottom--lg">
2626 @Render(settings.Image)
2627 </div>
2628 }
2629 }
2630 }
2631 @using System.Reflection
2632 @using Dynamicweb.Rapido.Blocks.Components
2633 @using Dynamicweb.Rapido.Blocks.Components.Articles
2634
2635
2636 @* Component for the articles *@
2637
2638 @helper RenderArticleSubHeader(ArticleSubHeader settings)
2639 {
2640 if (!String.IsNullOrEmpty(settings.Title))
2641 {
2642 <h2 class="article__header">@settings.Title</h2>
2643 }
2644 }
2645 @using System.Reflection
2646 @using Dynamicweb.Rapido.Blocks.Components
2647 @using Dynamicweb.Rapido.Blocks.Components.Articles
2648 @using Dynamicweb.Rapido.Blocks
2649
2650
2651 @* Component for the articles *@
2652
2653 @helper RenderArticleText(ArticleText settings)
2654 {
2655 if (!String.IsNullOrEmpty(settings.Text))
2656 {
2657 string greatTextClass = settings.EnableLargeText == true ? "article__paragraph--great-text" : "";
2658
2659 <div class="article__paragraph @greatTextClass dw-mod">
2660 @settings.Text
2661 </div>
2662 }
2663 }
2664 @using System.Reflection
2665 @using Dynamicweb.Rapido.Blocks.Components
2666 @using Dynamicweb.Rapido.Blocks.Components.Articles
2667 @using Dynamicweb.Rapido.Blocks
2668
2669
2670 @* Component for the articles *@
2671
2672 @helper RenderArticleQuote(ArticleQuote settings)
2673 {
2674 string text = Regex.Replace(settings.Text, "<.*?>", String.Empty);
2675
2676 <div class="grid u-padding-bottom--lg">
2677 @if (settings.Image != null)
2678 {
2679 if (settings.Image.Path != null) {
2680 <div class="grid__col-3">
2681 <div class="grid__cell-img">
2682 @{
2683 settings.Image.Title = !String.IsNullOrEmpty(settings.Image.Title) ? settings.Image.Title : settings.Author;
2684 settings.Image.CssClass += " article__image article__image--ball";
2685 settings.Image.ImageDefault.Width = 200;
2686 settings.Image.ImageDefault.Height = 200;
2687 }
2688 @Render(settings.Image)
2689 </div>
2690 </div>
2691 }
2692 }
2693 <div class="grid__col-auto">
2694 @if (!String.IsNullOrEmpty(settings.Text))
2695 {
2696 <div class="article__quote dw-mod">
2697 <i class="fas fa-quote-right u-margin-bottom--lg"></i>
2698 @settings.Text
2699 <i class="fas fa-quote-right"></i>
2700 </div>
2701 }
2702 @if (!String.IsNullOrEmpty(settings.Author))
2703 {
2704 <div class="article__quote-author dw-mod">
2705 - @settings.Author
2706 </div>
2707 }
2708 </div>
2709 </div>
2710 }
2711 @using System.Reflection
2712 @using Dynamicweb.Rapido.Blocks.Components
2713 @using Dynamicweb.Rapido.Blocks.Components.Articles
2714 @using Dynamicweb.Rapido.Blocks
2715
2716 @* Component for the articles *@
2717
2718 @helper RenderArticleInfoTable(ArticleInfoTable settings)
2719 {
2720 <table class="table table--clean">
2721 @foreach (var row in settings.Rows)
2722 {
2723 string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two";
2724
2725 <tr>
2726 @if (!String.IsNullOrEmpty(row.Icon))
2727 {
2728 <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td>
2729 }
2730 <td class="u-no-margin-on-p-elements">
2731 <div class="u-bold">@row.Title</div>
2732 @if (!String.IsNullOrEmpty(row.SubTitle))
2733 {
2734 if (row.Link == null)
2735 {
2736 <div>@row.SubTitle</div>
2737 }
2738 else
2739 {
2740 <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a>
2741 }
2742 }
2743 </td>
2744 </tr>
2745 }
2746 </table>
2747 }
2748 @using System.Reflection
2749 @using Dynamicweb.Rapido.Blocks.Components
2750 @using Dynamicweb.Rapido.Blocks.Components.General
2751 @using Dynamicweb.Rapido.Blocks.Components.Articles
2752 @using Dynamicweb.Rapido.Blocks
2753
2754 @* Component for the articles *@
2755
2756 @helper RenderArticleGalleryModal(ArticleGalleryModal settings)
2757 {
2758 Modal galleryModal = new Modal
2759 {
2760 Id = "ParagraphGallery",
2761 Width = ModalWidth.Full,
2762 BodyTemplate = RenderArticleGalleryModalContent()
2763 };
2764
2765 @Render(galleryModal)
2766 }
2767
2768 @helper RenderArticleGalleryModalContent() {
2769 <div class="modal__image-min-size-wrapper">
2770 @Render(new Image {
2771 Id = "ParagraphGallery",
2772 Path = "#",
2773 CssClass = "modal--full__img",
2774 DisableLazyLoad = true,
2775 DisableImageEngine = true
2776 })
2777 </div>
2778
2779 <div class="modal__images-counter" id="ParagraphGallery_counter"></div>
2780
2781 @Render(new Button {
2782 Id = "ParagraphGallery_prev",
2783 ButtonType = ButtonType.Button,
2784 ButtonLayout = ButtonLayout.None,
2785 CssClass = "modal__prev-btn",
2786 Icon = new Icon { Prefix = "far", Name = "fa-angle-left", LabelPosition = IconLabelPosition.After },
2787 OnClick = "Gallery.prevImage('ParagraphGallery')"
2788 })
2789
2790 @Render(new Button {
2791 Id = "ParagraphGallery_next",
2792 ButtonType = ButtonType.Button,
2793 ButtonLayout = ButtonLayout.None,
2794 CssClass = "modal__next-btn",
2795 Icon = new Icon { Prefix = "far", Name = "fa-angle-right", LabelPosition = IconLabelPosition.After },
2796 OnClick = "Gallery.nextImage('ParagraphGallery')"
2797 })
2798 }
2799 @using System.Reflection
2800 @using Dynamicweb.Rapido.Blocks.Components
2801 @using Dynamicweb.Rapido.Blocks.Components.Articles
2802 @using Dynamicweb.Rapido.Blocks
2803
2804
2805 @* Component for the articles *@
2806
2807 @helper RenderArticleRelated(ArticleRelated settings)
2808 {
2809 string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : "";
2810 string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : "";
2811
2812 <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width">
2813 <div class="center-container dw-mod">
2814 <div class="grid u-padding">
2815 <div class="grid__col-md-12 grid__col-xs-12">
2816 <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2>
2817 </div>
2818 </div>
2819
2820 <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>
2821
2822 <script id="RelatedSimpleTemplate" type="text/x-template">
2823 {{#.}}
2824 <div class="grid u-padding-bottom--lg">
2825 {{#Cases}}
2826 <div class="grid__col-lg-3 grid__col-sm-6 image-hover--zoom dw-mod">
2827 <a href="{{link}}" class="u-full-height u-color-light--bg u-flex u-flex--column">
2828 {{#if image}}
2829 <div class="u-color-light--bg u-no-padding dw-mod">
2830 <div class="flex-img image-hover__wrapper">
2831 <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=680&height=314&crop=1&DoNotUpscale=True&Compression=75&image={{image}}" alt="{{title}}" />
2832 </div>
2833 </div>
2834 {{/if}}
2835
2836 <div class="card u-color-light--bg u-full-height dw-mod">
2837 <h3 class="article-list__item-header u-truncate-text dw-mod">{{title}}</h3>
2838 <p class="article__short-summary dw-mod">{{summary}}</p>
2839 </div>
2840 </a>
2841 </div>
2842 {{/Cases}}
2843 </div>
2844 {{/.}}
2845 </script>
2846 </div>
2847 </section>
2848 }
2849 @using System.Reflection
2850 @using Dynamicweb.Rapido.Blocks.Components
2851 @using Dynamicweb.Rapido.Blocks.Components.Articles
2852 @using Dynamicweb.Rapido.Blocks
2853
2854
2855 @* Component for the articles *@
2856
2857 @helper RenderArticleMenu(ArticleMenu settings)
2858 {
2859 if (!String.IsNullOrEmpty(settings.Title)) {
2860 <div class="u-margin u-border-bottom">
2861 <h3 class="u-no-margin">@settings.Title</h3>
2862 </div>
2863 }
2864
2865 <ul class="menu-left u-margin-bottom dw-mod">
2866 @foreach (var item in settings.Items)
2867 {
2868 @Render(item)
2869 }
2870 </ul>
2871 }
2872
2873 @helper RenderArticleMenuItem(ArticleMenuItem settings)
2874 {
2875 string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#";
2876
2877 if (!String.IsNullOrEmpty(settings.Title)) {
2878 <li class="menu-left__item dw-mod">
2879 <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a>
2880 </li>
2881 }
2882 }
2883 @using System.Reflection
2884 @using Dynamicweb.Rapido.Blocks.Components
2885 @using Dynamicweb.Rapido.Blocks.Components.Articles
2886 @using Dynamicweb.Rapido.Blocks
2887
2888 @* Component for the articles *@
2889
2890 @helper RenderArticleList(ArticleList settings)
2891 {
2892 if (Pageview != null)
2893 {
2894 bool isParagraph = Pageview.CurrentParagraph != null ? true : false;
2895 string[] sortArticlesListBy = new string[2];
2896
2897 if (isParagraph) {
2898 sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" };
2899 }
2900 else {
2901 sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" };
2902 }
2903
2904 string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString();
2905
2906 if (!settings.DisablePagination) {
2907 @RenderItemList(new
2908 {
2909 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle",
2910 ListSourceType = settings.SourceType,
2911 ListSourcePage = sourcePage,
2912 ItemFieldsList = "*",
2913 Filter = settings.Filter,
2914 ListOrderBy = sortArticlesListBy[0],
2915 ListOrderByDirection = sortArticlesListBy[1],
2916 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date",
2917 ListSecondOrderByDirection = "ASC",
2918 IncludeAllChildItems = true,
2919 ListTemplate = settings.Template,
2920 ListPageSize = settings.PageSize.ToString()
2921 });
2922 } else {
2923 @RenderItemList(new
2924 {
2925 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle",
2926 ListSourceType = settings.SourceType,
2927 ListSourcePage = sourcePage,
2928 ItemFieldsList = "*",
2929 Filter = settings.Filter,
2930 ListOrderBy = sortArticlesListBy[0],
2931 ListOrderByDirection = sortArticlesListBy[1],
2932 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date",
2933 ListSecondOrderByDirection = "ASC",
2934 IncludeAllChildItems = true,
2935 ListTemplate = settings.Template,
2936 ListPageSize = settings.PageSize.ToString(),
2937 ListViewMode = "Partial",
2938 ListShowTo = settings.PageSize + 1
2939 });
2940 }
2941 }
2942 }
2943 @using System.Reflection
2944 @using Dynamicweb.Rapido.Blocks.Components.Articles
2945
2946
2947 @* Component for the articles *@
2948
2949 @helper RenderArticleSummary(ArticleSummary settings)
2950 {
2951 if (!String.IsNullOrEmpty(settings.Text))
2952 {
2953 <div class="article__summary dw-mod">@settings.Text</div>
2954 }
2955 }
2956 @using System.Reflection
2957 @using Dynamicweb.Rapido.Blocks.Components
2958 @using Dynamicweb.Rapido.Blocks.Components.Articles
2959 @using Dynamicweb.Rapido.Blocks
2960
2961 @* Component for the articles *@
2962
2963 @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings)
2964 {
2965 string pageId = Pageview.ID.ToString();
2966 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All");
2967 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString());
2968
2969 foreach (var option in settings.Categories)
2970 {
2971 selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter;
2972 }
2973
2974 if (selectedFilter == pageId)
2975 {
2976 selectedFilter = Translate("All");
2977 }
2978
2979 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
2980 {
2981 <div class="u-pull--right u-margin-left">
2982 <div class="collection u-no-margin">
2983 <h5>@Translate("Category")</h5>
2984 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" />
2985 <div class="dropdown u-w180px dw-mod">
2986 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label>
2987 <div class="dropdown__content dw-mod">
2988 @foreach (var option in settings.Categories)
2989 {
2990 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div>
2991 }
2992 </div>
2993 <label class="dropdown-trigger-off" for="CategorySelector"></label>
2994 </div>
2995 </div>
2996 </div>
2997 }
2998 else
2999 {
3000 <div class="u-full-width u-margin-bottom">
3001 <h5 class="u-no-margin">@Translate("Category")</h5>
3002 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" />
3003 <div class="dropdown u-full-width dw-mod">
3004 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label>
3005 <div class="dropdown__content dw-mod">
3006 @foreach (var option in settings.Categories)
3007 {
3008 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div>
3009 }
3010 </div>
3011 <label class="dropdown-trigger-off" for="CategorySelector"></label>
3012 </div>
3013 </div>
3014 }
3015 }
3016 @using System.Reflection
3017 @using Dynamicweb.Rapido.Blocks.Components
3018 @using Dynamicweb.Rapido.Blocks.Components.Articles
3019 @using Dynamicweb.Rapido.Blocks
3020 @using System.Collections.Generic
3021
3022 @* Component for the articles *@
3023
3024 @helper RenderArticleListFilter(ArticleListFilter settings)
3025 {
3026 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All");
3027 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString());
3028
3029 if (settings.Options != null)
3030 {
3031 if (settings.Options is IEnumerable<dynamic>)
3032 {
3033 var options = (IEnumerable<dynamic>) settings.Options;
3034 settings.Options = options.OrderBy(item => item.Name);
3035 }
3036
3037 foreach (var option in settings.Options)
3038 {
3039 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter;
3040 }
3041
3042 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
3043 {
3044 <div class="u-pull--right u-margin-left">
3045 <div class="collection u-no-margin">
3046 <h5>@settings.Label</h5>
3047 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" />
3048 <div class="dropdown u-w180px dw-mod">
3049 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label>
3050 <div class="dropdown__content dw-mod">
3051 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div>
3052 @foreach (var option in settings.Options)
3053 {
3054 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div>
3055 }
3056 </div>
3057 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label>
3058 </div>
3059 </div>
3060 </div>
3061 }
3062 else
3063 {
3064 <div class="u-full-width u-margin-bottom">
3065 <h5 class="u-no-margin">@settings.Label</h5>
3066 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" />
3067 <div class="dropdown u-full-width w-mod">
3068 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label>
3069 <div class="dropdown__content dw-mod">
3070 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div>
3071 @foreach (var option in settings.Options)
3072 {
3073 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div>
3074 }
3075 </div>
3076 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label>
3077 </div>
3078 </div>
3079 }
3080 }
3081 }
3082 @using System.Reflection
3083 @using Dynamicweb.Rapido.Blocks.Components
3084 @using Dynamicweb.Rapido.Blocks.Components.Articles
3085 @using Dynamicweb.Rapido.Blocks
3086
3087 @* Component for the articles *@
3088
3089 @helper RenderArticleListSearch(ArticleListSearch settings)
3090 {
3091 string searchParameter = !string.IsNullOrEmpty(settings.SearchParameter) ? settings.SearchParameter : "Title";
3092 string searchWord = HttpContext.Current.Request.QueryString.Get(searchParameter);
3093 string searchString = !string.IsNullOrEmpty(searchWord) ? searchWord.Trim('*') : "";
3094 string className = "u-w340px u-pull--right u-margin-left";
3095
3096 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet")
3097 {
3098 className = "u-full-width";
3099 }
3100
3101 <div class="typeahead u-color-inherit u-margin-bottom dw-mod @className">
3102 <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 + '*')">
3103 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button>
3104 </div>
3105 }
3106 @using System.Reflection
3107 @using Dynamicweb.Rapido.Blocks.Components
3108 @using Dynamicweb.Rapido.Blocks.Components.Articles
3109 @using Dynamicweb.Rapido.Blocks
3110
3111 @* Component for the articles *@
3112
3113 @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings)
3114 {
3115 <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div>
3116 }
3117 @using System.Reflection
3118 @using Dynamicweb.Rapido.Blocks.Components
3119 @using Dynamicweb.Rapido.Blocks.Components.General
3120 @using Dynamicweb.Rapido.Blocks.Components.Articles
3121 @using Dynamicweb.Rapido.Blocks
3122 @using System.Text.RegularExpressions
3123
3124 @* Component for the articles *@
3125
3126 @helper RenderArticleListItem(ArticleListItem settings)
3127 {
3128 switch (settings.Type) {
3129 case ArticleListItemType.Card:
3130 @RenderArticleListItemCard(settings);
3131 break;
3132 case ArticleListItemType.List:
3133 @RenderArticleListItemList(settings);
3134 break;
3135 case ArticleListItemType.Simple:
3136 @RenderArticleListItemSimple(settings);
3137 break;
3138 default:
3139 @RenderArticleListItemCard(settings);
3140 break;
3141 }
3142 }
3143
3144 @helper RenderArticleListItemCard(ArticleListItem settings) {
3145 <a href="@settings.Link" class="u-full-height u-color-light--bg u-flex u-flex--column">
3146 <div class="u-color-light--bg u-no-padding dw-mod">
3147 @if (settings.Logo != null)
3148 {
3149 string backgroundImage = settings.Image != null ? "background-image:url(/Admin/Public/GetImage.ashx?width=992&height=760&crop=0&Compression=75&DoNotUpscale=True&image=" + settings.Image.Path + "); background-size: cover;" : "";
3150 settings.Logo.ImageDefault.Crop = 5;
3151 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width;
3152 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height;
3153 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage">
3154 @if (settings.Stickers != null)
3155 {
3156 if (settings.Stickers.Position != StickersListPosition.Custom && settings.Stickers.Position != StickersListPosition.None)
3157 {
3158 @Render(settings.Stickers);
3159 }
3160 }
3161 @RenderImage(settings.Logo)
3162 </div>
3163 } else if (settings.Image != null)
3164 {
3165 <div class="flex-img image-hover__wrapper u-position-relative dw-mod">
3166 @if (settings.Stickers != null)
3167 {
3168 if (settings.Stickers.Position != StickersListPosition.Custom && settings.Stickers.Position != StickersListPosition.None)
3169 {
3170 @Render(settings.Stickers);
3171 }
3172 }
3173 @Render(settings.Image)
3174 </div>
3175 }
3176 </div>
3177
3178 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary))
3179 {
3180 <div class="card u-color-light--bg u-full-height dw-mod">
3181 @if (settings.Stickers != null)
3182 {
3183 if (settings.Stickers.Position == StickersListPosition.Custom)
3184 {
3185 @Render(settings.Stickers);
3186 }
3187 }
3188 @if (!String.IsNullOrEmpty(settings.Title))
3189 {
3190 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3>
3191 }
3192 @if (!String.IsNullOrEmpty(settings.SubTitle))
3193 {
3194 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>
3195 }
3196 @if (!String.IsNullOrEmpty(settings.Summary))
3197 {
3198 <p class="article__short-summary dw-mod">@settings.Summary</p>
3199 }
3200 </div>
3201 }
3202 </a>
3203 }
3204
3205 @helper RenderArticleListItemList(ArticleListItem settings) {
3206 <a href="@settings.Link">
3207 <div class="grid u-color-light--bg u-no-padding dw-mod">
3208 <div class="grid__col-md-3">
3209 <div class="u-color-light--bg u-no-padding dw-mod">
3210 @if (settings.Logo != null)
3211 {
3212 string backgroundImage = settings.Image != null ? "background-image:url(/Admin/Public/GetImage.ashx?width=992&height=760&crop=0&Compression=75&DoNotUpscale=True&image=" + settings.Image.Path + "); background-size: cover;" : "";
3213 settings.Logo.ImageDefault.Crop = 5;
3214 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width;
3215 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height;
3216 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage">
3217 @if (settings.Stickers != null)
3218 {
3219 if (settings.Stickers.Position != StickersListPosition.Custom)
3220 {
3221 @Render(settings.Stickers);
3222 }
3223 }
3224 @RenderImage(settings.Logo)
3225 </div>
3226 } else if (settings.Image != null)
3227 {
3228 <div class="flex-img image-hover__wrapper dw-mod">
3229 @if (settings.Stickers != null)
3230 {
3231 if (settings.Stickers.Position != StickersListPosition.Custom)
3232 {
3233 @Render(settings.Stickers);
3234 }
3235 }
3236 @Render(settings.Image)
3237 </div>
3238 }
3239 </div>
3240 </div>
3241
3242 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary))
3243 {
3244 <div class="grid__col-md-9">
3245 @if (!String.IsNullOrEmpty(settings.Title))
3246 {
3247 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3>
3248 }
3249 @if (settings.Stickers != null)
3250 {
3251 if (settings.Stickers.Position == StickersListPosition.Custom)
3252 {
3253 @Render(settings.Stickers);
3254 }
3255 }
3256 @if (!String.IsNullOrEmpty(settings.SubTitle))
3257 {
3258 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>
3259 }
3260 @if (!String.IsNullOrEmpty(settings.Summary))
3261 {
3262 <p class="article__short-summary dw-mod">@settings.Summary</p>
3263 }
3264 </div>
3265 }
3266 </div>
3267 </a>
3268 }
3269
3270 @helper RenderArticleListItemSimple(ArticleListItem settings) {
3271 <a href="@settings.Link" class="u-color-inherit">
3272 <div class="grid u-color-light--bg u-no-padding dw-mod">
3273 <div class="grid__col-md-12">
3274 @if (!String.IsNullOrEmpty(settings.Title))
3275 {
3276 <div class="article-list-item__header u-truncate-text u-no-margin dw-mod">@settings.Title</div>
3277 }
3278 @if (!String.IsNullOrEmpty(settings.SubTitle))
3279 {
3280 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>
3281 }
3282 </div>
3283 </div>
3284 </a>
3285 }
3286 @using System.Reflection
3287 @using Dynamicweb.Rapido.Blocks.Components.Articles
3288
3289
3290 @* Component for the articles *@
3291
3292 @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings)
3293 {
3294 <small class="article__subscription">
3295 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date)))
3296 {
3297 <text>@Translate("Written")</text>
3298 }
3299 @if (!string.IsNullOrWhiteSpace(settings.Author))
3300 {
3301 <text>@Translate("by") @settings.Author</text>
3302 }
3303 @if (!string.IsNullOrWhiteSpace(settings.Date))
3304 {
3305 <text>@Translate("on") @settings.Date</text>
3306 }
3307 </small>
3308 }
3309 @using System.Reflection
3310 @using Dynamicweb.Rapido.Blocks.Components.Articles
3311 @using Dynamicweb.Rapido.Blocks.Components.General
3312
3313
3314 @* Component for the articles *@
3315
3316 @helper RenderArticleLink(ArticleLink settings)
3317 {
3318 if (!string.IsNullOrEmpty(settings.Title))
3319 {
3320 Button link = new Button {
3321 ConfirmText = settings.ConfirmText,
3322 ConfirmTitle = settings.ConfirmTitle,
3323 ButtonType = settings.ButtonType,
3324 Id = settings.Id,
3325 Title = settings.Title,
3326 AltText = settings.AltText,
3327 OnClick = settings.OnClick,
3328 CssClass = settings.CssClass,
3329 Disabled = settings.Disabled,
3330 Icon = settings.Icon,
3331 Name = settings.Name,
3332 Href = settings.Href,
3333 ButtonLayout = settings.ButtonLayout,
3334 ExtraAttributes = settings.ExtraAttributes
3335 };
3336 <div class="grid__cell">
3337 @Render(link)
3338 </div>
3339 }
3340 }
3341 @using System.Reflection
3342 @using Dynamicweb.Rapido.Blocks
3343 @using Dynamicweb.Rapido.Blocks.Components.Articles
3344 @using Dynamicweb.Rapido.Blocks.Components.General
3345
3346
3347 @* Component for the articles *@
3348
3349 @helper RenderArticleCarousel(ArticleCarousel settings)
3350 {
3351 <div class="grid">
3352 <div class="grid__col-12 u-no-padding u-margin-bottom">
3353 <div class="carousel" id="carousel_@settings.Id">
3354 <div class="carousel__container js-carousel-slides dw-mod">
3355 @RenderBlockList(settings.SubBlocks)
3356 </div>
3357 </div>
3358 </div>
3359 </div>
3360
3361 <script>
3362 document.addEventListener("DOMContentLoaded", function () {
3363 new CarouselModule("#carousel_@settings.Id", {
3364 slideTime: 0,
3365 dots: true
3366 });
3367 });
3368 </script>
3369 }
3370
3371 @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings)
3372 {
3373 string imageEngine = "/Admin/Public/GetImage.ashx?";
3374
3375 string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image;
3376 if (settings.ImageSettings != null)
3377 {
3378 defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : "";
3379 defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : "";
3380 defaultImage += "Crop=" + settings.ImageSettings.Crop + "&";
3381 defaultImage += "Compression=" + settings.ImageSettings.Compression + "&";
3382 defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&";
3383 defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&";
3384 }
3385 defaultImage += "&Image=" + settings.Image;
3386
3387 <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')">
3388 <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title">
3389 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2>
3390 <div class="article-list__item-info">
3391 @if (settings.Stickers != null)
3392 {
3393 settings.Stickers.Position = StickersListPosition.Custom;
3394 @Render(settings.Stickers);
3395 }
3396
3397 <small class="u-margin-top--lg u-color-light">
3398 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date)))
3399 {
3400 <text>@Translate("Written")</text>
3401 }
3402 @if (!string.IsNullOrWhiteSpace(settings.Author))
3403 {
3404 <text>@Translate("by") @settings.Author</text>
3405 }
3406 @if (!string.IsNullOrWhiteSpace(settings.Date))
3407 {
3408 <text>@Translate("on") @settings.Date</text>
3409 }
3410 </small>
3411 </div>
3412
3413 <h3 class="article__short-summary u-color-light">@settings.Summary</h3>
3414 </a>
3415 @if (settings.UseFilters == true)
3416 {
3417 <div class="background-image image-filter image-filter--darken dw-mod"></div>
3418 }
3419 </div>
3420 }
3421 @using System.Text.RegularExpressions
3422 @using Dynamicweb.Rapido.Blocks.Components
3423 @using Dynamicweb.Rapido.Blocks.Components.General
3424 @using Dynamicweb.Rapido.Blocks.Components.Articles
3425 @using Dynamicweb.Rapido.Blocks
3426
3427 @* Component for the articles *@
3428
3429 @helper RenderArticleVideo(ArticleVideo settings)
3430 {
3431 if (settings.Url != null)
3432 {
3433 //getting video ID from youtube URL
3434 string videoCode = settings.Url;
3435 Regex regex = new Regex(@".be\/(.[^?]*)");
3436 Match match = regex.Match(videoCode);
3437 string videoId = "";
3438 if (match.Success)
3439 {
3440 videoId = match.Groups[1].Value;
3441 }
3442 else
3443 {
3444 regex = new Regex(@"v=([^&]+)");
3445 match = regex.Match(videoCode);
3446 if (match.Success)
3447 {
3448 videoId = match.Groups[1].Value;
3449 }
3450 }
3451
3452 int autoPlay = settings.AutoPlay == "true" ? 1 : 0;
3453
3454 <div class="video-wrapper">
3455 <div class="cookieconsent-optout-marketing">
3456 <div class="video-cookie__wrapper">
3457 <div class="video-cookie__content">
3458 <p>
3459 Accepter venligst marketing cookies for at se denne video. <br />
3460 <a class="btn btn--tertiary btn--no-underline dw-mod u-margin-top" href="javascript:Cookiebot.renew()">Opdatér samtykke</a>
3461 </p>
3462 </div>
3463 </div>
3464 </div>
3465 <div data-cookieconset="marketing" class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div>
3466 </div>
3467 }
3468 }
3469
3470
3471
3472 @* Simple helpers *@
3473
3474 @*Requires the Gallery ItemType that comes with Rapido*@
3475 @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) {
3476 if (gallery != null && gallery.Count > 0)
3477 {
3478 int count = 1;
3479
3480 foreach (var item in gallery)
3481 {
3482 if (item.GetFile("ImagePath") != null)
3483 {
3484 string image = item.GetFile("ImagePath").PathUrlEncoded;
3485 string imagePrefix = "/Admin/Public/GetImage.ashx?width=1200&height=820&crop=5&Compression=75&DoNotUpscale=1&image=";
3486 int imagesCount = gallery.Count;
3487
3488 if (count == 1)
3489 {
3490 <label class="gallery" for="ParagraphGalleryModalTrigger" onclick="Gallery.openImage(this.querySelector('.js-gallery'))">
3491 <span class="gallery__main-image">
3492 <img src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=992&height=760&crop=0&Compression=75&DoNotUpscale=1&image=@image" class="b-lazy flex-img js-gallery" alt="" data-for="ParagraphGallery" data-image="@imagePrefix@image" />
3493 </span>
3494 <span class="gallery__image-counter">
3495 <i class="fas fa-camera fa-2x"></i> <span class="gallery__image-counter__number">@imagesCount</span>
3496 <span class="gallery__image-counter__text">@Translate("See all") <i class="fas fa-angle-right"></i></span>
3497 </span>
3498 </label>
3499 }
3500 else
3501 {
3502 <div class="u-hidden js-gallery" data-for="ParagraphGallery" data-image="@imagePrefix@image"></div>
3503 }
3504
3505 count++;
3506 }
3507 }
3508
3509 @Render(new ArticleGalleryModal())
3510 }
3511 }
3512
3513 @helper RenderMobileFilters(List<Block> subBlocks)
3514 {
3515 if (subBlocks.Count > 0)
3516 {
3517 <div class="grid__col-12">
3518 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" />
3519 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters">
3520 @RenderBlockList(subBlocks)
3521 </div>
3522 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label>
3523 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label>
3524 </div>
3525 }
3526 }
3527
3528
3529 @* Include the Blocks for the page *@
3530 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
3531
3532 @using System
3533 @using System.Web
3534 @using System.Collections.Generic
3535 @using Dynamicweb.Rapido.Blocks.Extensibility
3536 @using Dynamicweb.Rapido.Blocks
3537
3538 @functions {
3539 string GoogleTagManagerID = "";
3540 string GoogleAnalyticsID = "";
3541 }
3542
3543 @{
3544 GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID");
3545 GoogleAnalyticsID = Model.Area.Item.GetItem("Settings").GetString("GoogleAnalyticsTrackingID");
3546
3547 BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master");
3548
3549 if (!string.IsNullOrWhiteSpace(GoogleAnalyticsID))
3550 {
3551 Block tagManager = new Block()
3552 {
3553 Id = "GoogleAnalytics",
3554 SortId = 0,
3555 Template = RenderGoogleAnalyticsSnippet()
3556 };
3557 topSnippetsBlocksPage.Add("Head", tagManager);
3558 }
3559
3560 if (!string.IsNullOrWhiteSpace(GoogleTagManagerID))
3561 {
3562 Block tagManager = new Block()
3563 {
3564 Id = "TagManager",
3565 SortId = 1,
3566 Template = RenderGoogleTagManager()
3567 };
3568 topSnippetsBlocksPage.Add("Head", tagManager);
3569
3570 Block tagManagerBodySnippet = new Block()
3571 {
3572 Id = "TagManagerBodySnippet",
3573 SortId = 1,
3574 Template = RenderGoogleTagManagerBodySnippet()
3575 };
3576 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManagerBodySnippet);
3577 }
3578
3579 Block facebookPixel = new Block()
3580 {
3581 Id = "FacebookPixel",
3582 SortId = 2,
3583 Template = RenderFacebookPixel()
3584 };
3585
3586 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel);
3587 }
3588
3589 @helper RenderGoogleAnalyticsSnippet()
3590 {
3591 <!-- Global site tag (gtag.js) - Google Analytics -->
3592 <script async src="https://www.googletagmanager.com/gtag/js?id=@GoogleAnalyticsID"></script>
3593 <script>
3594 window.dataLayer = window.dataLayer || [];
3595 function gtag(){dataLayer.push(arguments);}
3596 gtag('js', new Date());
3597
3598 gtag('config', '@GoogleAnalyticsID');
3599 </script>
3600
3601 }
3602
3603 @helper RenderGoogleTagManager()
3604 {
3605 <script>
3606 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
3607 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
3608 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
3609 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
3610 })(window,document,'script','dataLayer','@GoogleTagManagerID');
3611 </script>
3612 }
3613
3614 @helper RenderGoogleTagManagerBodySnippet()
3615 {
3616 <!-- Google Tag Manager (noscript) -->
3617 <noscript>
3618 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID"
3619 height="0" width="0" style="display:none;visibility:hidden"></iframe>
3620 </noscript>
3621 <!-- End Google Tag Manager (noscript) -->
3622 }
3623
3624 @helper RenderFacebookPixel()
3625 {
3626 string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID");
3627
3628 if (!string.IsNullOrWhiteSpace(FacebookPixelID))
3629 {
3630 <!-- Facebook Pixel Code -->
3631 <script>
3632 !function(f,b,e,v,n,t,s)
3633 {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
3634 n.callMethod.apply(n,arguments):n.queue.push(arguments)};
3635 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
3636 n.queue=[];t=b.createElement(e);t.async=!0;
3637 t.src=v;s=b.getElementsByTagName(e)[0];
3638 s.parentNode.insertBefore(t,s)}(window, document,'script',
3639 'https://connect.facebook.net/en_US/fbevents.js');
3640 fbq('init', '@FacebookPixelID');
3641 fbq('track', 'PageView');
3642 </script>
3643 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript>
3644 }
3645 }
3646 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
3647
3648 @using System
3649 @using System.Web
3650 @using System.Collections.Generic
3651 @using Dynamicweb.Rapido.Blocks
3652 @using Dynamicweb.Rapido.Blocks.Extensibility
3653 @using Dynamicweb.Security.UserManagement
3654 @using Dynamicweb.Security.UserManagement.ExternalAuthentication
3655 @using Dynamicweb.Rapido.Blocks.Components.General
3656
3657 @{
3658 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master");
3659
3660 Block loginModal = new Block()
3661 {
3662 Id = "LoginModal",
3663 SortId = 10,
3664 Component = new Modal
3665 {
3666 Id = "SignIn",
3667 Heading = new Heading
3668 {
3669 Level = 0,
3670 Title = Translate("Sign in")
3671 },
3672 Width = ModalWidth.Sm,
3673 BodyTemplate = RenderLoginForm()
3674 }
3675 };
3676
3677 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal);
3678 }
3679
3680 @helper RenderLoginForm()
3681 {
3682 int pageId = Model.TopPage.ID;
3683 string userSignedInErrorText = "";
3684 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
3685 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery";
3686 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");
3687 bool showModalOnStart = pageId != GetPageIdByNavigationTag("CustomerCenter") && Model.LogOnFailed;
3688 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");
3689 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink");
3690
3691 ProviderCollection providers = Provider.GetActiveProviders();
3692
3693 if (Model.LogOnFailed)
3694 {
3695 switch (Model.LogOnFailedReason)
3696 {
3697 case LogOnFailedReason.PasswordLengthInvalid:
3698 userSignedInErrorText = Translate("Password length is invalid");
3699 break;
3700 case LogOnFailedReason.IncorrectLogin:
3701 userSignedInErrorText = Translate("Invalid email or password");
3702 break;
3703 case LogOnFailedReason.ExceededFailedLogOnLimit:
3704 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked");
3705 break;
3706 case LogOnFailedReason.LoginLocked:
3707 userSignedInErrorText = Translate("The user account is temporarily locked");
3708 break;
3709 case LogOnFailedReason.PasswordExpired:
3710 userSignedInErrorText = Translate("The password has expired and needs to be renewed");
3711 break;
3712 default:
3713 userSignedInErrorText = Translate("An unknown error occured");
3714 break;
3715 }
3716 }
3717
3718 Form form = new Form { Method = FormMethod.Post, Name = "LoginModalForm" };
3719
3720 TextField passwordField = new TextField { Id = "login-password", Type = TextFieldType.Password, Name = "password", Label = Translate("Password"), Required = true };
3721
3722 if (!hideForgotPasswordLink) {
3723 passwordField.Link = new Link { Title = Translate("Forgot password?"), Href = "/Default.aspx?id=" + signInProfilePageId + "&LoginAction=Recovery" };
3724 }
3725
3726 form.Add(new HiddenField { Name = "ID", Value = Converter.ToString(pageId) });
3727 form.Add(new HiddenField { Name = "DWExtranetUsernameRemember", Value = "True" });
3728 form.Add(new HiddenField { Name = "DWExtranetPasswordRemember", Value = "True" });
3729 form.Add(new HiddenField { Name = "LoginAction", Value = "Login" });
3730 form.Add(new TextField { Id = "LoginUsername", Name = "username", Label = Translate("Email/Brugernavn"), CssClass = "u-full-width", Required = true });
3731 form.Add(passwordField);
3732 form.Add(new NotificationMessage { Message = userSignedInErrorText, MessageType = NotificationMessageType.Error });
3733 form.Add(new CheckboxField { Id = "LoginRememberMe", Value = "True", Name = "Autologin", Label = Translate("Remember me") });
3734 form.Add(new Button { ButtonType = ButtonType.Submit, Title = Translate("Sign in"), CssClass = "btn--full", OnClick = "Buttons.LockButton(event)" });
3735
3736 foreach (Provider LoginProvider in providers)
3737 {
3738 var ProviderName = LoginProvider.Name.ToLower();
3739 form.Add(new Link {
3740 Href = "/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=" + LoginProvider.ID,
3741 Icon = new Icon { Prefix = "fab", Name = "fa-" + ProviderName, CssClass = "fa-1_5x", LabelPosition = IconLabelPosition.After },
3742 ButtonLayout = ButtonLayout.LinkClean,
3743 CssClass = "btn--condensed u-margin-bottom u-margin-right u-inline-block u-color-" + ProviderName,
3744 AltText = ProviderName
3745 });
3746 }
3747
3748 if (!hideCreateAccountLink) {
3749 form.Add(new Text { Content = "<div class=\"u-border-top u-full-width u-margin-bottom--lg\"></div>" });
3750 form.Add(new Link
3751 {
3752 Href = "/Default.aspx?id=" + createAccountPageId,
3753 ButtonLayout = ButtonLayout.LinkClean,
3754 Title = Translate("Create account"),
3755 CssClass = "u-full-width u-ta-center"
3756 });
3757 }
3758
3759 @Render(form)
3760
3761 if (showModalOnStart)
3762 {
3763 <script>
3764 document.getElementById("SignInModalTrigger").checked = true;
3765 </script>
3766 }
3767 }
3768
3769 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet")
3770 {
3771 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
3772
3773 @using System
3774 @using System.Web
3775 @using System.Collections.Generic
3776 @using Dynamicweb.Rapido.Blocks.Extensibility
3777 @using Dynamicweb.Rapido.Blocks
3778 @using Dynamicweb.Rapido.Services
3779
3780
3781 @functions {
3782 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master");
3783 }
3784
3785 @{
3786 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";
3787 bool mobileHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");
3788 bool mobileHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart") || !Dynamicweb.Rapido.Services.User.IsBuyingAllowed();
3789
3790 Block mobileHeader = new Block()
3791 {
3792 Id = "MobileTop",
3793 SortId = 10,
3794 Template = RenderMobileTop(),
3795 SkipRenderBlocksList = true
3796 };
3797 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader);
3798
3799 Block mobileHeaderNavigation = new Block()
3800 {
3801 Id = "MobileHeaderNavigation",
3802 SortId = 10,
3803 Template = RenderMobileHeaderNavigation(),
3804 SkipRenderBlocksList = true,
3805 BlocksList = new List<Block> {
3806 new Block {
3807 Id = "MobileHeaderNavigationTrigger",
3808 SortId = 10,
3809 Template = RenderMobileHeaderNavigationTrigger()
3810 }
3811 }
3812 };
3813 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation);
3814
3815 Block mobileHeaderLogo = new Block()
3816 {
3817 Id = "MobileHeaderLogo",
3818 SortId = 20,
3819 Template = RenderMobileHeaderLogo(),
3820 SkipRenderBlocksList = true
3821 };
3822 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo);
3823
3824 Block mobileHeaderActions = new Block()
3825 {
3826 Id = "MobileHeaderActions",
3827 SortId = 30,
3828 Template = RenderMobileTopActions(),
3829 SkipRenderBlocksList = true
3830 };
3831 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions);
3832
3833 if (!mobileHideSearch)
3834 {
3835 Block mobileHeaderSearch = new Block
3836 {
3837 Id = "MobileHeaderSearch",
3838 SortId = 10,
3839 Template = RenderMobileTopSearch()
3840 };
3841 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch);
3842 }
3843
3844 Block mobileHeaderMiniCart;
3845
3846 if (!mobileHideCart)
3847 {
3848 mobileHeaderMiniCart = new Block
3849 {
3850 Id = "MobileHeaderMiniCart",
3851 SortId = 20,
3852 Template = RenderMobileTopMiniCart()
3853 };
3854
3855 Block miniCartCounterScriptTemplate = new Block
3856 {
3857 Id = "MiniCartCounterScriptTemplate",
3858 Template = RenderMobileMiniCartCounterContent()
3859 };
3860 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate);
3861 }
3862 else
3863 {
3864 mobileHeaderMiniCart = new Block
3865 {
3866 Id = "MobileHeaderMiniCart",
3867 SortId = 20
3868 };
3869 }
3870
3871 if (!mobileHideSearch)
3872 {
3873 Block mobileHeaderSearchBar = new Block()
3874 {
3875 Id = "MobileHeaderSearchBar",
3876 SortId = 30,
3877 Template = RenderMobileTopSearchBar()
3878 };
3879 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar);
3880 }
3881
3882 switch (mobileTopLayout)
3883 {
3884 case "nav-left":
3885 mobileHeaderNavigation.SortId = 10;
3886 mobileHeaderLogo.SortId = 20;
3887 mobileHeaderActions.SortId = 30;
3888 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart);
3889 break;
3890 case "nav-right":
3891 mobileHeaderLogo.SortId = 10;
3892 mobileHeaderActions.SortId = 20;
3893 mobileHeaderNavigation.SortId = 30;
3894 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart);
3895 break;
3896 case "nav-search-left":
3897 mobileHeaderNavigation.SortId = 10;
3898 mobileHeaderLogo.SortId = 20;
3899 mobileHeaderActions.SortId = 30;
3900 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart);
3901 break;
3902 case "search-left":
3903 mobileHeaderActions.SortId = 10;
3904 mobileHeaderLogo.SortId = 20;
3905 mobileHeaderNavigation.SortId = 30;
3906 mobileHeaderMiniCart.SortId = 0;
3907 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart);
3908 break;
3909 }
3910 }
3911
3912
3913 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
3914
3915 @using System
3916 @using System.Web
3917 @using Dynamicweb.Rapido.Blocks.Extensibility
3918 @using Dynamicweb.Rapido.Blocks
3919
3920 @{
3921 BlocksPage customMobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master");
3922 }
3923
3924
3925
3926
3927 @helper RenderMobileTop()
3928 {
3929 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList();
3930
3931 <nav class="main-navigation-mobile dw-mod">
3932 <div class="center-container top-container__center-container dw-mod">
3933 <div class="grid grid--align-center">
3934 @RenderBlockList(subBlocks)
3935 </div>
3936 </div>
3937 </nav>
3938 }
3939
3940 @helper RenderMobileHeaderNavigation()
3941 {
3942 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList();
3943
3944 <div class="grid__col-auto-width">
3945 <ul class="menu dw-mod">
3946 @RenderBlockList(subBlocks)
3947 </ul>
3948 </div>
3949 }
3950
3951 @helper RenderMobileHeaderNavigationTrigger()
3952 {
3953 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">
3954 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label>
3955 </li>
3956 }
3957
3958 @helper RenderMobileHeaderLogo()
3959 {
3960 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList();
3961
3962 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";
3963 string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : "";
3964 string firstPageId = Model.Area.FirstActivePage.ID.ToString();
3965 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName");
3966
3967 string mobileLogo = "/Files/Images/logo-dynamicweb.png";
3968 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null)
3969 {
3970 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded;
3971 }
3972
3973 if (Path.GetExtension(mobileLogo).ToLower() != ".svg")
3974 {
3975 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&width=100&crop=5&Compression=75&image=" + mobileLogo;
3976 }
3977 else
3978 {
3979 mobileLogo = HttpUtility.UrlDecode(mobileLogo);
3980 }
3981
3982 <div class="grid__col-auto grid__col--bleed">
3983 <div class="grid__cell @centeredLogo">
3984 <a href="/Default.aspx?ID=@firstPageId" class="logo logo--mobile u-inline-block dw-mod">
3985 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" />
3986 </a>
3987 </div>
3988
3989 @RenderBlockList(subBlocks)
3990 </div>
3991 }
3992
3993 @helper RenderMobileTopActions()
3994 {
3995 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList();
3996
3997 <div class="grid__col-auto-width">
3998 <ul class="menu dw-mod">
3999 @RenderBlockList(subBlocks)
4000 </ul>
4001 </div>
4002 }
4003
4004 @helper RenderMobileTopSearch()
4005 {
4006 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">
4007 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod">
4008 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i>
4009 </label>
4010 </li>
4011 }
4012
4013 @helper RenderMobileTopMiniCart()
4014 {
4015 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
4016 int cartPageId = GetPageIdByNavigationTag("CartPage");
4017 double cartProductsCount = Model.Cart.TotalProductsCount;
4018
4019 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper">
4020 <div class="mini-cart dw-mod">
4021 <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">
4022 <div class="u-inline u-position-relative">
4023 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i>
4024 <div class="mini-cart__counter dw-mod">
4025 <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">
4026 <div class="js-mini-cart-counter-content" data-count="@cartProductsCount">
4027 @cartProductsCount
4028 </div>
4029 </div>
4030 </div>
4031 </div>
4032 </a>
4033 </div>
4034 </li>
4035 }
4036
4037 @helper RenderMobileTopSearchBar()
4038 {
4039 string searchFeedId = "";
4040 string searchSecondFeedId = "";
4041 int groupsFeedId;
4042 int productsPageId = GetPageIdByNavigationTag("ProductsPage");
4043 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;
4044 string resultPageLink;
4045 string searchPlaceholder;
4046 string searchType = "product-search";
4047 string searchTemplate;
4048 string searchContentTemplate = "";
4049 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? "";
4050 bool showGroups = true;
4051
4052 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch")
4053 {
4054 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true";
4055 resultPageLink = contentSearchPageLink;
4056 searchPlaceholder = Translate("Search page");
4057 groupsFeedId = 0;
4058 searchType = "content-search";
4059 searchTemplate = "SearchPagesTemplate";
4060 showGroups = false;
4061 }
4062 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch")
4063 {
4064 searchFeedId = productsPageId + "&feed=true";
4065 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true";
4066 resultPageLink = Converter.ToString(productsPageId);
4067 searchPlaceholder = Translate("Search products or pages");
4068 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed");
4069 searchType = "combined-search";
4070 searchTemplate = "SearchPagesTemplateWrap";
4071 searchContentTemplate = "SearchPagesTemplateWrap";
4072 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector");
4073 }
4074 else
4075 {
4076 resultPageLink = Converter.ToString(productsPageId);
4077 searchFeedId = productsPageId + "&feed=true";
4078 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed");
4079 searchPlaceholder = Translate("Search products");
4080 searchTemplate = "SearchProductsTemplate";
4081 searchType = "product-search";
4082 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector");
4083 }
4084
4085 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" />
4086
4087 <div class="main-navigation-mobile typeahead-mobile dw-mod">
4088 <div class="center-container top-container__center-container dw-mod">
4089 <div class="grid">
4090 <div class="grid__col-auto">
4091 <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">
4092 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue" id="mobileSearchInput">
4093 @if (string.IsNullOrEmpty(searchSecondFeedId))
4094 {
4095 <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>
4096 }
4097 else
4098 {
4099 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid">
4100 <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>
4101 <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>
4102 </div>
4103 }
4104 <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>
4105 </div>
4106 </div>
4107 <div class="grid__col-auto-width">
4108 <ul class="menu dw-mod">
4109 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">
4110 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod">
4111 <i class="fas fa-times fa-1_5x"></i>
4112 </label>
4113 </li>
4114 </ul>
4115 </div>
4116 </div>
4117 </div>
4118 </div>
4119
4120 <script>
4121
4122 window.onload = function () {
4123
4124
4125 var searchInputField = document.getElementById("mobileSearchInput");
4126 var mobileSearchHiddenCheckbox = document.getElementById("MobileSearchTrigger");
4127
4128 mobileSearchHiddenCheckbox.onchange = function () { searchInputField.focus(); };
4129
4130 };
4131
4132 </script>
4133 }
4134
4135 @helper RenderMobileMiniCartCounterContent()
4136 {
4137 <script id="MiniCartCounterContent" type="text/x-template">
4138 {{#.}}
4139 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}">
4140 {{numberofproducts}}
4141 </div>
4142 {{/.}}
4143 </script>
4144 }
4145 </text>
4146 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4147
4148 @using System
4149 @using System.Web
4150 @using System.Collections.Generic
4151 @using Dynamicweb.Rapido.Blocks.Extensibility
4152 @using Dynamicweb.Rapido.Blocks
4153
4154 @functions {
4155 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master");
4156 }
4157
4158 @{
4159 bool mobileNavigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn");
4160 bool mobileHideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");
4161 bool mobileHideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile");
4162 bool mobileHideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders");
4163 bool mobileHideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards");
4164 bool mobileHideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites");
4165
4166 Block mobileNavigation = new Block()
4167 {
4168 Id = "MobileNavigation",
4169 SortId = 10,
4170 Template = MobileNavigation(),
4171 SkipRenderBlocksList = true
4172 };
4173 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation);
4174
4175 if (Model.CurrentUser.ID > 0 && !mobileHideMyProfileLink)
4176 {
4177 Block mobileNavigationSignIn = new Block
4178 {
4179 Id = "MobileNavigationSignIn",
4180 SortId = 10,
4181 Template = RenderMobileNavigationSignIn()
4182 };
4183 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn);
4184 }
4185
4186 Block mobileNavigationMenu = new Block
4187 {
4188 Id = "MobileNavigationMenu",
4189 SortId = 20,
4190 Template = RenderMobileNavigationMenu()
4191 };
4192 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu);
4193
4194 Block mobileNavigationActions = new Block
4195 {
4196 Id = "MobileNavigationActions",
4197 SortId = 30,
4198 Template = RenderMobileNavigationActions(),
4199 SkipRenderBlocksList = true
4200 };
4201 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions);
4202
4203 if (!mobileNavigationItemsHideSignIn)
4204 {
4205 if (Model.CurrentUser.ID <= 0)
4206 {
4207 Block mobileNavigationSignInAction = new Block
4208 {
4209 Id = "MobileNavigationSignInAction",
4210 SortId = 10,
4211 Template = RenderMobileNavigationSignInAction()
4212 };
4213 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction);
4214
4215 if (!mobileHideCreateAccountLink)
4216 {
4217 Block mobileNavigationCreateAccountAction = new Block
4218 {
4219 Id = "MobileNavigationCreateAccountAction",
4220 SortId = 20,
4221 Template = RenderMobileNavigationCreateAccountAction()
4222 };
4223 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction);
4224 }
4225 }
4226 else
4227 {
4228 if (!mobileHideMyOrdersLink)
4229 {
4230 Block mobileNavigationOrdersAction = new Block
4231 {
4232 Id = "MobileNavigationOrdersAction",
4233 SortId = 20,
4234 Template = RenderMobileNavigationOrdersAction()
4235 };
4236 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction);
4237 }
4238 if (!mobileHideMyFavoritesLink)
4239 {
4240 Block mobileNavigationFavoritesAction = new Block
4241 {
4242 Id = "MobileNavigationFavoritesAction",
4243 SortId = 30,
4244 Template = RenderMobileNavigationFavoritesAction()
4245 };
4246 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction);
4247 }
4248 if (!mobileHideMySavedCardsLink)
4249 {
4250 Block mobileNavigationSavedCardsAction = new Block
4251 {
4252 Id = "MobileNavigationFavoritesAction",
4253 SortId = 30,
4254 Template = RenderMobileNavigationSavedCardsAction()
4255 };
4256 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction);
4257 }
4258
4259 Block mobileNavigationSignOutAction = new Block
4260 {
4261 Id = "MobileNavigationSignOutAction",
4262 SortId = 40,
4263 Template = RenderMobileNavigationSignOutAction()
4264 };
4265 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction);
4266 }
4267 }
4268
4269 if (Model.Languages.Count > 1)
4270 {
4271 Block mobileNavigationLanguagesAction = new Block
4272 {
4273 Id = "MobileNavigationLanguagesAction",
4274 SortId = 50,
4275 Template = RenderMobileNavigationLanguagesAction()
4276 };
4277 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction);
4278 }
4279 }
4280
4281
4282 @helper MobileNavigation()
4283 {
4284 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList();
4285 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left";
4286 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right";
4287
4288 <!-- Trigger for mobile navigation -->
4289 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" />
4290
4291 <!-- Mobile navigation -->
4292 <nav class="mobile-navigation mobile-navigation--@position dw-mod">
4293 <div class="mobile-navigation__wrapper" id="mobileNavigationWrapper">
4294 @RenderBlockList(subBlocks)
4295 </div>
4296 </nav>
4297
4298 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label>
4299 }
4300
4301 @helper RenderMobileNavigationSignIn()
4302 {
4303 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4304 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");
4305 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
4306 string myProfilePageLink = linkStart + myProfilePageId;
4307 string userName = Model.CurrentUser.FirstName;
4308 if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(Model.CurrentUser.LastName))
4309 {
4310 userName += " " + Model.CurrentUser.LastName;
4311 }
4312 if (string.IsNullOrEmpty(userName))
4313 {
4314 userName = Model.CurrentUser.Name;
4315 }
4316 if (string.IsNullOrEmpty(userName))
4317 {
4318 userName = Model.CurrentUser.UserName;
4319 }
4320 if (string.IsNullOrEmpty(userName))
4321 {
4322 userName = Model.CurrentUser.Email;
4323 }
4324
4325 <ul class="menu menu-mobile">
4326 <li class="menu-mobile__item">
4327 <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>
4328 </li>
4329 </ul>
4330 }
4331
4332 @helper RenderMobileNavigationMenu()
4333 {
4334 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides";
4335 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt";
4336 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3";
4337 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");
4338 int startLevel = 0;
4339
4340 @RenderNavigation(new
4341 {
4342 id = "mobilenavigation",
4343 cssclass = "menu menu-mobile dwnavigation",
4344 startLevel = @startLevel,
4345 ecomStartLevel = @startLevel + 1,
4346 endlevel = @levels,
4347 expandmode = "all",
4348 template = @menuTemplate
4349 })
4350
4351 if (isSlidesDesign)
4352 {
4353 <script>
4354 function goToLevel(level) {
4355 document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%";
4356 }
4357
4358 document.addEventListener('DOMContentLoaded', function () {
4359 goToLevel(document.getElementById('mobileNavigationWrapper').querySelectorAll('input[type=radio]:checked').length);
4360 });
4361 </script>
4362 }
4363
4364 if (renderPagesInToolBar)
4365 {
4366 @RenderNavigation(new
4367 {
4368 id = "topToolsMobileNavigation",
4369 cssclass = "menu menu-mobile dwnavigation",
4370 template = "ToolsMenuForMobile.xslt"
4371 })
4372 }
4373 }
4374
4375 @helper RenderMobileNavigationActions()
4376 {
4377 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ;
4378
4379 <ul class="menu menu-mobile">
4380 @RenderBlockList(subBlocks)
4381 </ul>
4382 }
4383
4384 @helper RenderMobileNavigationSignInAction()
4385 {
4386 <li class="menu-mobile__item">
4387 <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>
4388 </li>
4389 }
4390
4391 @helper RenderMobileNavigationCreateAccountAction()
4392 {
4393 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");
4394
4395 <li class="menu-mobile__item">
4396 <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>
4397 </li>
4398 }
4399
4400 @helper RenderMobileNavigationProfileAction()
4401 {
4402 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4403 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
4404 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");
4405 string myProfilePageLink = linkStart + myProfilePageId;
4406
4407 <li class="menu-mobile__item">
4408 <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>
4409 </li>
4410 }
4411
4412 @helper RenderMobileNavigationOrdersAction()
4413 {
4414 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4415 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
4416 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders");
4417 string myOrdersPageLink = linkStart + myOrdersPageId;
4418 string ordersIcon = "fas fa-list";
4419
4420 <li class="menu-mobile__item">
4421 <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>
4422 </li>
4423 }
4424
4425 @helper RenderMobileNavigationFavoritesAction()
4426 {
4427 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4428 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
4429 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");
4430 string myFavoritesPageLink = linkStart + myFavoritesPageId;
4431 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";
4432
4433
4434 <li class="menu-mobile__item">
4435 <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>
4436 </li>
4437 }
4438
4439 @helper RenderMobileNavigationSavedCardsAction()
4440 {
4441 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4442 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
4443 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards");
4444 string mySavedCardsPageLink = linkStart + mySavedCardsPageId;
4445 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";
4446
4447 <li class="menu-mobile__item">
4448 <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>
4449 </li>
4450 }
4451
4452 @helper RenderMobileNavigationSignOutAction()
4453 {
4454 int pageId = Model.TopPage.ID;
4455 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";
4456
4457 <li class="menu-mobile__item">
4458 <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>
4459 </li>
4460 }
4461
4462 @helper RenderMobileNavigationLanguagesAction()
4463 {
4464 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides";
4465
4466 string selectedLanguage = "";
4467 foreach (var lang in Model.Languages)
4468 {
4469 if (lang.IsCurrent)
4470 {
4471 selectedLanguage = lang.Name;
4472 }
4473 }
4474
4475 <li class="menu-mobile__item dw-mod">
4476 @if (isSlidesDesign)
4477 {
4478 <input id="MobileMenuCheck_Language" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(1);">
4479 }
4480 else
4481 {
4482 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger">
4483 }
4484 <div class="menu-mobile__link__wrap">
4485 <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>
4486 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label>
4487 </div>
4488 <ul class="menu-mobile menu-mobile__submenu expand-menu">
4489 @if (isSlidesDesign)
4490 {
4491 <li class="menu-mobile__item dw-mod">
4492 <div class="menu-mobile__link__wrap">
4493 <input id="MobileMenuCheck_Language_back" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(0);" />
4494 <label for="MobileMenuCheck_Language_back" class="menu-mobile__trigger menu-mobile__trigger--back"></label>
4495 <label for="MobileMenuCheck_Language_back" class="menu-mobile__link dw-mod ">@Translate("Back")</label>
4496 </div>
4497 </li>
4498 }
4499 @foreach (var lang in Model.Languages)
4500 {
4501 <li class="menu-mobile__item dw-mod">
4502 <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>
4503 </li>
4504 }
4505 </ul>
4506 </li>
4507 }</text>
4508 }
4509 else
4510 {
4511 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4512
4513 @using System
4514 @using System.Web
4515 @using System.Collections.Generic
4516 @using Dynamicweb.Rapido.Blocks.Extensibility
4517 @using Dynamicweb.Rapido.Blocks
4518
4519 @functions {
4520 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master");
4521 }
4522
4523 @{
4524 Block masterTools = new Block()
4525 {
4526 Id = "MasterDesktopTools",
4527 SortId = 10,
4528 Template = RenderDesktopTools(),
4529 SkipRenderBlocksList = true,
4530 BlocksList = new List<Block>
4531 {
4532 new Block {
4533 Id = "MasterDesktopToolsText",
4534 SortId = 10,
4535 Template = RenderDesktopToolsText(),
4536 Design = new Design
4537 {
4538 Size = "auto",
4539 HidePadding = true,
4540 RenderType = RenderType.Column
4541 }
4542 },
4543 new Block {
4544 Id = "MasterDesktopToolsNavigation",
4545 SortId = 20,
4546 Template = RenderDesktopToolsNavigation(),
4547 Design = new Design
4548 {
4549 Size = "auto-width",
4550 HidePadding = true,
4551 RenderType = RenderType.Column
4552 }
4553 }
4554 }
4555 };
4556 headerBlocksPage.Add("MasterHeader", masterTools);
4557
4558 Block masterDesktopExtra = new Block()
4559 {
4560 Id = "MasterDesktopExtra",
4561 SortId = 10,
4562 Template = RenderDesktopExtra(),
4563 SkipRenderBlocksList = true
4564 };
4565 headerBlocksPage.Add("MasterHeader", masterDesktopExtra);
4566
4567 Block masterDesktopNavigation = new Block()
4568 {
4569 Id = "MasterDesktopNavigation",
4570 SortId = 20,
4571 Template = RenderDesktopNavigation(),
4572 SkipRenderBlocksList = true
4573 };
4574 headerBlocksPage.Add("MasterHeader", masterDesktopNavigation);
4575 }
4576
4577 @* Include the Blocks for the page *@
4578 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4579
4580 @using System
4581 @using System.Web
4582 @using Dynamicweb.Core
4583 @using Dynamicweb.Rapido.Blocks.Extensibility
4584 @using Dynamicweb.Rapido.Blocks
4585 @using Dynamicweb.Frontend
4586
4587
4588 @{
4589 Block masterDesktopLogo = new Block
4590 {
4591 Id = "MasterDesktopLogo",
4592 SortId = 10,
4593 Template = RenderDesktopLogo(),
4594 Design = new Design
4595 {
4596 Size = "auto-width",
4597 HidePadding = true,
4598 RenderType = RenderType.Column,
4599 CssClass = "grid--align-self-center"
4600 }
4601 };
4602
4603 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo);
4604 }
4605
4606
4607 @helper RenderDesktopLogo()
4608 {
4609 string firstPageId = Model.Area.FirstActivePage.ID.ToString();
4610 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4611 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : "";
4612 alignClass = topLayout == "splitted-center" ? "u-middle" : alignClass;
4613 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png";
4614 if (Path.GetExtension(logo).ToLower() != ".svg")
4615 {
4616 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight");
4617 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40;
4618 logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&crop=5&Compression=75&image=" + logo;
4619 }
4620 else
4621 {
4622 logo = HttpUtility.UrlDecode(logo);
4623 }
4624
4625 <div class="logo @alignClass dw-mod">
4626 <a href="https://riisfort.dk" class="logo__img dw-mod u-block">
4627 <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" />
4628 </a>
4629 </div>
4630 }
4631 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4632
4633 @using System
4634 @using System.Web
4635 @using Dynamicweb.Rapido.Blocks.Extensibility
4636 @using Dynamicweb.Rapido.Blocks
4637
4638 @functions {
4639 bool isMegaMenu;
4640 }
4641
4642 @{
4643 isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false;
4644 Block masterDesktopMenu = new Block
4645 {
4646 Id = "MasterDesktopMenu",
4647 SortId = 10,
4648 Template = RenderDesktopMenu(),
4649 Design = new Design
4650 {
4651 Size = "auto",
4652 HidePadding = true,
4653 RenderType = RenderType.Column
4654 }
4655 };
4656
4657 if (isMegaMenu)
4658 {
4659 masterDesktopMenu.Design.CssClass = "u-reset-position";
4660 }
4661
4662 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu);
4663 }
4664
4665 @helper RenderDesktopMenu()
4666 {
4667 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4668 string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : "";
4669 menuAlignment = topLayout == "minimal-center" ? "grid--align-self-center" : topLayout;
4670 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : "";
4671 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");
4672 bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders");
4673 int startLevel = renderPagesInToolBar ? 1 : 0;
4674 int areaId = 21;
4675
4676 string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink");
4677
4678 <div class="grid__cell u-flex @(isMegaMenu ? "u-reset-position" : "") @menuAlignment">
4679 @if (!isMegaMenu)
4680 {
4681 @RenderNavigation(new
4682 {
4683 areaId = areaId,
4684 id = "topnavigation",
4685 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap",
4686 startLevel = startLevel,
4687 ecomStartLevel = startLevel + 1,
4688 endlevel = 5,
4689 expandmode = "all",
4690 template = "BaseMenuWithDropdown.xslt"
4691 });
4692 }
4693 else
4694 {
4695 @RenderNavigation(new
4696 {
4697 areaId = areaId,
4698 id = "topnavigation",
4699 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap",
4700 startLevel = startLevel,
4701 ecomStartLevel = startLevel + 1,
4702 endlevel = 5,
4703 promotionImage = megamenuPromotionImage,
4704 promotionLink = promotionLink,
4705 expandmode = "all",
4706 showOnlyHeaders = showOnlyHeaders.ToString().ToLower(),
4707 template = "BaseMegaMenu.xslt"
4708 });
4709 }
4710 </div>
4711 }
4712 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4713
4714 @using System
4715 @using System.Web
4716 @using Dynamicweb.Rapido.Blocks.Extensibility
4717 @using Dynamicweb.Rapido.Blocks
4718
4719 @{
4720 Block masterDesktopActionsMenu = new Block
4721 {
4722 Id = "MasterDesktopActionsMenu",
4723 SortId = 10,
4724 Template = RenderDesktopActionsMenu(),
4725 Design = new Design
4726 {
4727 CssClass = "u-flex"
4728 },
4729 SkipRenderBlocksList = true
4730
4731 };
4732 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu);
4733
4734 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink")))
4735 {
4736 Block masterDesktopActionsHeaderButton = new Block
4737 {
4738 Id = "MasterDesktopActionsHeaderButton",
4739 SortId = 60,
4740 Template = RenderHeaderButton()
4741 };
4742 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton);
4743 }
4744 }
4745
4746 @helper RenderDesktopActionsMenu()
4747 {
4748 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList();
4749
4750 <ul class="menu u-flex dw-mod">
4751 @RenderBlockList(subBlocks)
4752 </ul>
4753 }
4754
4755 @helper RenderHeaderButton()
4756 {
4757 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText");
4758 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink");
4759 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : "";
4760
4761 <li class="menu__item menu__item--horizontal menu--clean dw-mod">
4762 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-left" href="@headerButtonLink">@headerButtonText</a>
4763 </li>
4764 }
4765 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4766
4767 @using System
4768 @using System.Web
4769 @using Dynamicweb.Core;
4770 @using System.Text.RegularExpressions
4771 @using Dynamicweb.Rapido.Blocks.Extensibility
4772 @using Dynamicweb.Rapido.Blocks
4773
4774 @{
4775 Block masterDesktopActionsMenuLanguageSelector = new Block
4776 {
4777 Id = "MasterDesktopActionsMenuLanguageSelector",
4778 SortId = 40,
4779 Template = RenderLanguageSelector()
4780 };
4781
4782 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector);
4783 }
4784
4785 @helper RenderLanguageSelector()
4786 {
4787 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4788 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
4789 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
4790 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() : "";
4791
4792 if (Model.Languages.Count > 1)
4793 {
4794 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod">
4795 <div class="@menuLinkClass dw-mod" title="@Translate("Language")">
4796 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i>
4797 </div>
4798 <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell">
4799 @foreach (var lang in Model.Languages)
4800 {
4801 string widthClass = "menu__item--fixed-width";
4802 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Content.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name;
4803 string cultureName = Regex.Replace(Dynamicweb.Content.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty);
4804 cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1);
4805
4806 if (languageViewType == "flag-culture")
4807 {
4808 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Content.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span> " + cultureName;
4809 }
4810
4811 if (languageViewType == "flag")
4812 {
4813 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Content.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span>";
4814 widthClass = "";
4815 }
4816
4817 if (languageViewType == "name")
4818 {
4819 langInfo = lang.Name;
4820 }
4821
4822 if (languageViewType == "culture")
4823 {
4824 langInfo = cultureName;
4825 widthClass = "";
4826 }
4827
4828 <div class="menu__item dw-mod @widthClass">
4829 <a href="/Default.aspx?AreaID=@Dynamicweb.Content.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__link dw-mod">@langInfo</a>
4830 </div>
4831 }
4832 </div>
4833 </li>
4834 }
4835 }
4836 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4837
4838 @using System
4839 @using System.Web
4840 @using Dynamicweb.Rapido.Blocks.Extensibility
4841 @using Dynamicweb.Rapido.Blocks
4842
4843 @{
4844 Block masterDesktopActionsMenuSignIn = new Block
4845 {
4846 Id = "MasterDesktopActionsMenuSignIn",
4847 SortId = 20,
4848 Template = RenderSignIn()
4849 };
4850
4851 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuSignIn);
4852 }
4853
4854 @helper RenderSignIn()
4855 {
4856 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn");
4857 string userInitials = "";
4858 int pageId = Model.TopPage.ID;
4859 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");
4860 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard");
4861 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");
4862 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders");
4863 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");
4864 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards");
4865 int myOrderDraftsPageId = GetPageIdByNavigationTag("OrderDraft");
4866 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4867 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");
4868 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile");
4869 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders");
4870 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards");
4871 bool hideMyOrderDraftsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrderDrafts");
4872 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites");
4873 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink");
4874
4875 string linkStart = "/Default.aspx?ID=";
4876 if (Model.CurrentUser.ID <= 0)
4877 {
4878 linkStart += signInProfilePageId + "&RedirectPageId=";
4879 }
4880
4881 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery";
4882 string myProfilePageLink = linkStart + myProfilePageId;
4883 string myOrdersPageLink = linkStart + myOrdersPageId;
4884 string myFavoritesPageLink = linkStart + myFavoritesPageId;
4885 string mySavedCardsPageLink = linkStart + mySavedCardsPageId;
4886 string myOrderDraftsLink = linkStart + myOrderDraftsPageId;
4887
4888 string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user";
4889 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";
4890 string orderDraftsIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon").SelectedValue : "fa fa-clipboard";
4891
4892 if (Model.CurrentUser.ID != 0)
4893 {
4894 userInitials = Dynamicweb.Rapido.Services.User.GetInitials(Model.CurrentUser.Name, Model.CurrentUser.FirstName, Model.CurrentUser.LastName, Model.CurrentUser.Email, Model.CurrentUser.UserName);
4895 }
4896
4897 if (!navigationItemsHideSignIn)
4898 {
4899 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
4900 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean";
4901 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
4902 string shopType = Pageview.AreaSettings.GetItem("Custom").GetString("ShopType");
4903
4904
4905 if (shopType.ToLower() == "b2b")
4906 {
4907 <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod">
4908 <div class="@menuLinkClass dw-mod">
4909 @if (Model.CurrentUser.ID <= 0)
4910 {
4911 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x" title="@Translate("Sign in")"></i>
4912 }
4913 else
4914 {
4915 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit" title="@Translate("Customer center")"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a>
4916 }
4917 </div>
4918
4919
4920 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod">
4921 <ul class="list list--clean dw-mod">
4922 @if (Model.CurrentUser.ID <= 0)
4923 {
4924 <li>
4925 <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>
4926 </li>
4927
4928 if (!hideCreateAccountLink)
4929 {
4930 @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account"));
4931 }
4932 if (!hideForgotPasswordLink)
4933 {
4934 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?"))
4935 }
4936 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink)
4937 {
4938 @RenderSeparator()
4939 }
4940 }
4941 @if (!hideMyProfileLink)
4942 {
4943 @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon)
4944 }
4945 @if (!hideMyOrdersLink)
4946 {
4947 @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list")
4948 }
4949 @if (!hideMyFavoritesLink)
4950 {
4951 @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon)
4952 }
4953 @if (!hideMySavedCardsLink)
4954 {
4955 @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card")
4956 }
4957 @if (!hideMyOrderDraftsLink)
4958 {
4959 @RenderListItem(myOrderDraftsLink, Translate("My Order drafts"), orderDraftsIcon)
4960 }
4961 @if (Model.CurrentUser.ID > 0)
4962 {
4963 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink)
4964 {
4965 @RenderSeparator()
4966 }
4967
4968 //Check if impersonation is on
4969 if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0)
4970 {
4971 <li>
4972 <div class="list__link dw-mod" onclick="document.getElementById('StopImpersonationModalTrigger').checked = true;">
4973 @Translate("Sign out")
4974 </div>
4975 </li>
4976 }
4977 else
4978 {
4979 @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out"))
4980 }
4981 }
4982 </ul>
4983 </div>
4984
4985 </li>
4986 }
4987 else {
4988 <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses dw-mod">
4989 <div class="@menuLinkClass menu__link--disabled-custom dw-mod">
4990 @if (Model.CurrentUser.ID <= 0)
4991 {
4992 <i class="u-visibility-hidden @Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x" title="@Translate("Sign in")"></i>
4993 }
4994 else
4995 {
4996 <a href="/default.aspx?ID=@myDashboardPageId" class="u-hidden u-color-inherit" title="@Translate("Customer center")"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a>
4997 }
4998 </div>
4999
5000
5001 <div class="u-hidden menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod">
5002 <ul class="list list--clean dw-mod">
5003 @if (Model.CurrentUser.ID <= 0)
5004 {
5005 <li>
5006 <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>
5007 </li>
5008
5009 if (!hideCreateAccountLink)
5010 {
5011 @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account"));
5012 }
5013 if (!hideForgotPasswordLink)
5014 {
5015 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?"))
5016 }
5017 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink)
5018 {
5019 @RenderSeparator()
5020 }
5021 }
5022 @if (!hideMyProfileLink)
5023 {
5024 @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon)
5025 }
5026 @if (!hideMyOrdersLink)
5027 {
5028 @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list")
5029 }
5030 @if (!hideMyFavoritesLink)
5031 {
5032 @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon)
5033 }
5034 @if (!hideMySavedCardsLink)
5035 {
5036 @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card")
5037 }
5038 @if (!hideMyOrderDraftsLink)
5039 {
5040 @RenderListItem(myOrderDraftsLink, Translate("My Order drafts"), orderDraftsIcon)
5041 }
5042 @if (Model.CurrentUser.ID > 0)
5043 {
5044 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink)
5045 {
5046 @RenderSeparator()
5047 }
5048
5049 //Check if impersonation is on
5050 if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0)
5051 {
5052 <li>
5053 <div class="list__link dw-mod" onclick="document.getElementById('StopImpersonationModalTrigger').checked = true;">
5054 @Translate("Sign out")
5055 </div>
5056 </li>
5057 }
5058 else
5059 {
5060 @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out"))
5061 }
5062 }
5063 </ul>
5064 </div>
5065
5066 </li>
5067 }
5068 }
5069 }
5070
5071 @helper RenderListItem(string link, string text, string icon = null)
5072 {
5073 <li>
5074 <a href="@link" class="list__link dw-mod" onclick="RememberState.SetCookie('useAnotherAddress', false)">
5075 @if (!string.IsNullOrEmpty(icon))
5076 {<i class="@icon u-margin-right"></i>}@text
5077 </a>
5078 </li>
5079 }
5080
5081 @helper RenderSeparator()
5082 {
5083 <li class="list__seperator dw-mod"></li>
5084 }
5085 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5086
5087 @using System
5088 @using System.Web
5089 @using Dynamicweb.Rapido.Blocks.Extensibility
5090 @using Dynamicweb.Rapido.Blocks
5091
5092 @{
5093 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites");
5094
5095 Block masterDesktopActionsMenuFavorites = new Block
5096 {
5097 Id = "MasterDesktopActionsMenuFavorites",
5098 SortId = 30,
5099 Template = RenderFavorites()
5100 };
5101
5102 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0)
5103 {
5104 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites);
5105 }
5106 }
5107
5108 @helper RenderFavorites()
5109 {
5110 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");
5111 string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId;
5112
5113 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5114 string liClasses = topLayout != "normal" && topLayout != "splitted-center" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
5115 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5116
5117 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod">
5118 <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod" title="@Translate("Favorites")">
5119 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i>
5120 </a>
5121 </li>
5122 }
5123 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5124
5125 @using System
5126 @using System.Web
5127 @using Dynamicweb.Rapido.Blocks.Extensibility
5128 @using Dynamicweb.Rapido.Blocks
5129 @using Dynamicweb.Rapido.Services
5130
5131 @{
5132 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart");
5133 string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown";
5134
5135 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !hideCart)
5136 {
5137 Block masterDesktopActionsMenuMiniCart = new Block
5138 {
5139 Id = "MasterDesktopActionsMenuMiniCart",
5140 SortId = 60,
5141 Template = RenderMiniCart(miniCartLayout == "dropdown"),
5142 SkipRenderBlocksList = true,
5143 BlocksList = new List<Block>()
5144 };
5145
5146 Block miniCartCounterScriptTemplate = new Block
5147 {
5148 Id = "MiniCartCounterScriptTemplate",
5149 Template = RenderMiniCartCounterContent()
5150 };
5151
5152 //dropdown layout is default
5153 RazorEngine.Templating.TemplateWriter layoutTemplate;
5154 RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate;
5155
5156 switch (miniCartLayout)
5157 {
5158 case "dropdown":
5159 layoutTemplate = RenderMiniCartDropdownLayout();
5160 miniCartTriggerTemplate = RenderMiniCartTriggerLink();
5161 break;
5162 case "panel":
5163 layoutTemplate = RenderMiniCartPanelLayout();
5164 miniCartTriggerTemplate = RenderMiniCartTriggerLabel();
5165 break;
5166 case "modal":
5167 layoutTemplate = RenderMiniCartModalLayout();
5168 miniCartTriggerTemplate = RenderMiniCartTriggerLabel();
5169 break;
5170 case "none":
5171 default:
5172 layoutTemplate = RenderMiniCartDropdownLayout();
5173 miniCartTriggerTemplate = RenderMiniCartTriggerLink();
5174 break;
5175 }
5176
5177 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block
5178 {
5179 Id = "MiniCartTrigger",
5180 Template = miniCartTriggerTemplate
5181 });
5182
5183 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
5184 {
5185 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block
5186 {
5187 Id = "MiniCartLayout",
5188 Template = layoutTemplate
5189 });
5190 }
5191
5192 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuMiniCart);
5193 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate);
5194 }
5195
5196 if (hideCart && Dynamicweb.Rapido.Services.User.IsBuyingAllowed())
5197 {
5198 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block {
5199 Id = "CartInitialization"
5200 });
5201 }
5202 }
5203
5204 @helper RenderMiniCart(bool hasMouseEnterEvent)
5205 {
5206 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterDesktopActionsMenuMiniCart").OrderBy(item => item.SortId).ToList();
5207 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5208 string liClasses = topLayout != "normal" ? "menu__item--top-level" : "menu--clean";
5209 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5210 string mouseEvent = "";
5211 string id = "MiniCart";
5212 if (hasMouseEnterEvent)
5213 {
5214 mouseEvent = "onmouseenter=\"Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=" + miniCartFeedPageId + "&feedType=MiniCart')\"";
5215 id = "miniCartTrigger";
5216 }
5217 <li class="menu__item menu__item--horizontal menu__item--icon @liClasses dw-mod" id="@id" @mouseEvent>
5218 @RenderBlockList(subBlocks)
5219 </li>
5220 }
5221
5222 @helper RenderMiniCartTriggerLabel()
5223 {
5224 int cartPageId = GetPageIdByNavigationTag("CartPage");
5225 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart";
5226 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5227 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5228 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5229
5230 <div class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')" title="@Translate("Cart")">
5231 <div class="u-inline u-position-relative">
5232 <i class="@cartIcon fa-1_5x"></i>
5233 @RenderMiniCartCounter()
5234 </div>
5235 </div>
5236 }
5237
5238 @helper RenderMiniCartTriggerLink()
5239 {
5240 int cartPageId = GetPageIdByNavigationTag("CartPage");
5241 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart";
5242 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5243 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5244
5245 <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button" title="@Translate("Cart")">
5246 <span class="u-inline u-position-relative">
5247 <i class="@cartIcon fa-1_5x"></i>
5248 @RenderMiniCartCounter()
5249 </span>
5250 </a>
5251 }
5252
5253 @helper RenderMiniCartCounter()
5254 {
5255 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5256 string cartProductsCount = Model.Cart.TotalProductsCount.ToString();
5257 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";
5258 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice");
5259 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : "";
5260 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : "";
5261
5262 if (showPrice && counterPosition == "right")
5263 {
5264 cartProductsCount = Translate("Cart") + " (" + cartProductsCount + ")";
5265 }
5266
5267 <span class="mini-cart__counter @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod">
5268 <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">
5269 <span class="js-mini-cart-counter-content" data-count="@Model.Cart.TotalProductsCount.ToString()">
5270 @cartProductsCount @cartProductsTotalPrice
5271 </span>
5272 </span>
5273 </span>
5274 }
5275
5276 @helper RenderMiniCartCounterContent()
5277 {
5278 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice");
5279 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";
5280 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice;
5281
5282 <script id="MiniCartCounterContent" type="text/x-template">
5283 {{#.}}
5284 <span class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}">
5285 @if (showPriceInMiniCartCounter)
5286 {
5287 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text>
5288 }
5289 else
5290 {
5291 <text>{{numberofproducts}}</text>
5292 }
5293 </span>
5294 {{/.}}
5295 </script>
5296 }
5297
5298 @helper RenderMiniCartDropdownLayout()
5299 {
5300 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5301 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");
5302
5303 <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">
5304 <div class="mini-cart-dropdown__inner dw-mod">
5305 <h3 class="u-ta-center dw-mod">@Translate("Shopping cart")</h3>
5306 <div class="mini-cart-dropdown__body u-flex dw-mod">
5307 <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>
5308 </div>
5309 </div>
5310 </div>
5311 }
5312
5313 @helper RenderMiniCartPanelLayout()
5314 {
5315 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5316 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");
5317
5318 <div class="mini-cart grid__cell dw-mod">
5319 <input type="checkbox" id="miniCartTrigger" class="panel-trigger" />
5320 <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">
5321 <label for="miniCartTrigger" class="panel__close-btn" title="@Translate("Close panel")"><i class="fas fa-times"></i></label>
5322 <div class="panel__content u-full-width dw-mod">
5323 <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3>
5324 <div class="panel__content-body panel__content-body--cart dw-mod">
5325 <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>
5326 </div>
5327 </div>
5328 </div>
5329 </div>
5330 }
5331
5332 @helper RenderMiniCartModalLayout()
5333 {
5334 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
5335 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");
5336
5337 <div class="mini-cart grid__cell dw-mod">
5338 <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" />
5339 <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink">
5340 <label for="miniCartTrigger" class="modal-overlay"></label>
5341 <div class="modal modal--md modal--top-right dw-mod">
5342 <div class="modal__body u-flex grid--direction-column dw-mod">
5343 <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3>
5344 <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>
5345 </div>
5346 <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label>
5347 </div>
5348 </div>
5349 </div>
5350 }
5351 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5352
5353 @using System
5354 @using System.Web
5355 @using Dynamicweb.Rapido.Blocks.Extensibility
5356 @using Dynamicweb.Rapido.Blocks
5357
5358 @{
5359 bool showOrderDraftLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOrderDraftIcon");
5360
5361 Block masterDesktopActionsMenuOrderDraft = new Block
5362 {
5363 Id = "MasterDesktopActionsMenuOrderDraft",
5364 SortId = 40,
5365 Template = RenderOrderDraft()
5366 };
5367
5368 if (showOrderDraftLink && Model.CurrentUser.ID > 0)
5369 {
5370 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuOrderDraft);
5371 }
5372 }
5373
5374 @helper RenderOrderDraft()
5375 {
5376 int OrderDraftPageId = GetPageIdByNavigationTag("OrderDraft");
5377 string OrderDraftPageLink = "/Default.aspx?ID=" + OrderDraftPageId;
5378 string draftIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon").SelectedValue : "fa fa-clipboard";
5379
5380
5381 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5382 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
5383 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5384
5385 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod">
5386 <a href="@OrderDraftPageLink" class="@menuLinkClass dw-mod" title="@Translate("My order drafts")">
5387 <span class="u-inline u-position-relative">
5388 <i class="@draftIcon fa-1_5x"></i>
5389 </span>
5390 </a>
5391 </li>
5392 }
5393 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5394
5395 @using System
5396 @using System.Web
5397 @using Dynamicweb.Rapido.Blocks.Extensibility
5398 @using Dynamicweb.Rapido.Blocks
5399
5400 @{
5401 bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart");
5402
5403 Block masterDesktopActionsMenuDownloadCart = new Block
5404 {
5405 Id = "MasterDesktopActionsMenuDownloadCart",
5406 SortId = 50,
5407 Template = RenderDownloadCart()
5408 };
5409
5410 if (showDownloadCartLink && Model.CurrentUser.ID > 0)
5411 {
5412 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuDownloadCart);
5413 }
5414 }
5415
5416 @helper RenderDownloadCart()
5417 {
5418 int downloadCartPageId = GetPageIdByNavigationTag("DownloadCart");
5419 string downloadCartPageLink = "/Default.aspx?ID=" + downloadCartPageId;
5420
5421 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5422 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
5423 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5424 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";
5425
5426 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod">
5427 <a href="@downloadCartPageLink" class="@menuLinkClass dw-mod" title="@Translate("Download cart")">
5428 <span class="u-inline u-position-relative">
5429 <i class="fas fa-cart-arrow-down fa-1_5x"></i>
5430 <span class="mini-cart__counter u-hidden @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod js-download-cart-counter"></span>
5431 </span>
5432 </a>
5433 </li>
5434 }
5435 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5436
5437 @using System
5438 @using System.Web
5439 @using Dynamicweb.Rapido.Blocks.Extensibility
5440 @using Dynamicweb.Rapido.Blocks
5441
5442 @functions {
5443 public class SearchConfiguration
5444 {
5445 public string searchFeedId { get; set; }
5446 public string searchSecondFeedId { get; set; }
5447 public int groupsFeedId { get; set; }
5448 public string resultPageLink { get; set; }
5449 public string searchPlaceholder { get; set; }
5450 public string searchType { get; set; }
5451 public string searchTemplate { get; set; }
5452 public string searchContentTemplate { get; set; }
5453 public string searchValue { get; set; }
5454 public bool showGroups { get; set; }
5455
5456 public SearchConfiguration()
5457 {
5458 searchFeedId = "";
5459 searchSecondFeedId = "";
5460 searchType = "product-search";
5461 searchContentTemplate = "";
5462 showGroups = true;
5463 }
5464 }
5465 }
5466 @{
5467 Block masterSearchBar = new Block
5468 {
5469 Id = "MasterSearchBar",
5470 SortId = 40,
5471 Template = RenderSearch("bar"),
5472 Design = new Design
5473 {
5474 Size = "auto",
5475 HidePadding = true,
5476 RenderType = RenderType.Column
5477 }
5478 };
5479
5480 Block masterSearchAction = new Block
5481 {
5482 Id = "MasterDesktopActionsMenuSearch",
5483 SortId = 10,
5484 Template = RenderSearch()
5485 };
5486
5487 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar);
5488 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction);
5489 }
5490
5491 @helper RenderSearch(string type = "mini-search")
5492 {
5493 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage"));
5494 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;
5495 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch";
5496
5497 SearchConfiguration searchConfiguration = null;
5498
5499 switch (searchType)
5500 {
5501 case "contentSearch":
5502 searchConfiguration = new SearchConfiguration()
5503 {
5504 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true",
5505 resultPageLink = contentSearchPageLink,
5506 searchPlaceholder = Translate("Search page"),
5507 groupsFeedId = 0,
5508 searchType = "content-search",
5509 searchTemplate = "SearchPagesTemplate",
5510 showGroups = false
5511 };
5512 break;
5513 case "combinedSearch":
5514 searchConfiguration = new SearchConfiguration()
5515 {
5516 //searchFeedId = productsPageId + "&feed=true",
5517 searchFeedId = GetPageIdByNavigationTag("ContentProductSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true",
5518 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true",
5519 resultPageLink = Converter.ToString(productsPageId),
5520 searchPlaceholder = Translate("Search products or pages"),
5521 //groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"),
5522 groupsFeedId = 0,
5523 searchType = "combined-search",
5524 searchTemplate = "SearchProductsTemplateWrap",
5525 searchContentTemplate = "SearchPagesTemplateWrap",
5526 //showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector")
5527 showGroups = false
5528 };
5529 break;
5530 default: //productSearch
5531 searchConfiguration = new SearchConfiguration()
5532 {
5533 resultPageLink = Converter.ToString(productsPageId),
5534 searchFeedId = productsPageId + "&feed=true",
5535 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"),
5536 searchPlaceholder = Translate("Search products"),
5537 searchTemplate = "SearchProductsTemplate",
5538 searchType = "product-search",
5539 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector")
5540 };
5541 break;
5542 }
5543 searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? "";
5544
5545 if (type == "mini-search")
5546 {
5547 @RenderMiniSearch(searchConfiguration)
5548 }
5549 else
5550 {
5551 @RenderSearchBar(searchConfiguration)
5552 }
5553 }
5554
5555 @helper RenderSearchBar(SearchConfiguration options)
5556 {
5557 <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar"
5558 data-page-size="7"
5559 data-search-feed-id="@options.searchFeedId"
5560 data-search-second-feed-id="@options.searchSecondFeedId"
5561 data-result-page-id="@options.resultPageLink"
5562 data-groups-page-id="@options.groupsFeedId"
5563 data-search-type="@options.searchType">
5564 @if (options.showGroups)
5565 {
5566 <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>
5567 <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>
5568 }
5569 <div class="typeahead-search-field">
5570 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue">
5571 @if (string.IsNullOrEmpty(options.searchSecondFeedId))
5572 {
5573 <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>
5574 }
5575 else
5576 {
5577 <div class="dropdown dropdown--absolute-position dropdown--combined grid">
5578 <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>
5579 <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>
5580 </div>
5581 }
5582 </div>
5583 <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>
5584 </div>
5585 }
5586
5587 @helper RenderMiniSearch(SearchConfiguration options)
5588 {
5589 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5590 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5591
5592 <li class="menu__item menu__item--horizontal menu__item--top-level menu__item--icon u-hidden-xxs is-dropdown is-dropdown--no-icon mini-search-icon dw-mod" id="miniSearchIcon" @*onclick="activateSearchIcon();"*@>
5593 <div class="@menuLinkClass dw-mod" title="@Translate("Search")">
5594 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i>
5595 </div>
5596 <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod" id="searchDropdown">
5597 <div class="typeahead js-typeahead" id="ProductSearchBar"
5598 data-page-size="7"
5599 data-search-feed-id="@options.searchFeedId"
5600 data-search-second-feed-id="@options.searchSecondFeedId"
5601 data-result-page-id="@options.resultPageLink"
5602 data-search-type="@options.searchType">
5603 <div class="typeahead-search-field">
5604 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue">
5605 @if (string.IsNullOrEmpty(options.searchSecondFeedId))
5606 {
5607 <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>
5608 }
5609 else
5610 {
5611 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned">
5612 <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>
5613 <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>
5614 </div>
5615 }
5616 </div>
5617 </div>
5618 </div>
5619 </li>
5620
5621 <script>
5622
5623 var searchDropdown = document.getElementById("searchDropdown")
5624 var searchInputField = document.getElementById("headerSearch");
5625 var searchIcon = document.getElementById("miniSearchIcon");
5626
5627 searchIcon.addEventListener('click', function (event) {
5628 searchDropdown.classList.toggle('is-active');
5629 searchInputField.focus();
5630 event.stopPropagation();
5631 });
5632
5633 searchInputField.addEventListener('click', function (event) {
5634 searchDropdown.classList.toggle('is-active');
5635
5636 });
5637
5638
5639
5640 document.body.addEventListener('click', function (event) {
5641 searchDropdown.classList.remove('is-active');
5642 });
5643
5644
5645 </script>
5646 }
5647
5648
5649 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5650
5651 @using System
5652 @using System.Web
5653 @using Dynamicweb.Rapido.Blocks.Extensibility
5654 @using Dynamicweb.Rapido.Blocks
5655
5656 @{
5657 string headerConfigurationTopLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5658 bool headerConfigurationHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");
5659
5660 BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master");
5661
5662 Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo");
5663 headerConfigurationPage.RemoveBlock(configDesktopLogo);
5664
5665 Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu");
5666 headerConfigurationPage.RemoveBlock(configDesktopMenu);
5667
5668 Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar");
5669 headerConfigurationPage.RemoveBlock(configSearchBar);
5670
5671 Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch");
5672 headerConfigurationPage.RemoveBlock(configSearchAction);
5673
5674 Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu");
5675 headerConfigurationPage.RemoveBlock(configDesktopActionsMenu);
5676
5677 Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra");
5678
5679 switch (headerConfigurationTopLayout)
5680 {
5681 case "condensed": //2
5682 configDesktopLogo.Design.Size = "auto-width";
5683 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
5684
5685 configDesktopMenu.SortId = 20;
5686 configDesktopMenu.Design.Size = "auto";
5687 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
5688
5689 configDesktopActionsMenu.SortId = 30;
5690 configDesktopActionsMenu.Design.Size = "auto-width";
5691 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
5692
5693 if (!headerConfigurationHideSearch)
5694 {
5695 configSearchBar.SortId = 40;
5696 configSearchBar.Design.Size = "12";
5697 configDesktopExtra.SortId = 50;
5698 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);
5699 }
5700 break;
5701 case "splitted": //3
5702 configDesktopLogo.Design.Size = "auto";
5703 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
5704
5705 if (!headerConfigurationHideSearch)
5706 {
5707 configSearchBar.SortId = 20;
5708 configSearchBar.Design.Size = "auto";
5709 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);
5710 }
5711
5712 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
5713
5714 configDesktopActionsMenu.SortId = 20;
5715 configDesktopActionsMenu.Design.Size = "auto-width";
5716 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
5717 break;
5718 case "splitted-center": //4
5719 configDesktopLogo.Design.Size = "auto";
5720 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
5721 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
5722
5723 configDesktopActionsMenu.SortId = 30;
5724 configDesktopActionsMenu.Design.Size = "auto-width";
5725 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu);
5726
5727 if (!headerConfigurationHideSearch)
5728 {
5729 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
5730 }
5731 break;
5732 case "minimal": //5
5733 configDesktopLogo.Design.Size = "auto-width";
5734 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
5735
5736 configDesktopMenu.Design.Size = "auto";
5737 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
5738
5739 configDesktopActionsMenu.SortId = 20;
5740 configDesktopActionsMenu.Design.Size = "auto-width";
5741 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
5742
5743 if (!headerConfigurationHideSearch)
5744 {
5745 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
5746 }
5747 break;
5748 case "minimal-center": //6
5749 configDesktopLogo.Design.Size = "auto-width";
5750 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
5751
5752 configDesktopMenu.Design.Size = "auto";
5753 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
5754
5755 configDesktopActionsMenu.SortId = 20;
5756 configDesktopActionsMenu.Design.Size = "auto-width";
5757 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
5758
5759 if (!headerConfigurationHideSearch)
5760 {
5761 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
5762 }
5763 break;
5764 case "minimal-right": //7
5765 configDesktopLogo.Design.Size = "auto-width";
5766 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
5767
5768 configDesktopMenu.Design.Size = "auto";
5769 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
5770
5771 configDesktopActionsMenu.SortId = 20;
5772 configDesktopActionsMenu.Design.Size = "auto-width";
5773 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
5774
5775 if (!headerConfigurationHideSearch)
5776 {
5777 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
5778 }
5779 break;
5780 case "two-lines": //8
5781 configDesktopLogo.Design.Size = "auto";
5782 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
5783
5784 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
5785
5786 configDesktopActionsMenu.SortId = 20;
5787 configDesktopActionsMenu.Design.Size = "auto-width";
5788 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
5789
5790 if (!headerConfigurationHideSearch)
5791 {
5792 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
5793 }
5794 break;
5795 case "two-lines-centered": //9
5796 configDesktopLogo.Design.Size = "auto";
5797 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
5798
5799 configDesktopMenu.Design.Size = "auto-width";
5800 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
5801
5802 configDesktopActionsMenu.SortId = 20;
5803 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
5804
5805 if (!headerConfigurationHideSearch)
5806 {
5807 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
5808 }
5809 break;
5810 case "normal": //1
5811 default:
5812 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
5813
5814 if (!headerConfigurationHideSearch)
5815 {
5816 configSearchBar.SortId = 20;
5817 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);
5818 }
5819
5820 configDesktopActionsMenu.SortId = 30;
5821 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu);
5822
5823 configDesktopActionsMenu.Design.Size = "auto-width";
5824 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
5825 break;
5826 }
5827 }
5828 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5829
5830 @using System
5831 @using System.Web
5832 @using Dynamicweb.Rapido.Blocks.Extensibility
5833 @using Dynamicweb.Rapido.Blocks
5834
5835 @{
5836
5837 }
5838
5839
5840 @helper RenderDesktopTools()
5841 {
5842 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList();
5843
5844 <div class="tools-navigation dw-mod">
5845 <div class="center-container grid top-container__center-container dw-mod">
5846 @RenderBlockList(subBlocks)
5847 </div>
5848 </div>
5849 }
5850
5851 @helper RenderDesktopToolsText()
5852 {
5853 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText");
5854 if (!string.IsNullOrEmpty(toolsText))
5855 {
5856 <div class="u-margin-top u-margin-bottom">@toolsText</div>
5857 }
5858 }
5859
5860 @helper RenderDesktopToolsNavigation()
5861 {
5862 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");
5863
5864 if (renderPagesInToolBar)
5865 {
5866 @RenderNavigation(new
5867 {
5868 id = "topToolsNavigation",
5869 cssclass = "menu menu-tools dw-mod dwnavigation",
5870 template = "TopMenu.xslt"
5871 })
5872 }
5873 }
5874
5875 @helper RenderDesktopNavigation()
5876 {
5877 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList();
5878 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5879 string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : "";
5880 <nav class="main-navigation dw-mod">
5881 <div class="center-container top-container__center-container grid @alignClass dw-mod">
5882 @RenderBlockList(subBlocks)
5883 </div>
5884 </nav>
5885 }
5886
5887 @helper RenderDesktopExtra()
5888 {
5889 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList();
5890
5891 if (subBlocks.Count > 0)
5892 {
5893 <div class="header header-top dw-mod">
5894 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod">
5895 @RenderBlockList(subBlocks)
5896 </div>
5897 </div>
5898 }
5899 }</text>
5900 }
5901
5902 @*Include("MasterBlocks/ImpersonationBar.cshtml")*@
5903 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5904
5905 @using System
5906 @using System.Web
5907 @using System.Collections.Generic
5908 @using Dynamicweb.Rapido.Blocks.Extensibility
5909 @using Dynamicweb.Rapido.Blocks
5910
5911 @{
5912 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master");
5913 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table";
5914
5915 Block orderLines = new Block
5916 {
5917 Id = "MiniCartOrderLines",
5918 SkipRenderBlocksList = true,
5919 BlocksList = new List<Block>
5920 {
5921 new Block {
5922 Id = "MiniCartOrderLinesList",
5923 SortId = 20,
5924 Template = RenderMiniCartOrderLinesList()
5925 }
5926 }
5927 };
5928
5929 Block orderlinesScriptTemplates = new Block
5930 {
5931 Id = "OrderlinesScriptTemplates"
5932 };
5933
5934 if (orderlinesView == "table")
5935 {
5936 orderLines.Template = RenderMiniCartOrderLinesTable();
5937 orderLines.BlocksList.Add(
5938 new Block
5939 {
5940 Id = "MiniCartOrderlinesTableHeader",
5941 SortId = 10,
5942 Template = RenderMiniCartOrderLinesHeader()
5943 }
5944 );
5945
5946 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates();
5947 }
5948 else
5949 {
5950 orderLines.Template = RenderMiniCartOrderLinesBlocks();
5951 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates();
5952 }
5953
5954 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates);
5955
5956 Block miniCartScriptTemplates = new Block()
5957 {
5958 Id = "MasterMiniCartTemplates",
5959 SortId = 1,
5960 Template = RenderMiniCartScriptTemplates(),
5961 SkipRenderBlocksList = true,
5962 BlocksList = new List<Block>
5963 {
5964 orderLines,
5965 new Block {
5966 Id = "MiniCartFooter",
5967 Template = RenderMiniCartFooter(),
5968 SortId = 50,
5969 SkipRenderBlocksList = true,
5970 BlocksList = new List<Block>
5971 {
5972 new Block {
5973 Id = "MiniCartSubTotal",
5974 Template = RenderMiniCartSubTotal(),
5975 SortId = 30
5976 },
5977 new Block {
5978 Id = "MiniCartFees",
5979 Template = RenderMiniCartFees(),
5980 SortId = 40
5981 },
5982 new Block {
5983 Id = "MiniCartPoints",
5984 Template = RenderMiniCartPoints(),
5985 SortId = 50
5986 },
5987 new Block {
5988 Id = "MiniCartTotal",
5989 Template = RenderMiniCartTotal(),
5990 SortId = 60
5991 },
5992 new Block {
5993 Id = "MiniCartDisclaimer",
5994 Template = RenderMiniCartDisclaimer(),
5995 SortId = 70
5996 },
5997 new Block {
5998 Id = "MiniCartActions",
5999 Template = RenderMiniCartActions(),
6000 SortId = 80
6001 }
6002 }
6003 }
6004 }
6005 };
6006
6007 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates);
6008 }
6009
6010 @helper RenderMiniCartScriptsTableTemplates()
6011 {
6012 <script id="MiniCartOrderline" type="text/x-template">
6013 {{#unless isEmpty}}
6014 <tr>
6015 <td class="u-w60px"><a href="{{link}}" class="{{hideimage}}"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=50&height=50&crop=5&Compression=75&image={{image}}" alt="{{name}}" title="{{name}}"></a></td>
6016 <td class="u-va-middle">
6017 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a>
6018 {{#if variantname}}
6019 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a>
6020 {{/if}}
6021 {{#if unitname}}
6022 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div>
6023 {{/if}}
6024 </td>
6025 <td class="u-ta-right u-va-middle">{{quantity}}</td>
6026 <td class="u-ta-right u-va-middle">
6027 {{#if pointsTotal}}
6028 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points")
6029 {{else}}
6030 {{totalprice}}
6031 {{/if}}
6032 </td>
6033 </tr>
6034 {{/unless}}
6035 </script>
6036
6037 <script id="MiniCartOrderlineDiscount" type="text/x-template">
6038 {{#unless isEmpty}}
6039 <tr class="table__row--no-border">
6040 <td class="u-w60px"> </td>
6041 <td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td>
6042 <td class="u-ta-right"> </td>
6043 <td class="u-ta-right">{{totalprice}}</td>
6044 </tr>
6045 {{/unless}}
6046 </script>
6047 }
6048
6049 @helper RenderMiniCartScriptsListTemplates()
6050 {
6051 int cartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
6052
6053 <script id="MiniCartOrderline" type="text/x-template">
6054 {{#unless isEmpty}}
6055 <div class="mini-cart-orderline grid dw-mod">
6056 <div class="grid__col-4">
6057 <a href="{{link}}" class="{{hideimage}}">
6058 <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=100&height=100&crop=5&Compression=75&image={{image}}" alt="{{name}}" title="{{name}}">
6059 </a>
6060 </div>
6061 <div class="grid__col-8">
6062 <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>
6063 {{#if variantname}}
6064 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div>
6065 {{/if}}
6066 {{#if unitname}}
6067 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div>
6068 {{/if}}
6069 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div>
6070
6071 <div class="grid__cell-footer">
6072 <div class="grid__cell">
6073 <div class="u-pull--left mini-cart-orderline__price dw-mod">
6074 {{#if pointsTotal}}
6075 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points")
6076 {{else}}
6077 {{totalprice}}
6078 {{/if}}
6079 </div>
6080 <button type="button"
6081 title="@Translate("Remove orderline")"
6082 class="btn btn--clean btn--condensed u-pull--right mini-cart-orderline__remove-btn dw-mod"
6083 onclick="{{#if googleImpression}}googleImpressionRemoveFromCart({{googleImpression}});{{/if}}Cart.UpdateCart('miniCartContent', '/Default.aspx?ID=@cartFeedPageId', 'CartCmd=DelOrderLine&key={{orderLineId}}&redirect=false', true);">@Translate("Remove")</button>
6084 </div>
6085 </div>
6086 </div>
6087 </div>
6088 {{/unless}}
6089 </script>
6090
6091 <script id="MiniCartOrderlineDiscount" type="text/x-template">
6092 {{#unless isEmpty}}
6093 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod">
6094 <div class="grid__col-4">
6095 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div>
6096 </div>
6097 <div class="grid__col-8">{{totalprice}}</div>
6098 </div>
6099 {{/unless}}
6100 </script>
6101 }
6102
6103 @helper RenderMiniCartScriptTemplates()
6104 {
6105 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList();
6106 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));
6107 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage"));
6108 bool miniCartUseGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));
6109
6110 <script id="MiniCartContent" type="text/x-template">
6111 {{#.}}
6112 {{#unless isEmpty}}
6113 @if (miniCartUseGoogleTagManager)
6114 {
6115 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text>
6116 }
6117 @RenderBlockList(subBlocks)
6118 {{/unless}}
6119 {{/.}}
6120 </script>
6121 }
6122
6123 @helper RenderMiniCartOrderLinesTable()
6124 {
6125 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList();
6126
6127 <div class="u-overflow-auto">
6128 <table class="table mini-cart-table dw-mod">
6129 @RenderBlockList(subBlocks)
6130 </table>
6131 </div>
6132 }
6133
6134 @helper RenderMiniCartOrderLinesBlocks()
6135 {
6136 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList();
6137
6138 <div class="u-overflow-auto">
6139 @RenderBlockList(subBlocks)
6140 </div>
6141 }
6142
6143 @helper RenderMiniCartOrderLinesHeader()
6144 {
6145 <thead>
6146 <tr>
6147 <td> </td>
6148 <td>@Translate("Product")</td>
6149 <td class="u-ta-right">@Translate("Qty")</td>
6150 <td class="u-ta-right" width="120">@Translate("Price")</td>
6151 </tr>
6152 </thead>
6153 }
6154
6155 @helper RenderMiniCartOrderLinesList()
6156 {
6157 <text>
6158 {{#OrderLines}}
6159 {{#ifCond template "===" "CartOrderline"}}
6160 {{>MiniCartOrderline}}
6161 {{/ifCond}}
6162 {{#ifCond template "===" "CartOrderlineMobile"}}
6163 {{>MiniCartOrderline}}
6164 {{/ifCond}}
6165 {{#ifCond template "===" "CartOrderlineDiscount"}}
6166 {{>MiniCartOrderlineDiscount}}
6167 {{/ifCond}}
6168 {{/OrderLines}}
6169 </text>
6170 }
6171
6172 @helper RenderMiniCartFees()
6173 {
6174 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
6175 if (!pointShop)
6176 {
6177 <text>
6178 {{#unless hidePaymentfee}}
6179 @*<div class="grid">
6180 <div class="grid__col-6 grid__col--bleed-y">
6181 {{paymentmethod}}
6182 </div>
6183 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{paymentfee}}</div>
6184 </div>*@
6185 {{/unless}}
6186 </text>
6187 }
6188 <text>
6189 {{#unless hideShippingfee}}
6190 <div class="grid">
6191 <div class="grid__col-6 grid__col--bleed-y">
6192 {{shippingmethod}}
6193 </div>
6194 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{shippingfee}}</div>
6195 </div>
6196 {{/unless}}
6197 </text>
6198 <text>
6199 {{#if hasTaxSettings}}
6200 <div class="grid">
6201 <div class="grid__col-6 grid__col--bleed-y">@Translate("Sales Tax")</div>
6202 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{totaltaxes}}</div>
6203 </div>
6204 {{/if}}
6205 </text>
6206 }
6207
6208 @helper RenderMiniCartFooter()
6209 {
6210 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList();
6211
6212 <div class="mini-cart__footer u-border-top u-padding-top dw-mod">
6213 @RenderBlockList(subBlocks)
6214 </div>
6215 }
6216
6217 @helper RenderMiniCartActions()
6218 {
6219 int cartPageId = GetPageIdByNavigationTag("CartPage");
6220
6221 <a href="/Default.aspx?ID=@cartPageId" title="@Translate("Go to cart")" class="btn btn--secondary u-full-width u-margin-bottom dw-mod">@Translate("Go to cart")</a>
6222 <button type="button" title="@Translate("Empty cart")" class="btn btn--primary u-full-width dw-mod u-no-margin u-no-margin" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event);">@Translate("Empty cart")</button>
6223 }
6224
6225 @helper RenderMiniCartPoints()
6226 {
6227 <text>
6228 {{#if earnings}}
6229 <div class="grid">
6230 <div class="grid__col-6 grid__col--bleed-y">@Translate("Earnings")</div>
6231 <div class="grid__col-6 grid__col--bleed-y grid--align-end">
6232 <div>
6233 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points")
6234 </div>
6235 </div>
6236 </div>
6237 {{/if}}
6238 </text>
6239 }
6240
6241 @helper RenderMiniCartSubTotal()
6242 {
6243 bool hasTaxSettings = Dynamicweb.Rapido.Services.Countries.HasTaxSettings(Model.Cart.ID);
6244 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
6245 if (!pointShop)
6246 {
6247 <text>
6248 {{#unless hideSubTotal}}
6249 <div class="grid dw-mod u-bold">
6250 <div class="grid__col-6 grid__col--bleed-y">@Translate("Subtotal")</div>
6251 <div class="grid__col-6 grid__col--bleed-y grid--align-end">
6252 @if (hasTaxSettings)
6253 {
6254 <text>{{subtotalpricewithouttaxes}}</text>
6255 }
6256 else
6257 {
6258 <text>{{subtotalprice}}</text>
6259 }
6260 </div>
6261 </div>
6262 {{/unless}}
6263 </text>
6264 }
6265 }
6266
6267 @helper RenderMiniCartTotal()
6268 {
6269 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
6270
6271 <div class="mini-cart-totals grid u-border-top u-margin-top dw-mod">
6272 <div class="grid__col-6">@Translate("Total")</div>
6273 <div class="grid__col-6 grid--align-end">
6274 <div>
6275 @if (pointShop)
6276 {
6277 <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points")
6278 }
6279 else
6280 {
6281 <text>{{totalprice}}</text>
6282 }
6283 </div>
6284 </div>
6285 </div>
6286 }
6287
6288 @helper RenderMiniCartDisclaimer()
6289 {
6290 <text>
6291 {{#if showCheckoutDisclaimer}}
6292 <div class="grid u-margin-bottom u-ta-right">
6293 <small class="grid__col-12">{{checkoutDisclaimer}}</small>
6294 </div>
6295 {{/if}}
6296 </text>
6297 }
6298 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
6299
6300 @using Dynamicweb.Rapido.Blocks.Extensibility
6301 @using Dynamicweb.Rapido.Blocks
6302 @using Dynamicweb.Rapido.Blocks.Components.General
6303 @using Dynamicweb.Rapido.Blocks.Components
6304 @using Dynamicweb.Rapido.Services
6305
6306 @{
6307 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : "";
6308 string addToCartNotificationMiniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown";
6309 bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart");
6310
6311 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !string.IsNullOrEmpty(addToCartNotificationType))
6312 {
6313 if (addToCartNotificationType == "modal")
6314 {
6315 Block addToCartNotificationModal = new Block
6316 {
6317 Id = "AddToCartNotificationModal",
6318 Template = RenderAddToCartNotificationModal()
6319 };
6320
6321 Block addToCartNotificationScript = new Block
6322 {
6323 Id = "AddToCartNotificationScript",
6324 Template = RenderAddToCartNotificationModalScript()
6325 };
6326 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal);
6327 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript);
6328 }
6329 else if (addToCartNotificationType == "toggle" && addToCartNotificationMiniCartLayout != "none" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
6330 {
6331 Block addToCartNotificationScript = new Block
6332 {
6333 Id = "AddToCartNotificationScript",
6334 Template = RenderAddToCartNotificationToggleScript()
6335 };
6336 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript);
6337 }
6338 }
6339 }
6340
6341 @helper RenderAddToCartNotificationModal()
6342 {
6343 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div>
6344 }
6345
6346 @helper RenderAddToCartNotificationModalScript()
6347 {
6348 int cartPageId = GetPageIdByNavigationTag("CartPage");
6349
6350 <script id="LastAddedProductTemplate" type="text/x-template">
6351 @{
6352
6353 Modal lastAddedProduct = new Modal
6354 {
6355 Id = "LastAddedProduct",
6356 Heading = new Heading
6357 {
6358 Level = 2,
6359 Title = Translate("Product is added to the cart")
6360 },
6361 Width = ModalWidth.Md,
6362 BodyTemplate = RenderModalContent()
6363 };
6364
6365 lastAddedProduct.AddActions(
6366 new Button
6367 {
6368 ButtonType = ButtonType.Button,
6369 ButtonLayout = ButtonLayout.Secondary,
6370 Title = Translate("Continue shopping"),
6371 CssClass = "u-pull--left u-no-margin btn--sm",
6372 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false"
6373 },
6374 new Link
6375 {
6376 Href = "/Default.aspx?ID=" + cartPageId,
6377 ButtonLayout = ButtonLayout.Secondary,
6378 CssClass = "u-pull--right u-no-margin btn--sm",
6379 Title = Translate("Proceed to checkout"),
6380 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false"
6381 }
6382 );
6383
6384 @Render(lastAddedProduct)
6385 }
6386 </script>
6387 <script>
6388 document.addEventListener('addToCart', function (event) {
6389 Cart.ShowLastAddedProductModal(event.detail);
6390 });
6391 </script>
6392 }
6393
6394 @helper RenderModalContent()
6395 {
6396 <div class="grid">
6397 <div class="grid__col-2">
6398 @Render(new Image { Path = "{{ productInfo.image }}", Link = "{{ productInfo.link }}", Title = "{{ productInfo.name }}", DisableImageEngine = true })
6399 </div>
6400 <div class="u-padding grid--align-self-center">
6401 <span>{{quantity}}</span> x
6402 </div>
6403 <div class="grid__col-auto grid--align-self-center">
6404 <div>{{productInfo.name}}</div>
6405 {{#if productInfo.variantName}}
6406 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small>
6407 {{/if}}
6408 {{#if productInfo.unitName}}
6409 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small>
6410 {{/if}}
6411 </div>
6412 </div>
6413 }
6414
6415 @helper RenderAddToCartNotificationToggleScript()
6416 {
6417 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
6418
6419 <script>
6420 document.addEventListener('addToCart', function () {
6421 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId');
6422 });
6423 </script>
6424 }
6425 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
6426
6427 @using System
6428 @using System.Web
6429 @using System.Collections.Generic
6430 @using Dynamicweb.Frontend
6431 @using Dynamicweb.Rapido.Blocks.Extensibility
6432 @using Dynamicweb.Rapido.Blocks
6433 @using Dynamicweb.Rapido.Blocks.Components.General
6434
6435 @functions {
6436 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master");
6437 }
6438
6439 @{
6440 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content");
6441 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content");
6442 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content");
6443 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header");
6444 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header");
6445 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header");
6446
6447 Block masterFooterContent = new Block()
6448 {
6449 Id = "MasterFooterContent",
6450 SortId = 10,
6451 Template = RenderFooter(),
6452 SkipRenderBlocksList = true
6453 };
6454 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent);
6455
6456 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader))
6457 {
6458 Block masterFooterColumnOne = new Block
6459 {
6460 Id = "MasterFooterColumnOne",
6461 SortId = 10,
6462 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent),
6463 Design = new Design
6464 {
6465 Size = "auto",
6466 RenderType = RenderType.Column
6467 }
6468 };
6469 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne);
6470 }
6471
6472 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader))
6473 {
6474 Block masterFooterColumnTwo = new Block
6475 {
6476 Id = "MasterFooterColumnTwo",
6477 SortId = 20,
6478 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent),
6479 Design = new Design
6480 {
6481 Size = "auto",
6482 RenderType = RenderType.Column
6483 }
6484 };
6485 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo);
6486 }
6487
6488 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader))
6489 {
6490 Block masterFooterColumnThree = new Block
6491 {
6492 Id = "MasterFooterColumnThree",
6493 SortId = 30,
6494 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent),
6495 Design = new Design
6496 {
6497 Size = "auto",
6498 RenderType = RenderType.Column
6499 }
6500 };
6501 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree);
6502 }
6503
6504 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp"))
6505 {
6506 Block masterFooterNewsletterSignUp = new Block
6507 {
6508 Id = "MasterFooterNewsletterSignUp",
6509 SortId = 40,
6510 Template = RenderFooterNewsletterSignUp(),
6511 Design = new Design
6512 {
6513 Size = "auto",
6514 RenderType = RenderType.Column
6515 }
6516 };
6517 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp);
6518 }
6519
6520 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0)
6521 {
6522 Block masterFooterSocialLinks = new Block
6523 {
6524 Id = "MasterFooterSocialLinks",
6525 SortId = 50,
6526 Template = RenderFooterSocialLinks(),
6527 Design = new Design
6528 {
6529 Size = "auto",
6530 RenderType = RenderType.Column
6531 }
6532 };
6533 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks);
6534 }
6535
6536 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0)
6537 {
6538 Block masterFooterPayments = new Block
6539 {
6540 Id = "MasterFooterPayments",
6541 SortId = 60,
6542 Template = RenderFooterPayments(),
6543 Design = new Design
6544 {
6545 Size = "12",
6546 RenderType = RenderType.Column
6547 }
6548 };
6549 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments);
6550 }
6551
6552 Block masterFooterCopyright = new Block
6553 {
6554 Id = "MasterFooterCopyright",
6555 SortId = 70,
6556 Template = RenderFooterCopyright(),
6557 Design = new Design
6558 {
6559 Size = "12",
6560 RenderType = RenderType.Column
6561 }
6562 };
6563 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright);
6564 }
6565
6566 @helper RenderFooter()
6567 {
6568 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList();
6569
6570 <footer class="footer dw-mod">
6571 <div class="center-container top-container__center-container dw-mod">
6572 <div class="grid grid--external-bleed-x">
6573 @RenderBlockList(subBlocks)
6574 </div>
6575 </div>
6576 </footer>
6577 <button class="cookie-info-open" id="cookie-info-open">
6578 <a href="javascript: Cookiebot.renew()">@Translate("Cookie")</a>
6579 </button>
6580 }
6581
6582 @helper RenderFooterColumn(string header, string content)
6583 {
6584 <h3 class="footer__heading dw-mod">@header</h3>
6585 <div class="footer__content dw-mod">
6586 @content
6587 </div>
6588 }
6589
6590 @helper RenderFooterNewsletterSignUp()
6591 {
6592 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString();
6593 Form form = new Form { Action = "/Default.aspx", Method = FormMethod.Get, Enctype = FormEnctype.multipart };
6594
6595 form.Add(new HiddenField { Name = "ID", Value = newsletterSignUpPageId });
6596 form.Add(new Text { Content = "<p>" + Translate("Sign up if you would like to receive occasional treats from us") + "</p>" });
6597 form.Add(new TextField {
6598 Id = "NewsletterEmail", Name = "NewsletterEmail", Placeholder = Translate("Your email address"),
6599 Type = TextFieldType.Email,
6600 ActionButton = new Button {
6601 ButtonType = ButtonType.Submit, Id="Submitter", Title = Translate("Go"), OnClick = "Buttons.LockButton(event)", CssClass = "btn--condensed"
6602 }
6603 });
6604
6605 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3>
6606 <div class="footer__content dw-mod">
6607 @Render(form)
6608 </div>
6609 }
6610
6611 @helper RenderFooterSocialLinks()
6612 {
6613 <h3 class="footer__heading dw-mod">@Translate("Social links")</h3>
6614 <div class="footer__content dw-mod">
6615 <div class="collection dw-mod">
6616 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks"))
6617 {
6618 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel;
6619 string socialIconClass = socialIcon.SelectedValue;
6620 string socialIconTitle = socialIcon.SelectedName;
6621 string socialLink = socialitem.GetString("Link");
6622
6623 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a>
6624 }
6625 </div>
6626 </div>
6627 }
6628
6629 @helper RenderFooterPayments()
6630 {
6631 <div class="footer__content dw-mod">
6632 <div class="collection dw-mod">
6633 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments"))
6634 {
6635 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel;
6636 string paymentImage = null;
6637 string paymentTitle = paymentItem.SelectedName;
6638 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault();
6639 if (selected != null)
6640 {
6641 paymentImage = selected.Icon;
6642 }
6643
6644 <div class="footer__card-type">
6645 <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=60&Compression=75&image=@paymentImage" alt="@paymentTitle" title="@paymentTitle" />
6646 </div>
6647 }
6648 </div>
6649 </div>
6650 }
6651
6652 @helper RenderFooterCopyright()
6653 {
6654 <div class="grid__col-12 footer__copyright dw-mod">
6655 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p>
6656 </div>
6657 }
6658 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
6659
6660 @using System
6661 @using System.Web
6662 @using System.Collections.Generic
6663 @using Dynamicweb.Rapido.Blocks.Extensibility
6664 @using Dynamicweb.Rapido.Blocks
6665 @using Dynamicweb.Ecommerce.Common
6666
6667 @{
6668 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master");
6669
6670 Block masterScriptReferences = new Block()
6671 {
6672 Id = "MasterScriptReferences",
6673 SortId = 1,
6674 Template = RenderMasterScriptReferences()
6675 };
6676 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences);
6677 }
6678
6679 @helper RenderMasterScriptReferences() {
6680 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script>
6681 <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script>
6682
6683 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript"))
6684 {
6685 <script src="/Files/Templates/Designs/Rapido/js/custom.min.js"></script>
6686 PushPromise("/Files/Templates/Designs/Rapido/js/custom.min.js");
6687 }
6688
6689 PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js");
6690 PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js");
6691 }
6692 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
6693
6694 @using System
6695 @using System.Web
6696 @using System.Collections.Generic
6697 @using Dynamicweb.Rapido.Blocks.Extensibility
6698 @using Dynamicweb.Rapido.Blocks
6699 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
6700 @using Dynamicweb.Rapido.Services
6701
6702 @{
6703 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master");
6704 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");
6705 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID"));
6706
6707 if (!navigationItemsHideSearch || isFavoriteList)
6708 {
6709 Block masterSearchScriptTemplates = new Block()
6710 {
6711 Id = "MasterSearchScriptTemplates",
6712 SortId = 1,
6713 Template = RenderSearchScriptTemplates()
6714 };
6715
6716 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates);
6717 }
6718 }
6719
6720 @helper RenderSearchScriptTemplates()
6721 {
6722 int productsPageId = GetPageIdByNavigationTag("ProductsPage");
6723 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;
6724 string contentProductSearchPageLink = GetPageIdByNavigationTag("ContentProductSearchResults") + "&Areaid=" + Model.Area.ID;
6725 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID"));
6726 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID"));
6727 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults");
6728 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton");
6729 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton");
6730 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton");
6731 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
6732
6733 <script id="SearchGroupsTemplate" type="text/x-template">
6734 {{#.}}
6735 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li>
6736 {{/.}}
6737 </script>
6738
6739 <script id="SearchProductsTemplate" type="text/x-template">
6740 {{#each .}}
6741 {{#Product}}
6742 {{#ifCond template "!==" "SearchMore"}}
6743 <li class="dropdown__item dropdown__item--seperator dw-mod">
6744 @if (useFacebookPixel)
6745 {
6746 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text>
6747 }
6748 @if (useGoogleTagManager)
6749 {
6750 <text>{{{googleEnchantImpression googleImpression}}}</text>
6751 }
6752 <div>
6753 <a href="{{link}}"
6754 class="js-typeahead-link u-color-inherit u-pull--left"
6755 onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}"
6756 title="{{name}}{{#if variantName}}, {{variantName}}{{/if}}">
6757 <div class="u-margin-right u-pull--left {{noimage}} u-hidden-xs u-hidden-xxs"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=45&height=36&crop=5&FillCanvas=True&Compression=75&image={{image}}" alt="{{name}}{{#if variantName}}, {{variantName}}{{/if}}"></div>
6758 <div class="u-pull--left">
6759 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}{{#if variantName}}, {{variantName}}{{/if}}</div>
6760 @if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed())
6761 {
6762 if (pointShopOnly)
6763 {
6764 <text>
6765 {{#if havePointPrice}}
6766 <div>
6767 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points")
6768 </div>
6769 {{else}}
6770 <small class="help-text u-no-margin">@Translate("Not available")</small>
6771 {{/if}}
6772 {{#unless canBePurchasedWithPoints}}
6773 {{#if havePointPrice}}
6774 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small>
6775 {{/if}}
6776 {{/unless}}
6777 </text>
6778 }
6779 else
6780 {
6781 <div>{{price}}</div>
6782 }
6783 }
6784 </div>
6785 </a>
6786 <div class="u-margin-left u-pull--right">
6787 @{
6788 var viewBtn = new Link
6789 {
6790 Href = "{{link}}",
6791 OnClick = "{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}",
6792 ButtonLayout = ButtonLayout.Secondary,
6793 CssClass = "btn--condensed u-no-margin u-w80px js-ignore-click-outside",
6794 Title = Translate("View")
6795 };
6796 }
6797 @if (showAddToCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed())
6798 {
6799 <text>{{#if hideAddToCartButton}}</text>
6800 @Render(viewBtn)
6801 <text>{{else}}</text>
6802 @Render(new AddToCartButton
6803 {
6804 HideTitle = true,
6805 ProductId = "{{productId}}",
6806 ProductInfo = "{{productInfo}}",
6807 BuyForPoints = pointShopOnly,
6808 OnClick = "{{facebookPixelAction}}",
6809 CssClass = "u-w80px u-no-margin js-ignore-click-outside",
6810 Icon = new Icon {
6811 CssClass = "js-ignore-click-outside"
6812 },
6813 ExtraAttributes = new Dictionary<string, string>
6814 {
6815 { "{{disabledBuyButton}}", "" }
6816 }
6817 })
6818 <text>{{/if}}</text>
6819 }
6820 else if (showViewButton)
6821 {
6822 @Render(viewBtn)
6823 }
6824 @if (showAddToDownloadButton)
6825 {
6826 <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}}">
6827 <i class="fas fa-plus js-button-icon"></i>
6828 </button>
6829 }
6830 </div>
6831 </div>
6832 </li>
6833 {{/ifCond}}
6834 {{#ifCond template "===" "SearchMore"}}
6835 {{>SearchMoreProducts}}
6836 {{/ifCond}}
6837 {{/Product}}
6838 {{else}}
6839 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod">
6840 @Translate("Your search gave 0 results")
6841 </li>
6842 {{/each}}
6843 </script>
6844
6845 @*<script id="SearchMoreProducts" type="text/x-template">
6846 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod">
6847 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link">
6848 @Translate("View all")
6849 </a>
6850 </li>
6851 </script>*@
6852 <script id="SearchMoreProducts" type="text/x-template">
6853 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod">
6854 <a href="/Default.aspx?ID=@contentProductSearchPageLink&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link">
6855 @Translate("View all")
6856 </a>
6857 </li>
6858 </script>
6859 <script id="SearchMorePages" type="text/x-template">
6860 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod">
6861 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link">
6862 @Translate("View all")
6863 </a>
6864 </li>
6865 </script>
6866
6867 <script id="SearchPagesTemplate" type="text/x-template">
6868 {{#each .}}
6869 {{#ifCond template "!==" "SearchMore"}}
6870 <li class="dropdown__item dropdown__item--seperator dropdown__item--no-padding dw-mod">
6871 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link dropdown__link u-color-inherit">
6872 @*<div class="u-margin-right"><i class="fa {{icon}} u-w20px u-ta-center"></i></div>*@
6873 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div>
6874 </a>
6875 </li>
6876 {{/ifCond}}
6877 {{#ifCond template "===" "SearchMore"}}
6878 {{>SearchMorePages}}
6879 {{/ifCond}}
6880 {{else}}
6881 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod">
6882 @Translate("Your search gave 0 results")
6883 </li>
6884 {{/each}}
6885 </script>
6886
6887 <script id="SearchPagesTemplateWrap" type="text/x-template">
6888 <div class="dropdown__column-header">@Translate("Pages")</div>
6889 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod">
6890 {{>SearchPagesTemplate}}
6891 </ul>
6892 </script>
6893
6894 <script id="SearchProductsTemplateWrap" type="text/x-template">
6895 <div class="dropdown__column-header">@Translate("Products")</div>
6896 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod">
6897 {{>SearchPagesTemplate}}
6898 @*{{>SearchProductsTemplate}}*@
6899 </ul>
6900 </script>
6901 }
6902
6903 @using Dynamicweb.Rapido.Blocks.Components
6904 @using Dynamicweb.Rapido.Blocks.Components.General
6905 @using Dynamicweb.Rapido.Blocks
6906 @using System.IO
6907
6908
6909 @using Dynamicweb.Rapido.Blocks.Components.General
6910 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
6911
6912
6913 @* Component *@
6914
6915 @helper RenderVariantMatrix(VariantMatrix settings) {
6916 if (settings != null)
6917 {
6918 int productLoopCounter = 0;
6919 int groupCount = 0;
6920 List<VariantOption> firstDimension = new List<VariantOption>();
6921 List<VariantOption> secondDimension = new List<VariantOption>();
6922 List<VariantOption> thirdDimension = new List<VariantOption>();
6923
6924 foreach (VariantGroup variantGroup in settings.GetVariantGroups())
6925 {
6926 foreach (VariantOption variantOptions in variantGroup.GetVariantOptions())
6927 {
6928 if (groupCount == 0) {
6929 firstDimension.Add(variantOptions);
6930 }
6931 if (groupCount == 1)
6932 {
6933 secondDimension.Add(variantOptions);
6934 }
6935 if (groupCount == 2)
6936 {
6937 thirdDimension.Add(variantOptions);
6938 }
6939 }
6940 groupCount++;
6941 }
6942
6943 int rowCount = 0;
6944 int columnCount = 0;
6945
6946 <script>
6947 var variantsCollection = [];
6948 </script>
6949
6950 <table class="table table--compact js-variants-matrix dw-mod" id="VariantMatrixTable_@settings.ProductId">
6951 @if (groupCount == 1)
6952 {
6953 <tbody>
6954 @foreach (VariantOption firstVariantOption in firstDimension)
6955 {
6956 var variantId = firstVariantOption.Id;
6957 <tr>
6958 <td class="u-bold">
6959 @firstVariantOption.Name
6960 </td>
6961 <td>
6962 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount)
6963 </td>
6964 </tr>
6965 productLoopCounter++;
6966 }
6967
6968 <tr>
6969 <td> </td>
6970 <td>
6971 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div>
6972 </td>
6973 </tr>
6974 </tbody>
6975 }
6976 @if (groupCount == 2)
6977 {
6978 <thead>
6979 <tr>
6980 <td> </td>
6981 @foreach (VariantOption variant in secondDimension)
6982 {
6983 <td>@variant.Name</td>
6984 }
6985 </tr>
6986 </thead>
6987 <tbody>
6988 @foreach (VariantOption firstVariantOption in firstDimension)
6989 {
6990 string variantId = "";
6991 columnCount = 0;
6992
6993 <tr>
6994 <td class="u-min-w120px">@firstVariantOption.Name</td>
6995
6996 @foreach (VariantOption secondVariantOption in secondDimension)
6997 {
6998 variantId = firstVariantOption.Id + "." + secondVariantOption.Id;
6999 <td>
7000 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount)
7001 </td>
7002
7003 columnCount++;
7004
7005 productLoopCounter++;
7006 }
7007
7008 <td>
7009 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div>
7010 </td>
7011 </tr>
7012
7013 rowCount++;
7014 }
7015
7016 @{
7017 columnCount = 0;
7018 }
7019
7020 <tr>
7021 <td> </td>
7022 @foreach (VariantOption secondVariantOption in secondDimension)
7023 {
7024 <td>
7025 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div>
7026 </td>
7027
7028 columnCount++;
7029 }
7030 <td> </td>
7031 </tr>
7032 </tbody>
7033 }
7034 @if (groupCount == 3)
7035 {
7036 <thead>
7037 <tr>
7038 <td> </td>
7039 @foreach (VariantOption thirdVariantOption in thirdDimension)
7040 {
7041 <td>@thirdVariantOption.Name</td>
7042 }
7043 </tr>
7044 </thead>
7045 <tbody>
7046 @foreach (VariantOption firstVariantOption in firstDimension)
7047 {
7048 int colspan = (thirdDimension.Count + 1);
7049
7050 <tr>
7051 <td colspan="@colspan" class="u-color-light-gray--bg u-bold">@firstVariantOption.Name</td>
7052 </tr>
7053
7054 foreach (VariantOption secondVariantOption in secondDimension)
7055 {
7056 string variantId = "";
7057 columnCount = 0;
7058
7059 <tr>
7060 <td class="u-min-w120px">@secondVariantOption.Name</td>
7061
7062 @foreach (VariantOption thirdVariantOption in thirdDimension)
7063 {
7064 variantId = firstVariantOption.Id + "." + secondVariantOption.Id + "." + thirdVariantOption.Id;
7065
7066 <td>
7067 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount)
7068 </td>
7069
7070 columnCount++;
7071 productLoopCounter++;
7072 }
7073
7074 <td>
7075 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div>
7076 </td>
7077 </tr>
7078 rowCount++;
7079 }
7080 }
7081
7082 @{
7083 columnCount = 0;
7084 }
7085
7086 <tr>
7087 <td> </td>
7088 @foreach (VariantOption thirdVariantOption in thirdDimension)
7089 {
7090 <td>
7091 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div>
7092 </td>
7093
7094 columnCount++;
7095 }
7096 <td> </td>
7097 </tr>
7098 </tbody>
7099 }
7100 </table>
7101
7102 <script>
7103 document.addEventListener("DOMContentLoaded", function (event) {
7104 MatrixUpdateQuantity("@settings.ProductId");
7105 });
7106
7107 MatrixUpdateQuantity = function (productId) {
7108 var currentMatrix = document.getElementById("VariantMatrixTable_" + productId);
7109 var allQtyFields = currentMatrix.getElementsByClassName("js-qty");
7110
7111 var qtyRowArr = [];
7112 var qtyColumnArr = [];
7113
7114 var totalQty = 0;
7115
7116 for (var i = 0; i < allQtyFields.length; i++) {
7117 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] = 0;
7118 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] = 0;
7119 }
7120
7121 for (var i = 0; i < allQtyFields.length; i++) {
7122 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] += parseFloat(allQtyFields[i].value);
7123 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] += parseFloat(allQtyFields[i].value);
7124 totalQty += parseFloat(allQtyFields[i].value);
7125 }
7126
7127 //Update row counters
7128 for (var i = 0; i < qtyRowArr.length; i++) {
7129 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0];
7130
7131 if (qtyRowArr[i] != undefined && qtyCounter != null) {
7132 var currentCount = qtyCounter.innerHTML;
7133 qtyCounter.innerHTML = qtyRowArr[i];
7134
7135 if (currentCount != qtyCounter.innerHTML) {
7136 qtyCounter.classList.add("qty-field--active");
7137 }
7138 }
7139
7140 }
7141
7142 //Update column counters
7143 for (var i = 0; i < qtyColumnArr.length; i++) {
7144 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0];
7145
7146 if (qtyColumnArr[i] != undefined && qtyCounter != null) {
7147 var currentCount = qtyCounter.innerHTML;
7148 qtyCounter.innerHTML = qtyColumnArr[i];
7149
7150 if (currentCount != qtyCounter.innerHTML) {
7151 qtyCounter.classList.add("qty-field--active");
7152 }
7153 }
7154 }
7155
7156 if (document.getElementById("TotalQtyCount_" + productId)) {
7157 document.getElementById("TotalQtyCount_" + productId).innerHTML = totalQty;
7158 }
7159
7160 //Clean up animations
7161 setTimeout(function () {
7162 for (var i = 0; i < qtyRowArr.length; i++) {
7163 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0];
7164 if (qtyCounter != null) {
7165 qtyCounter.classList.remove("qty-field--active");
7166 }
7167 }
7168 for (var i = 0; i < qtyColumnArr.length; i++) {
7169 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0];
7170 if (qtyCounter != null) {
7171 qtyCounter.classList.remove("qty-field--active");
7172 }
7173 }
7174 }, 1000);
7175 }
7176 </script>
7177 }
7178 }
7179
7180 @helper RenderVariantMatrixQuantityField(string variantId, VariantMatrix settings, int productLoopCounter, int rowCount, int columnCount)
7181 {
7182 string loopCount = productLoopCounter.ToString();
7183
7184 bool combinationFound = false;
7185 double stock = 0;
7186 double quantityValue = 0;
7187 string note = "";
7188
7189 VariantProduct variantProduct = null;
7190
7191 if (settings.GetVariantProducts().TryGetValue(variantId, out variantProduct))
7192 {
7193 stock = variantProduct.Stock;
7194 quantityValue = variantProduct.Quantity;
7195 combinationFound = true;
7196 }
7197
7198 if (combinationFound)
7199 {
7200 <input type="hidden" name="ProductLoopCounter@(loopCount)" value="@loopCount" />
7201 <input type="hidden" name="ProductID@(loopCount)" value="@settings.ProductId" />
7202 <input type="hidden" name="VariantID@(loopCount)" value="@variantId" />
7203 <input type="hidden" name="CurrentNote@(loopCount)" id="CurrentNote_@(settings.ProductId)_@variantId" value="@note" />
7204 <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">
7205
7206 if (stock != 0)
7207 {
7208 <small>@Translate("Stock") @stock</small>
7209 }
7210
7211 <script>
7212 var variants = '{ "ProductId" :' + '"@settings.ProductId"' + ', "VariantId": ' + '"@variantId"' +'}';
7213 variantsCollection.push(variants);
7214 document.getElementById("Quantity_@(settings.ProductId)_@variantId").closest(".js-variants-matrix").setAttribute("data-variants-collection", "[" + variantsCollection + "]" );
7215 </script>
7216 }
7217 else
7218 {
7219 <div class="use-btn-height" style="background-color: #a8a8a8"></div>
7220 }
7221 }
7222 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
7223
7224 @* Component *@
7225
7226 @helper RenderAddToCart(AddToCart settings)
7227 {
7228 //set Id for quantity selector to get it's value from button
7229 if (settings.QuantitySelector != null)
7230 {
7231 if (string.IsNullOrEmpty(settings.QuantitySelector.Id))
7232 {
7233 settings.QuantitySelector.Id = Guid.NewGuid().ToString("N");
7234 }
7235
7236 settings.AddButton.QuantitySelectorId = settings.QuantitySelector.Id;
7237
7238 if (settings.Disabled)
7239 {
7240 settings.QuantitySelector.Disabled = true;
7241 }
7242
7243 if (string.IsNullOrEmpty(settings.QuantitySelector.Name))
7244 {
7245 settings.QuantitySelector.Name = settings.QuantitySelector.Id;
7246 }
7247 }
7248
7249 if (settings.Disabled)
7250 {
7251 settings.AddButton.Disabled = true;
7252 }
7253
7254 settings.AddButton.CssClass += " btn--condensed";
7255
7256 //unitsSelector
7257 if (settings.UnitSelector != null)
7258 {
7259 if (settings.Disabled)
7260 {
7261 settings.QuantitySelector.Disabled = true;
7262 }
7263 }
7264
7265 <div class="buttons-collection @settings.WrapperCssClass" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
7266 @if (settings.UnitSelector != null)
7267 {
7268 @Render(settings.UnitSelector)
7269 }
7270 @if (settings.QuantitySelector != null)
7271 {
7272 @Render(settings.QuantitySelector)
7273 }
7274 @Render(settings.AddButton)
7275 </div>
7276 }
7277 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
7278
7279 @* Component *@
7280
7281 @helper RenderAddToCartButton(AddToCartButton settings)
7282 {
7283 if (!settings.HideTitle)
7284 {
7285 if (string.IsNullOrEmpty(settings.Title))
7286 {
7287 if (settings.BuyForPoints)
7288 {
7289 settings.Title = Translate("Buy with points");
7290 }
7291 else
7292 {
7293 settings.Title = Translate("Add to cart");
7294 }
7295 }
7296 }
7297 else
7298 {
7299 settings.Title = "";
7300 }
7301
7302 if (settings.Icon == null)
7303 {
7304 settings.Icon = new Icon();
7305 settings.Icon.LabelPosition = Dynamicweb.Rapido.Blocks.Components.General.IconLabelPosition.After;
7306 }
7307
7308 if (string.IsNullOrEmpty(settings.Icon.Name))
7309 {
7310 settings.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue;
7311 }
7312
7313 settings.OnClick = "Cart.AddToCart(event, { " +
7314 "id: '" + settings.ProductId + "'," +
7315 (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") +
7316 (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") +
7317 (settings.BuyForPoints ? "buyForPoints: true," : "") +
7318 (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") +
7319 "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value)") +
7320 "});" + settings.OnClick;
7321
7322 @RenderButton(settings)
7323 }
7324 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
7325
7326 @* Component *@
7327
7328 @helper RenderUnitSelector(UnitSelector settings)
7329 {
7330 if (string.IsNullOrEmpty(settings.Id))
7331 {
7332 settings.Id = Guid.NewGuid().ToString("N");
7333 }
7334 var disabledClass = settings.Disabled ? "disabled" : "";
7335
7336 <input type="checkbox" id="@settings.Id" class="dropdown-trigger" />
7337 <div class="dropdown unit-selector @settings.CssClass @disabledClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
7338 <label class="dropdown__header dropdown__btn dropdown__btn--unit-selector dw-mod" for="@settings.Id">@settings.SelectedOption</label>
7339 <div class="dropdown__content dw-mod">
7340 @settings.OptionsContent
7341 </div>
7342 <label class="dropdown-trigger-off" for="@settings.Id"></label>
7343 </div>
7344 }
7345 @using System.Reflection
7346 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
7347
7348 @* Component *@
7349
7350 @helper RenderQuantitySelector(QuantitySelector settings)
7351 {
7352 var attributes = new Dictionary<string, string>();
7353
7354 /*base settings*/
7355 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
7356 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
7357 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
7358 if (settings.Disabled) { attributes.Add("disabled", "true"); }
7359 if (settings.Required) { attributes.Add("required", "true"); }
7360 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
7361 /*end*/
7362
7363 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
7364 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
7365 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
7366 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
7367 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); }
7368 if (settings.Min == null) { settings.Min = 1; }
7369 attributes.Add("min", settings.Min.ToString());
7370 if (settings.Step != null && !string.IsNullOrEmpty(settings.Step.ToString())) { attributes.Add("step", settings.Step.ToString()); }
7371 if (settings.Value == null) { settings.Value = 1; }
7372 attributes.Add("value", settings.Value.ToString());
7373 attributes.Add("type", "number");
7374
7375 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
7376
7377 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
7378 }
7379 @using Dynamicweb.Rapido.Blocks.Components
7380
7381 @using Dynamicweb.Frontend
7382 @using Dynamicweb.Frontend.Devices
7383 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
7384 @using Dynamicweb.Rapido.Blocks.Components.General
7385 @using System.Collections.Generic;
7386
7387 @* Component *@
7388
7389 @helper RenderCustomerCenterList(CustomerCenterList settings)
7390 {
7391 bool isTouchDevice = Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet" ? true : false;
7392 string hideActions = isTouchDevice ? "u-block" : "";
7393
7394 <table class="table data-list dw-mod">
7395 @if (settings.GetHeaders().Length > 0) {
7396 <thead>
7397 <tr class="u-bold">
7398 @foreach (CustomerCenterListHeaderItem header in settings.GetHeaders())
7399 {
7400 var attributes = new Dictionary<string, string>();
7401 if (!string.IsNullOrEmpty(header.Id)) { attributes.Add("id", header.Id); }
7402 if (!string.IsNullOrEmpty(header.CssClass)) { attributes.Add("class", header.CssClass); }
7403 attributes.Add("align", header.Align.ToString());
7404 attributes = attributes.Concat(header.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
7405
7406 <td @ComponentMethods.AddAttributes(attributes)>@header.Title</td>
7407 }
7408 </tr>
7409 </thead>
7410 }
7411 @foreach (CustomerCenterListItem listItem in settings.GetItems())
7412 {
7413 int columnCount = 0;
7414 int totalColumns = listItem.GetInfoItems().Length;
7415 string rowHasActions = listItem.GetActions().Length > 0 ? "data-list__item--has-actions" : "";
7416 listItem.Id = !string.IsNullOrEmpty(listItem.Id) ? listItem.Id : Guid.NewGuid().ToString("N");
7417
7418 var attributes = new Dictionary<string, string>();
7419 if (!string.IsNullOrEmpty(listItem.Title)) { attributes.Add("title", listItem.Title); };
7420
7421 attributes = attributes.Concat(listItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
7422 <tbody class="data-list__item @rowHasActions @listItem.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes)>
7423 <tr>
7424 @if (!string.IsNullOrEmpty(listItem.Title) || !string.IsNullOrEmpty(listItem.Description)) {
7425 string onClick = !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : "";
7426
7427 <td rowspan="2" @onClick class="data-list__main-item dw-mod">
7428 @if (!string.IsNullOrEmpty(listItem.Title)) {
7429 <div class="u-bold">@listItem.Title</div>
7430 }
7431 @if (!string.IsNullOrEmpty(listItem.Description)) {
7432 <div>@listItem.Description</div>
7433 }
7434 </td>
7435 }
7436
7437 @foreach (CustomerCenterListInfoItem infoItem in listItem.GetInfoItems())
7438 {
7439 var infoAttributes = new Dictionary<string, string>();
7440 if (!string.IsNullOrEmpty(infoItem.Id)) { infoAttributes.Add("id", infoItem.Id); };
7441 if (!string.IsNullOrEmpty(infoItem.OnClick)) { infoAttributes.Add("onclick", infoItem.OnClick); };
7442 infoAttributes.Add("align", infoItem.Align.ToString());
7443
7444 infoAttributes = infoAttributes.Concat(infoItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
7445 string columnClick = columnCount < (totalColumns-1) && !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : "";
7446
7447 <td @ComponentMethods.AddAttributes(infoAttributes) @columnClick class="data-list__info-item dw-mod">
7448 @if (!string.IsNullOrEmpty(infoItem.Title)) {
7449 <div>@infoItem.Title</div>
7450 }
7451 @if (!string.IsNullOrEmpty(infoItem.Subtitle)) {
7452 <div><small>@infoItem.Subtitle</small></div>
7453 }
7454 </td>
7455
7456 columnCount++;
7457 }
7458 </tr>
7459 <tr>
7460 <td colspan="7" align="right" class="u-va-bottom u-no-border">
7461 <div class="data-list__actions @hideActions dw-mod" id="ActionsMenu_@listItem.Id">
7462 @foreach (ButtonBase action in listItem.GetActions())
7463 {
7464 action.ButtonLayout = ButtonLayout.LinkClean;
7465 action.Icon.CssClass += " u-full-height";
7466 action.CssClass += " data-list__action-button link";
7467
7468 @Render(action)
7469 }
7470 </div>
7471 </td>
7472 </tr>
7473 </tbody>
7474 }
7475 </table>
7476 }
7477 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
7478
7479 @using System
7480 @using System.Web
7481 @using System.Collections.Generic
7482 @using Dynamicweb.Rapido.Blocks.Extensibility
7483 @using Dynamicweb.Rapido.Blocks
7484
7485 @{
7486 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master");
7487
7488 Block primaryBottomSnippets = new Block()
7489 {
7490 Id = "MasterJavascriptInitializers",
7491 SortId = 100,
7492 Template = RenderPrimaryBottomSnippets()
7493 };
7494 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets);
7495
7496 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed())
7497 {
7498 Block miniCartPageId = new Block
7499 {
7500 Id = "MiniCartPageId",
7501 Template = RenderMiniCartPageId()
7502 };
7503 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, miniCartPageId);
7504 }
7505 }
7506
7507 @helper RenderPrimaryBottomSnippets()
7508 {
7509 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode");
7510 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));
7511
7512 if (isWireframeMode)
7513 {
7514 <script>
7515 Wireframe.Init(true);
7516 </script>
7517 }
7518
7519
7520 if (useGoogleTagManager)
7521 {
7522 <script>
7523 document.addEventListener('addToCart', function(event) {
7524 var googleImpression = JSON.parse(event.detail.productInfo.googleImpression);
7525 if (typeof googleImpression == "string") {
7526 googleImpression = JSON.parse(event.detail.productInfo.googleImpression);
7527 }
7528 dataLayer.push({
7529 'event': 'addToCart',
7530 'ecommerce': {
7531 'currencyCode': googleImpression.currency,
7532 'add': {
7533 'products': [{
7534 'name': googleImpression.name,
7535 'id': googleImpression.id,
7536 'price': googleImpression.price,
7537 'brand': googleImpression.brand,
7538 'category': googleImpression.category,
7539 'variant': googleImpression.variant,
7540 'quantity': event.detail.quantity
7541 }]
7542 }
7543 }
7544 });
7545 });
7546 </script>
7547 }
7548
7549 //if digitalwarehouse
7550 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart"))
7551 {
7552 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]);
7553
7554 if (string.IsNullOrEmpty(cartContextId))
7555 {
7556 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2");
7557 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps);
7558 cartContextId = cartSettings.OrderContextID;
7559 HttpContext.Current.Application["DownloadCartContext"] = cartContextId;
7560 }
7561
7562 <script>
7563 let downloadCart = new DownloadCart({
7564 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"),
7565 contextId: "@cartContextId",
7566 addButtonText: "@Translate("Add")",
7567 removeButtonText: "@Translate("Remove")"
7568 });
7569 </script>
7570 }
7571
7572 <!--$$Javascripts-->
7573 }
7574
7575 @helper RenderMiniCartPageId()
7576 {
7577 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
7578 <script>
7579 window.cartId = "@miniCartFeedPageId";
7580 </script>
7581 }
7582 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
7583
7584 @using System
7585 @using System.Web
7586 @using System.Collections.Generic
7587 @using Dynamicweb.Rapido.Blocks
7588
7589 @{
7590 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master");
7591
7592 }
7593
7594
7595 @functions {
7596 public class ManifestIcon
7597 {
7598 public string src { get; set; }
7599 public string type { get; set; }
7600 public string sizes { get; set; }
7601 }
7602
7603 public class Manifest
7604 {
7605 public string name { get; set; }
7606 public string short_name { get; set; }
7607 public string start_url { get; set; }
7608 public string display { get; set; }
7609 public string background_color { get; set; }
7610 public string theme_color { get; set; }
7611 public List<ManifestIcon> icons { get; set; }
7612 }
7613 }
7614
7615 <!DOCTYPE html>
7616
7617 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName">
7618
7619
7620
7621 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@
7622 @RenderBlockList(masterPage.BlocksRoot.BlocksList)
7623
7624
7625
7626 @helper RenderMasterHead() {
7627 List<Block> subBlocks = this.masterPage.GetBlockListById("Head").OrderBy(item => item.SortId).ToList();
7628
7629 <head>
7630 <script id="Cookiebot" src="https://consent.cookiebot.com/uc.js" data-cbid="8c658f14-4790-4b06-acd9-bfdfbda5d796" type="text/javascript" async></script>
7631 <!-- Rapido version 3.4.1 -->
7632
7633 @RenderBlockList(subBlocks)
7634 </head>
7635 }
7636
7637 @helper RenderMasterMetadata() {
7638 var swatches = new Dynamicweb.Content.Items.ColorSwatchService();
7639 var brandColors = swatches.GetColorSwatch(1);
7640 string brandColorOne = brandColors.Palette["BrandColor1"];
7641
7642 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) {
7643 Manifest manifest = new Manifest
7644 {
7645 name = Model.Area.Item.GetItem("Settings").GetString("AppName"),
7646 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"),
7647 start_url = "/",
7648 display = "standalone",
7649 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"),
7650 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor")
7651 };
7652
7653 manifest.icons = new List<ManifestIcon> {
7654 new ManifestIcon {
7655 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,
7656 sizes = "192x192",
7657 type = "image/png"
7658 },
7659 new ManifestIcon {
7660 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,
7661 sizes = "512x512",
7662 type = "image/png"
7663 },
7664 new ManifestIcon {
7665 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,
7666 sizes = "1024x1024",
7667 type = "image/png"
7668 }
7669 };
7670
7671 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json");
7672 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest);
7673 string currentManifest = File.ReadAllText(manifestFilePath);
7674
7675 if (manifestJSON != currentManifest)
7676 {
7677 File.WriteAllText(manifestFilePath, manifestJSON);
7678 }
7679 }
7680
7681 <meta charset="utf-8" />
7682 <title>@Model.Title</title>
7683 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7684 <meta name="theme-color" content="@brandColorOne" />
7685
7686 if (Model.MetaTags != null && !Model.MetaTags.Contains("og:image") && Model.PropertyItem != null && Model.PropertyItem.GetFile("OpenGraphImage") != null)
7687 {
7688 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")));
7689 }
7690
7691 if (!Model.MetaTags.Contains("og:description") && !string.IsNullOrEmpty(Model.Description))
7692 {
7693 Pageview.Meta.AddTag("og:description", Model.Description);
7694 }
7695
7696 Pageview.Meta.AddTag("og:title", Model.Title);
7697 Pageview.Meta.AddTag("og:site_name", Model.Name);
7698 Pageview.Meta.AddTag("og:url", HttpContext.Current.Request.Url.ToString());
7699 Pageview.Meta.AddTag("og:type", "Website");
7700
7701 if (!string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("FacebookAppID"))) {
7702 Pageview.Meta.AddTag("fb:app_id", Model.Area.Item.GetItem("Settings").GetString("FacebookAppID"));
7703 }
7704
7705 <!-- Canonical for product and kategory pages -->
7706 var pageGroupId = HttpContext.Current.Request.QueryString["groupid"];
7707 var pageProductId = HttpContext.Current.Request.QueryString["productid"];
7708
7709 if (!Model.MetaTags.Contains("canonical"))
7710 {
7711 var path = $"Default.aspx?ID={Pageview.ID}";
7712 if (!string.IsNullOrEmpty(pageGroupId)) { path = path + "&GroupID=" + pageGroupId; }
7713 if (!string.IsNullOrEmpty(pageProductId)) { path = path + "&ProductID=" + pageProductId; }
7714
7715 var seoUrl = SearchEngineFriendlyURLs.GetFriendlyUrl(path);
7716
7717 <link rel="canonical" href="@string.Format("{0}://{1}{2}", Dynamicweb.Context.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, seoUrl)">
7718 }
7719
7720 @Model.MetaTags
7721 }
7722
7723 @helper RenderMasterCss() {
7724 var fonts = new string[] {
7725 getFontFamily("Layout", "HeaderFont"),
7726 getFontFamily("Layout", "SubheaderFont"),
7727 getFontFamily("Layout", "TertiaryHeaderFont"),
7728 getFontFamily("Layout", "BodyText"),
7729 getFontFamily("Layout", "Header", "ToolsFont"),
7730 getFontFamily("Layout", "Header", "NavigationFont"),
7731 getFontFamily("Layout", "MobileNavigation", "Font"),
7732 getFontFamily("ProductList", "Facets", "HeaderFont"),
7733 getFontFamily("ProductPage", "PriceFontDesign"),
7734 getFontFamily("Ecommerce", "SaleSticker", "Font"),
7735 getFontFamily("Ecommerce", "NewSticker", "Font"),
7736 getFontFamily("Ecommerce", "CustomSticker", "Font")
7737 };
7738
7739 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks;
7740 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png";
7741 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro");
7742 string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css";
7743 if (useFontAwesomePro)
7744 {
7745 fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css";
7746 }
7747
7748 //Favicon
7749 <link href="@favicon" rel="icon" type="image/png">
7750
7751 //Base (Default, wireframe) styles
7752 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css">
7753
7754 //Rapido Css from Website Settings
7755 <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css">
7756
7757 //Ignite Css (Custom site specific styles)
7758 <link rel="stylesheet" id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css">
7759
7760 //Font awesome
7761 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css">
7762
7763 //Flag icon
7764 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css">
7765
7766 //Google fonts
7767 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)));
7768
7769 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet">
7770
7771 PushPromise(favicon);
7772 PushPromise(fontAwesomeCssLink);
7773 PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css");
7774 PushPromise(autoCssLink);
7775 PushPromise("/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css");
7776 PushPromise("/Files/Images/placeholder.gif");
7777 PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css");
7778 }
7779
7780 @helper RenderMasterManifest() {
7781 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")))
7782 {
7783 <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json">
7784 PushPromise("/Files/Templates/Designs/Rapido/manifest.json");
7785 }
7786 }
7787
7788 @helper RenderMasterBody() {
7789 List<Block> subBlocks = this.masterPage.GetBlockListById("Body").OrderBy(item => item.SortId).ToList();
7790 string designLayout = Model.PropertyItem.GetItem("CustomSettings") != null ? Model.PropertyItem.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.PropertyItem.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : "";
7791 if (!String.IsNullOrEmpty(designLayout)) {
7792 designLayout = "class=\"" + designLayout + "\"";
7793 }
7794
7795 <body @designLayout>
7796 @RenderBlockList(subBlocks)
7797 </body>
7798 }
7799
7800 @helper RenderMasterHeader()
7801 {
7802 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList();
7803 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop");
7804 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : "";
7805
7806 <header class="top-container @stickyTop dw-mod" id="Top">
7807 @RenderBlockList(subBlocks)
7808 </header>
7809 }
7810
7811 @helper RenderMain()
7812 {
7813 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList();
7814
7815 <main class="site dw-mod">
7816 @RenderBlockList(subBlocks)
7817 </main>
7818 }
7819
7820 @helper RenderPageContent()
7821 {
7822 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop");
7823 string pagePos = isNavigationStickyMenu ? "js-page-pos" : "";
7824
7825 <div id="Page" class="page @pagePos">
7826 <div id="content">
7827 @RenderSnippet("Content")
7828 </div>
7829 </div>
7830 }
7831
7832 @* Hack to support nested helpers *@
7833 @SnippetStart("Content")
7834 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
7835
7836
7837
7838 @* Render the grid *@
7839 @Model.Grid("Grid", "Grid", "default:true;sort:1", "Pages")
7840
7841 @SnippetEnd("Content")
7842
7843 @helper RenderIosTabletFix() {
7844 if (Pageview.Device != Dynamicweb.Frontend.Devices.DeviceType.Tablet && Pageview.Platform != Dynamicweb.Frontend.Devices.PlatformType.Ios)
7845 {
7846 <script>
7847 let isIpadIOS = (/iPad/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) && !window.MSStream;
7848 if (isIpadIOS) {
7849 var separator = (window.location.href.indexOf("?") === -1) ? "?" : "&";
7850 window.location.href = window.location.href + separator + "DeviceType=Tablet&PlatformType=Ios";
7851 }
7852 </script>
7853 }
7854 }
7855
7856 </html>
7857
7858