Error executing template "/Designs/Rapido/ContentPage/Paragraph/BreadcrumbParagraphEcom.cshtml"
System.ApplicationException: Sql Exception occurred in PageRepository.Get
at Dynamicweb.Content.Data.PageRepository.GetPage(Int32 id)
at Riisfort.Website.CustomModules.Helpers.BreadcrumbHelper.GetBreadcrumb(Int32 pageId, String groupId, String productId) in C:\azp\agent\_work\30\s\Riisfort.website\CustomModules\Helpers\BreadcrumbHelper.cs:line 24
at CompiledRazorTemplates.Dynamic.RazorEngine_7d3329d43b7b4d999d6162411a8d5d62.Execute() in D:\dynamicweb.net\Solutions\Skabertrang\riisfort.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\ContentPage\Paragraph\BreadcrumbParagraphEcom.cshtml:line 2123
at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel>
2 @using Dynamicweb.Frontend.Navigation
3 @using Riisfort.Website.CustomModules.Helpers;
4 @using System;
5 @using System.Web;
6
7 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel>
8 @using Dynamicweb.Frontend
9
10 @* Include the components *@
11 @using System.Text.RegularExpressions
12 @using System.Collections.Generic
13 @using System.Reflection
14 @using System.Web
15 @using System.Web.UI.HtmlControls
16 @using Dynamicweb.Rapido.Blocks.Components
17 @using Dynamicweb.Rapido.Blocks.Components.Articles
18 @using Dynamicweb.Rapido.Blocks.Components.Documentation
19 @using Dynamicweb.Rapido.Blocks
20
21
22 @*--- START: Base block renderers ---*@
23
24 @helper RenderBlockList(List<Block> blocks)
25 {
26 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false;
27 blocks = blocks.OrderBy(item => item.SortId).ToList();
28
29 foreach (Block item in blocks)
30 {
31 if (debug) {
32 <!-- Block START: @item.Id -->
33 }
34
35 if (item.Design == null)
36 {
37 @RenderBlock(item)
38 }
39 else if (item.Design.RenderType == RenderType.None) {
40 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : "";
41
42 <div class="@cssClass dw-mod">
43 @RenderBlock(item)
44 </div>
45 }
46 else if (item.Design.RenderType != RenderType.Hide)
47 {
48 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : "";
49
50 if (!item.SkipRenderBlocksList) {
51 if (item.Design.RenderType == RenderType.Row)
52 {
53 <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id">
54 @RenderBlock(item)
55 </div>
56 }
57
58 if (item.Design.RenderType == RenderType.Column)
59 {
60 string hidePadding = item.Design.HidePadding ? "u-no-padding" : "";
61 string size = item.Design.Size ?? "12";
62 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size;
63
64 <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">
65 @RenderBlock(item)
66 </div>
67 }
68
69 if (item.Design.RenderType == RenderType.Table)
70 {
71 <table class="table @cssClass dw-mod" id="Block__@item.Id">
72 @RenderBlock(item)
73 </table>
74 }
75
76 if (item.Design.RenderType == RenderType.TableRow)
77 {
78 <tr class="@cssClass dw-mod" id="Block__@item.Id">
79 @RenderBlock(item)
80 </tr>
81 }
82
83 if (item.Design.RenderType == RenderType.TableColumn)
84 {
85 <td class="@cssClass dw-mod" id="Block__@item.Id">
86 @RenderBlock(item)
87 </td>
88 }
89
90 if (item.Design.RenderType == RenderType.CardHeader)
91 {
92 <div class="card-header @cssClass dw-mod">
93 @RenderBlock(item)
94 </div>
95 }
96
97 if (item.Design.RenderType == RenderType.CardBody)
98 {
99 <div class="card @cssClass dw-mod">
100 @RenderBlock(item)
101 </div>
102 }
103
104 if (item.Design.RenderType == RenderType.CardFooter)
105 {
106 <div class="card-footer @cssClass dw-mod">
107 @RenderBlock(item)
108 </div>
109 }
110 }
111 else
112 {
113 @RenderBlock(item)
114 }
115 }
116
117 if (debug) {
118 <!-- Block END: @item.Id -->
119 }
120 }
121 }
122
123 @helper RenderBlock(Block item)
124 {
125 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false;
126
127 if (item.Template != null)
128 {
129 @BlocksPage.RenderTemplate(item.Template)
130 }
131
132 if (item.Component != null)
133 {
134 string customSufix = "Custom";
135 string methodName = item.Component.HelperName;
136
137 ComponentBase[] methodParameters = new ComponentBase[1];
138 methodParameters[0] = item.Component;
139 Type methodType = this.GetType();
140
141 MethodInfo customMethod = methodType.GetMethod(methodName + customSufix);
142 MethodInfo generalMethod = methodType.GetMethod(methodName);
143
144 try {
145 if (debug) {
146 <!-- Component: @methodName.Replace("Render", "") -->
147 }
148 @customMethod.Invoke(this, methodParameters).ToString();
149 } catch {
150 try {
151 @generalMethod.Invoke(this, methodParameters).ToString();
152 } catch(Exception ex) {
153 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked", ex);
154 }
155 }
156 }
157
158 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList)
159 {
160 @RenderBlockList(item.BlocksList)
161 }
162 }
163
164 @*--- END: Base block renderers ---*@
165
166 @using Dynamicweb.Rapido.Blocks.Components
167 @using Dynamicweb.Rapido.Blocks.Components.General
168 @using Dynamicweb.Rapido.Blocks
169 @using System.IO
170
171 @* Required *@
172 @using Dynamicweb.Rapido.Blocks.Components
173 @using Dynamicweb.Rapido.Blocks.Components.General
174 @using Dynamicweb.Rapido.Blocks
175
176
177 @helper Render(ComponentBase component)
178 {
179 if (component != null)
180 {
181 @component.Render(this)
182 }
183 }
184
185 @* Components *@
186 @using System.Reflection
187 @using Dynamicweb.Rapido.Blocks.Components.General
188
189
190 @* Component *@
191
192 @helper RenderIcon(Icon settings)
193 {
194 if (settings != null)
195 {
196 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : "";
197
198 if (settings.Name != null)
199 {
200 if (string.IsNullOrEmpty(settings.Label))
201 {
202 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i>
203 }
204 else
205 {
206 if (settings.LabelPosition == IconLabelPosition.Before)
207 {
208 <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>
209 }
210 else
211 {
212 <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>
213 }
214 }
215 }
216 else if (!string.IsNullOrEmpty(settings.Label))
217 {
218 @settings.Label
219 }
220 }
221 }
222 @using System.Reflection
223 @using Dynamicweb.Rapido.Blocks.Components.General
224 @using Dynamicweb.Rapido.Blocks.Components
225 @using Dynamicweb.Core
226
227 @* Component *@
228
229 @helper RenderButton(Button settings)
230 {
231 if (settings != null && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null))
232 {
233 Dictionary<string, string> attributes = new Dictionary<string, string>();
234 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>();
235 if (settings.Disabled) {
236 attributes.Add("disabled", "true");
237 classList.Add("disabled");
238 }
239
240 if (!string.IsNullOrEmpty(settings.ConfirmText) || !string.IsNullOrEmpty(settings.ConfirmTitle))
241 {
242 settings.Id = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N");
243 @RenderConfirmDialog(settings);
244 settings.OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = true";
245 }
246
247 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
248 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
249 if (!string.IsNullOrEmpty(settings.AltText))
250 {
251 attributes.Add("title", settings.AltText);
252 }
253 else if (!string.IsNullOrEmpty(settings.Title))
254 {
255 attributes.Add("title", settings.Title);
256 }
257
258 var onClickEvents = new List<string>();
259 if (!string.IsNullOrEmpty(settings.OnClick))
260 {
261 onClickEvents.Add(settings.OnClick);
262 }
263 if (!string.IsNullOrEmpty(settings.Href))
264 {
265 onClickEvents.Add("location.href='" + settings.Href + "'");
266 }
267 if (onClickEvents.Count > 0)
268 {
269 attributes.Add("onClick", string.Join(";", onClickEvents));
270 }
271
272 if (settings.ButtonLayout != ButtonLayout.None)
273 {
274 classList.Add("btn");
275 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower();
276 if (btnLayout == "linkclean")
277 {
278 btnLayout = "link-clean"; //fix
279 }
280 classList.Add("btn--" + btnLayout);
281 }
282
283 if (settings.Icon == null)
284 {
285 settings.Icon = new Icon();
286 }
287
288 settings.Icon.CssClass += Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower() != "linkclean" ? " u-flex--align-center" : "";
289 settings.Icon.Label = settings.Title;
290
291 attributes.Add("type", Enum.GetName(typeof(ButtonType), settings.ButtonType).ToLower());
292
293 <button class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</button>
294 }
295 }
296
297 @helper RenderConfirmDialog(Button settings)
298 {
299 Modal confirmDialog = new Modal {
300 Id = settings.Id,
301 Width = ModalWidth.Sm,
302 Heading = new Heading
303 {
304 Level = 2,
305 Title = settings.ConfirmTitle
306 },
307 BodyText = settings.ConfirmText
308 };
309
310 confirmDialog.AddAction(new Button { Title = Translate("Cancel"), ButtonLayout = ButtonLayout.Secondary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false"});
311 confirmDialog.AddAction(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false;" + settings.OnClick });
312
313 @Render(confirmDialog)
314 }
315 @using Dynamicweb.Rapido.Blocks.Components.General
316 @using Dynamicweb.Rapido.Blocks.Components
317 @using Dynamicweb.Core
318
319 @helper RenderDashboard(Dashboard settings)
320 {
321 var widgets = settings.GetWidgets();
322
323 if (!string.IsNullOrEmpty(settings.WidgetsBaseBackgroundColor))
324 {
325 //set bg color for them
326
327 System.Drawing.Color color = System.Drawing.ColorTranslator.FromHtml(settings.WidgetsBaseBackgroundColor);
328 int r = Convert.ToInt16(color.R);
329 int g = Convert.ToInt16(color.G);
330 int b = Convert.ToInt16(color.B);
331
332 var count = widgets.Length;
333 var max = Math.Max(r, Math.Max(g, b));
334 double step = 255.0 / (max * count);
335 var i = 0;
336 foreach (var widget in widgets)
337 {
338 i++;
339
340 var shade = "rgb(" + Converter.ToString(r * step * i).Replace(",", ".") + ", " + Converter.ToString(g * step * i).Replace(",", ".") + ", " + Converter.ToString(b * step * i).Replace(",", ".") + ")";
341 widget.BackgroundColor = shade;
342 }
343 }
344
345 <div class="dashboard @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
346 @foreach (var widget in widgets)
347 {
348 <div class="dashboard__widget">
349 @Render(widget)
350 </div>
351 }
352 </div>
353 }
354 @using Dynamicweb.Rapido.Blocks.Components.General
355 @using Dynamicweb.Rapido.Blocks.Components
356
357 @helper RenderDashboardWidgetLink(DashboardWidgetLink settings)
358 {
359 if (!string.IsNullOrEmpty(settings.Link))
360 {
361 var backgroundStyles = "";
362 if (!string.IsNullOrEmpty(settings.BackgroundColor))
363 {
364 backgroundStyles = "style=\"background-color:" + settings.BackgroundColor + "\"";
365 }
366
367 <a href="@settings.Link" class="widget widget--link @settings.CssClass dw-mod" @backgroundStyles title="@settings.Title" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
368 <div class="u-center-middle u-color-light">
369 @if (settings.Icon != null)
370 {
371 settings.Icon.CssClass += "widget__icon";
372 @Render(settings.Icon)
373 }
374 <div class="widget__title">@settings.Title</div>
375 </div>
376 </a>
377 }
378 }
379 @using Dynamicweb.Rapido.Blocks.Components.General
380 @using Dynamicweb.Rapido.Blocks.Components
381
382 @helper RenderDashboardWidgetCounter(DashboardWidgetCounter settings)
383 {
384 var backgroundStyles = "";
385 if (!string.IsNullOrEmpty(settings.BackgroundColor))
386 {
387 backgroundStyles = "style='background-color:" + settings.BackgroundColor + "'";
388 }
389
390 <div class="widget @settings.CssClass dw-mod" @backgroundStyles @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
391 <div class="u-center-middle u-color-light">
392 @if (settings.Icon != null)
393 {
394 settings.Icon.CssClass += "widget__icon";
395 @Render(settings.Icon)
396 }
397 <div class="widget__counter">@settings.Count</div>
398 <div class="widget__title">@settings.Title</div>
399 </div>
400 </div>
401 }
402 @using System.Reflection
403 @using Dynamicweb.Rapido.Blocks.Components.General
404 @using Dynamicweb.Rapido.Blocks.Components
405 @using Dynamicweb.Core
406
407 @* Component *@
408
409 @helper RenderLink(Link settings)
410 {
411 if (settings != null && !string.IsNullOrEmpty(settings.Href) && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null))
412 {
413 Dictionary<string, string> attributes = new Dictionary<string, string>();
414 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>();
415 if (settings.Disabled)
416 {
417 attributes.Add("disabled", "true");
418 classList.Add("disabled");
419 }
420
421 if (!string.IsNullOrEmpty(settings.AltText))
422 {
423 attributes.Add("title", settings.AltText);
424 }
425 else if (!string.IsNullOrEmpty(settings.Title))
426 {
427 attributes.Add("title", settings.Title);
428 }
429
430 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
431 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
432 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onClick", settings.OnClick); }
433 attributes.Add("href", settings.Href);
434
435 if (settings.ButtonLayout != ButtonLayout.None)
436 {
437 classList.Add("btn");
438 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower();
439 if (btnLayout == "linkclean")
440 {
441 btnLayout = "link-clean"; //fix
442 }
443 classList.Add("btn--" + btnLayout);
444 }
445
446 if (settings.Icon == null)
447 {
448 settings.Icon = new Icon();
449 }
450 settings.Icon.Label = settings.Title;
451
452 if (settings.Target == LinkTargetType.Blank && settings.Rel == LinkRelType.None)
453 {
454 settings.Rel = LinkRelType.Noopener;
455 }
456 if (settings.Target != LinkTargetType.None)
457 {
458 attributes.Add("target", "_" + Enum.GetName(typeof(LinkTargetType), settings.Target).ToLower());
459 }
460 if (settings.Download)
461 {
462 attributes.Add("download", "true");
463 }
464 if (settings.Rel != LinkRelType.None)
465 {
466 attributes.Add("rel", Enum.GetName(typeof(LinkRelType), settings.Rel).ToLower());
467 }
468
469 <a class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</a>
470 }
471 }
472 @using System.Reflection
473 @using Dynamicweb.Rapido.Blocks.Components
474 @using Dynamicweb.Rapido.Blocks.Components.General
475 @using Dynamicweb.Rapido.Blocks
476
477
478 @* Component *@
479
480 @helper RenderRating(Rating settings)
481 {
482 if (settings.Score > 0)
483 {
484 int rating = settings.Score;
485 string iconType = "fa-star";
486
487 switch (settings.Type.ToString()) {
488 case "Stars":
489 iconType = "fa-star";
490 break;
491 case "Hearts":
492 iconType = "fa-heart";
493 break;
494 case "Lemons":
495 iconType = "fa-lemon";
496 break;
497 case "Bombs":
498 iconType = "fa-bomb";
499 break;
500 }
501
502 <div class="u-ta-right">
503 @for (int i = 0; i < settings.OutOf; i++)
504 {
505 <i class="@(rating > i ? "fas" : "far") @iconType"></i>
506 }
507 </div>
508 }
509 }
510 @using System.Reflection
511 @using Dynamicweb.Rapido.Blocks.Components.General
512 @using Dynamicweb.Rapido.Blocks.Components
513
514
515 @* Component *@
516
517 @helper RenderSelectFieldOption(SelectFieldOption settings)
518 {
519 Dictionary<string, string> attributes = new Dictionary<string, string>();
520 if (settings.Checked) { attributes.Add("selected", "true"); }
521 if (settings.Disabled) { attributes.Add("disabled", "true"); }
522 if (settings.Value != null) { attributes.Add("value", settings.Value); }
523 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
524
525 <option @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Label</option>
526 }
527 @using System.Reflection
528 @using Dynamicweb.Rapido.Blocks.Components.General
529 @using Dynamicweb.Rapido.Blocks.Components
530
531
532 @* Component *@
533
534 @helper RenderNavigation(Navigation settings) {
535 @RenderNavigation(new
536 {
537 id = settings.Id,
538 cssclass = settings.CssClass,
539 startLevel = settings.StartLevel,
540 endlevel = settings.EndLevel,
541 expandmode = settings.Expandmode,
542 sitemapmode = settings.SitemapMode,
543 template = settings.Template
544 })
545 }
546 @using Dynamicweb.Rapido.Blocks.Components.General
547 @using Dynamicweb.Rapido.Blocks.Components
548
549
550 @* Component *@
551
552 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) {
553 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id;
554 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template;
555 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel;
556 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel;
557 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode;
558 settings.SitemapMode = false;
559
560 @RenderNavigation(settings)
561 }
562 @using Dynamicweb.Rapido.Blocks.Components.General
563 @using Dynamicweb.Rapido.Blocks.Components
564
565
566 @* Component *@
567
568 @helper RenderLeftNavigation(LeftNavigation settings) {
569 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id;
570 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template;
571 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel;
572 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel;
573 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode;
574
575 <div class="grid__cell">
576 @RenderNavigation(settings)
577 </div>
578 }
579 @using System.Reflection
580 @using Dynamicweb.Rapido.Blocks.Components.General
581 @using Dynamicweb.Core
582
583 @* Component *@
584
585 @helper RenderHeading(Heading settings)
586 {
587 if (settings != null && !string.IsNullOrEmpty(settings.Title))
588 {
589 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : "";
590 string tagName = settings.Level != 0 ? "h" + settings.Level.ToString() : "div";
591
592 @("<" + tagName + " class=\"" + settings.CssClass + " dw-mod\" " + color + ">")
593 if (!string.IsNullOrEmpty(settings.Link))
594 {
595 @Render(new Link { Href = settings.Link, Icon = settings.Icon, Title = settings.Title, ButtonLayout = ButtonLayout.None })
596 }
597 else
598 {
599 if (settings.Icon == null)
600 {
601 settings.Icon = new Icon();
602 }
603 settings.Icon.Label = settings.Title;
604 @Render(settings.Icon)
605 }
606 @("</" + tagName + ">");
607 }
608 }
609 @using Dynamicweb.Rapido.Blocks.Components
610 @using Dynamicweb.Rapido.Blocks.Components.General
611 @using Dynamicweb.Rapido.Blocks
612
613
614 @* Component *@
615
616 @helper RenderImage(Image settings)
617 {
618 if (settings.FilterPrimary != ImageFilter.None || settings.FilterSecondary != ImageFilter.None)
619 {
620 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>();
621 if (!string.IsNullOrEmpty(settings.FilterColor)) { optionalAttributes.Add("style", "background-color: " + settings.FilterColor); }
622
623 if (settings.Caption != null)
624 {
625 @:<div>
626 }
627
628 var primaryFilterClass = settings.FilterPrimary.ToString().ToLower();
629 var secondaryFilterClass = settings.FilterSecondary.ToString().ToLower();
630
631 <div class="image-filter image-filter--@primaryFilterClass u-position-relative dw-mod" @ComponentMethods.AddAttributes(optionalAttributes)>
632 <div class="image-filter image-filter--@secondaryFilterClass dw-mod">
633 @if (settings.Link != null)
634 {
635 <a href="@settings.Link">
636 @RenderTheImage(settings)
637 </a>
638 }
639 else
640 {
641 @RenderTheImage(settings)
642 }
643 </div>
644 </div>
645
646 if (settings.Caption != null)
647 {
648 <span class="image-caption dw-mod">@settings.Caption</span>
649 @:</div>
650 }
651 }
652 else
653 {
654 if (settings.Caption != null)
655 {
656 @:<div>
657 }
658 if (!string.IsNullOrEmpty(settings.Link))
659 {
660 <a href="@settings.Link">
661 @RenderTheImage(settings)
662 </a>
663 }
664 else
665 {
666 @RenderTheImage(settings)
667 }
668
669 if (settings.Caption != null)
670 {
671 <span class="image-caption dw-mod">@settings.Caption</span>
672 @:</div>
673 }
674 }
675 }
676
677 @helper RenderTheImage(Image settings)
678 {
679 if (settings != null)
680 {
681 string alternativeImage = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("AlternativeImage")) ? Pageview.AreaSettings.GetItem("Settings").GetFile("AlternativeImage").PathUrlEncoded : "/Images/missing_image.jpg";
682 string placeholderImage = "/Files/Images/placeholder.gif";
683 string imageEngine = "/Admin/Public/GetImage.ashx?";
684
685 string imageStyle = "";
686
687 switch (settings.Style)
688 {
689 case ImageStyle.Ball:
690 imageStyle = "grid__cell-img--ball";
691 break;
692
693 case ImageStyle.Triangle:
694 imageStyle = "grid__cell-img--triangle";
695 break;
696 }
697
698 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle || settings.Style == ImageStyle.Triangle)
699 {
700 settings.ImageDefault.Crop = settings.ImageDefault.Crop == 5 ? settings.ImageDefault.Crop = 0 : settings.ImageDefault.Crop;
701
702 if (settings.ImageDefault != null)
703 {
704 settings.ImageDefault.Height = settings.ImageDefault.Width;
705 }
706 if (settings.ImageMedium != null)
707 {
708 settings.ImageMedium.Height = settings.ImageMedium.Width;
709 }
710 if (settings.ImageSmall != null)
711 {
712 settings.ImageSmall.Height = settings.ImageSmall.Width;
713 }
714 }
715
716 string defaultImage = imageEngine;
717 string imageSmall = "";
718 string imageMedium = "";
719
720 if (settings.DisableImageEngine)
721 {
722 defaultImage = settings.Path;
723 }
724 else
725 {
726 if (settings.ImageDefault != null)
727 {
728 defaultImage += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageDefault);
729
730 if (settings.Path.GetType() != typeof(string))
731 {
732 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
733 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
734 }
735 else
736 {
737 defaultImage += settings.Path != null ? "Image=" + settings.Path : "";
738 }
739
740 defaultImage += "&AlternativeImage=" + alternativeImage;
741 }
742
743 if (settings.ImageSmall != null)
744 {
745 imageSmall = "data-src-small=\"" + imageEngine;
746 imageSmall += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageSmall);
747
748 if (settings.Path.GetType() != typeof(string))
749 {
750 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
751 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
752 }
753 else
754 {
755 imageSmall += settings.Path != null ? "Image=" + settings.Path : "";
756 }
757
758 imageSmall += "&alternativeImage=" + alternativeImage;
759
760 imageSmall += "\"";
761 }
762
763 if (settings.ImageMedium != null)
764 {
765 imageMedium = "data-src-medium=\"" + imageEngine;
766 imageMedium += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageMedium);
767
768 if (settings.Path.GetType() != typeof(string))
769 {
770 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
771 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
772 }
773 else
774 {
775 imageMedium += settings.Path != null ? "Image=" + settings.Path : "";
776 }
777
778 imageMedium += "&alternativeImage=" + alternativeImage;
779
780 imageMedium += "\"";
781 }
782 }
783
784 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>();
785 if (!string.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); }
786 if (!string.IsNullOrEmpty(settings.Title))
787 {
788 optionalAttributes.Add("alt", settings.Title);
789 optionalAttributes.Add("title", settings.Title);
790 }
791
792 if (settings.DisableLazyLoad)
793 {
794 <img id="@settings.Id" class="@imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) />
795 }
796 else
797 {
798 <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) />
799 }
800 }
801 }
802 @using System.Reflection
803 @using Dynamicweb.Rapido.Blocks.Components.General
804 @using Dynamicweb.Rapido.Blocks.Components
805
806 @* Component *@
807
808 @helper RenderFileField(FileField settings)
809 {
810 var attributes = new Dictionary<string, string>();
811 if (string.IsNullOrEmpty(settings.Id))
812 {
813 settings.Id = Guid.NewGuid().ToString("N");
814 }
815
816 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
817 if (settings.Disabled) { attributes.Add("disabled", "true"); }
818 if (settings.Required) { attributes.Add("required", "true"); }
819 if (settings.Multiple) { attributes.Add("multiple", "true"); }
820 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
821 if (string.IsNullOrEmpty(settings.ChooseFileText))
822 {
823 settings.ChooseFileText = Translate("Choose file");
824 }
825 if (string.IsNullOrEmpty(settings.NoFilesChosenText))
826 {
827 settings.NoFilesChosenText = Translate("No files chosen...");
828 }
829 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
830
831 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
832
833 string setValueToFakeInput = "FileUpload.setValueToFakeInput(this)";
834 attributes.Add("onchange", setValueToFakeInput + (!string.IsNullOrEmpty(settings.OnChange) ? settings.OnChange : ""));
835
836 attributes.Add("type", "file");
837 if (settings.Value != null) { attributes.Add("value", settings.Value); }
838 settings.CssClass = "u-full-width " + settings.CssClass;
839
840 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
841
842 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod">
843 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
844 {
845 <div class="u-full-width">
846 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
847 @if (settings.Link != null) {
848 <div class="u-pull--right">
849 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
850 @Render(settings.Link)
851 </div>
852 }
853 </div>
854
855 }
856
857 @if (!string.IsNullOrEmpty(settings.HelpText))
858 {
859 <small class="form__help-text">@settings.HelpText</small>
860 }
861
862 <div class="form__field-combi file-input u-no-margin dw-mod">
863 <input @ComponentMethods.AddAttributes(resultAttributes) class="file-input__real-input" data-no-files-text="@settings.NoFilesChosenText" data-many-files-text="@Translate("files")" />
864 <label for="@settings.Id" class="file-input__btn btn--secondary btn dw-mod">@settings.ChooseFileText</label>
865 <label for="@settings.Id" class="@settings.CssClass file-input__fake-input js-fake-input dw-mod">@settings.NoFilesChosenText</label>
866 @if (settings.UploadButton != null)
867 {
868 settings.UploadButton.CssClass += " btn--condensed u-no-margin";
869 @Render(settings.UploadButton)
870 }
871 </div>
872 @Render(new NotificationMessage { Message = settings.ErrorMessage })
873 </div>
874 }
875 @using System.Reflection
876 @using Dynamicweb.Rapido.Blocks.Components.General
877 @using Dynamicweb.Rapido.Blocks.Components
878 @using Dynamicweb.Core
879 @using System.Linq
880
881 @* Component *@
882
883 @helper RenderDateTimeField(DateTimeField settings)
884 {
885 if (string.IsNullOrEmpty(settings.Id))
886 {
887 settings.Id = Guid.NewGuid().ToString("N");
888 }
889
890 var textField = new TextField {
891 Name = settings.Name,
892 Id = settings.Id,
893 Label = settings.Label,
894 HelpText = settings.HelpText,
895 Value = settings.Value,
896 Disabled = settings.Disabled,
897 Required = settings.Required,
898 ErrorMessage = settings.ErrorMessage,
899 CssClass = settings.CssClass,
900 WrapperCssClass = settings.WrapperCssClass,
901 OnChange = settings.OnChange,
902 OnClick = settings.OnClick,
903 Link = settings.Link,
904 ExtraAttributes = settings.ExtraAttributes,
905 //
906 Placeholder = settings.Placeholder
907 };
908
909 @Render(textField)
910
911 List<string> jsAttributes = new List<string>();
912
913 jsAttributes.Add("mode: '" + Enum.GetName(typeof(DateTimeFieldMode), settings.Mode).ToLower() + "'");
914
915 if (!string.IsNullOrEmpty(settings.DateFormat))
916 {
917 jsAttributes.Add("dateFormat: '" + settings.DateFormat + "'");
918 }
919 if (!string.IsNullOrEmpty(settings.MinDate))
920 {
921 jsAttributes.Add("minDate: '" + settings.MinDate + "'");
922 }
923 if (!string.IsNullOrEmpty(settings.MaxDate))
924 {
925 jsAttributes.Add("maxDate: '" + settings.MaxDate + "'");
926 }
927 if (settings.IsInline)
928 {
929 jsAttributes.Add("inline: " + Converter.ToString(settings.IsInline).ToLower());
930 }
931 if (settings.EnableTime)
932 {
933 jsAttributes.Add("enableTime: " + Converter.ToString(settings.EnableTime).ToLower());
934 }
935 if (settings.EnableWeekNumbers)
936 {
937 jsAttributes.Add("weekNumbers: " + Converter.ToString(settings.EnableWeekNumbers).ToLower());
938 }
939
940 jsAttributes.AddRange(settings.GetFlatPickrOptions().Select(x => x.Key + ": " + x.Value));
941
942 <script>
943 document.addEventListener("DOMContentLoaded", function () {
944 flatpickr("#@textField.Id", {
945 @string.Join(",", jsAttributes)
946 });
947 });
948 </script>
949 }
950 @using System.Reflection
951 @using Dynamicweb.Rapido.Blocks.Components.General
952 @using Dynamicweb.Rapido.Blocks.Components
953
954 @* Component *@
955
956 @helper RenderTextField(TextField settings)
957 {
958 var attributes = new Dictionary<string, string>();
959 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
960 {
961 settings.Id = Guid.NewGuid().ToString("N");
962 }
963
964 /*base settings*/
965 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
966 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
967 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
968 if (settings.Disabled) { attributes.Add("disabled", "true"); }
969 if (settings.Required) { attributes.Add("required", "true"); }
970 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
971 /*end*/
972
973 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
974 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
975 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
976 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
977 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); }
978 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); }
979 attributes.Add("type", Enum.GetName(typeof(TextFieldType), settings.Type).ToLower());
980 if (settings.Type == TextFieldType.Password) { attributes.Add("autocomplete", "off"); };
981 if (settings.Value != null) { attributes.Add("value", settings.Value); }
982
983 settings.CssClass = "u-full-width " + settings.CssClass;
984
985 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
986
987 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
988
989 string noMargin = "u-no-margin";
990 if (!settings.ReadOnly) {
991 noMargin = "";
992 }
993
994 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod">
995 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
996 {
997 <div class="u-full-width">
998 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
999 @if (settings.Link != null) {
1000 settings.Link.ButtonLayout = ButtonLayout.LinkClean;
1001
1002 <div class="u-pull--right">
1003 @Render(settings.Link)
1004 </div>
1005 }
1006 </div>
1007
1008 }
1009
1010 @if (!string.IsNullOrEmpty(settings.HelpText))
1011 {
1012 <small class="form__help-text">@settings.HelpText</small>
1013 }
1014
1015 @if (settings.ActionButton != null)
1016 {
1017 settings.ActionButton.CssClass += " btn--condensed u-no-margin";
1018 <div class="form__field-combi u-no-margin dw-mod">
1019 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1020 @Render(settings.ActionButton)
1021 </div>
1022 }
1023 else
1024 {
1025 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1026 }
1027
1028 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1029 </div>
1030 }
1031 @using System.Reflection
1032 @using Dynamicweb.Rapido.Blocks.Components.General
1033 @using Dynamicweb.Rapido.Blocks.Components
1034
1035 @* Component *@
1036
1037 @helper RenderNumberField(NumberField settings)
1038 {
1039 var attributes = new Dictionary<string, string>();
1040 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1041 {
1042 settings.Id = Guid.NewGuid().ToString("N");
1043 }
1044
1045 /*base settings*/
1046 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1047 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1048 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1049 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1050 if (settings.Required) { attributes.Add("required", "true"); }
1051 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1052 /*end*/
1053
1054 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
1055 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
1056 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
1057 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
1058 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); }
1059 if (settings.Min != null) { attributes.Add("min", settings.Min.ToString()); }
1060 if (settings.Step != 0) { attributes.Add("step", settings.Step.ToString()); }
1061 if (settings.Value != null && !string.IsNullOrEmpty(settings.Value.ToString())) { attributes.Add("value", settings.Value.ToString()); }
1062 attributes.Add("type", "number");
1063
1064 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1065
1066 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod">
1067 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1068 {
1069 <div class="u-full-width">
1070 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1071 @if (settings.Link != null) {
1072 <div class="u-pull--right">
1073 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1074 @Render(settings.Link)
1075 </div>
1076 }
1077 </div>
1078
1079 }
1080
1081 @if (!string.IsNullOrEmpty(settings.HelpText))
1082 {
1083 <small class="form__help-text">@settings.HelpText</small>
1084 }
1085
1086 @if (settings.ActionButton != null)
1087 {
1088 settings.ActionButton.CssClass += " btn--condensed u-no-margin";
1089 <div class="form__field-combi u-no-margin dw-mod">
1090 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1091 @Render(settings.ActionButton)
1092 </div>
1093 }
1094 else
1095 {
1096 <div class="form__field-combi u-no-margin dw-mod">
1097 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1098 </div>
1099 }
1100
1101 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1102 </div>
1103 }
1104 @using System.Reflection
1105 @using Dynamicweb.Rapido.Blocks.Components.General
1106 @using Dynamicweb.Rapido.Blocks.Components
1107
1108
1109 @* Component *@
1110
1111 @helper RenderTextareaField(TextareaField settings)
1112 {
1113 Dictionary<string, string> attributes = new Dictionary<string, string>();
1114 string id = settings.Id;
1115 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(id))
1116 {
1117 id = Guid.NewGuid().ToString("N");
1118 }
1119
1120 if (!string.IsNullOrEmpty(id)) { attributes.Add("id", id); }
1121 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1122 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
1123 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
1124 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
1125 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1126 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); }
1127 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1128 if (settings.Required) { attributes.Add("required", "true"); }
1129 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
1130 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); }
1131 if (settings.Rows != 0) { attributes.Add("rows", settings.Rows.ToString()); }
1132 attributes.Add("name", settings.Name);
1133
1134 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
1135
1136 <div class="form__field-group @settings.WrapperCssClass dw-mod">
1137 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1138 {
1139 <div class="u-full-width">
1140 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1141 @if (settings.Link != null) {
1142 <div class="u-pull--right">
1143 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1144 @Render(settings.Link)
1145 </div>
1146 }
1147 </div>
1148 }
1149
1150 @if (!string.IsNullOrEmpty(settings.HelpText))
1151 {
1152 <small class="form__help-text">@settings.HelpText</small>
1153 }
1154
1155 <textarea class="u-full-width @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Value</textarea>
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
1165 @* Component *@
1166
1167 @helper RenderHiddenField(HiddenField settings) {
1168 var attributes = new Dictionary<string, string>();
1169 attributes.Add("type", "hidden");
1170 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1171 if (settings.Value != null) { attributes.Add("value", settings.Value); }
1172 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1173
1174 <input @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)/>
1175 }
1176 @using System.Reflection
1177 @using Dynamicweb.Rapido.Blocks.Components.General
1178 @using Dynamicweb.Rapido.Blocks.Components
1179
1180 @* Component *@
1181
1182 @helper RenderCheckboxField(CheckboxField settings)
1183 {
1184 var attributes = new Dictionary<string, string>();
1185 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1186 {
1187 settings.Id = Guid.NewGuid().ToString("N");
1188 }
1189
1190 /*base settings*/
1191 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1192 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1193 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1194 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1195 if (settings.Required) { attributes.Add("required", "true"); }
1196 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1197 /*end*/
1198
1199 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
1200
1201 attributes.Add("type", "checkbox");
1202 if (settings.Checked) { attributes.Add("checked", "true"); }
1203 settings.CssClass = "form__control " + settings.CssClass;
1204 if (settings.Value != null) { attributes.Add("value", settings.Value); }
1205
1206 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1207
1208 <div class="form__field-group @settings.WrapperCssClass dw-mod">
1209 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1210 @if (!string.IsNullOrEmpty(settings.Label))
1211 {
1212 <label for="@settings.Id" class="dw-mod">@settings.Label</label>
1213 }
1214
1215 @if (settings.Link != null) {
1216 <span>
1217 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1218 @Render(settings.Link)
1219 </span>
1220 }
1221
1222 @if (!string.IsNullOrEmpty(settings.HelpText))
1223 {
1224 <small class="form__help-text checkbox-help dw-mod">@settings.HelpText</small>
1225 }
1226 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1227 </div>
1228 }
1229 @using System.Reflection
1230 @using Dynamicweb.Rapido.Blocks.Components.General
1231 @using Dynamicweb.Rapido.Blocks.Components
1232
1233
1234 @* Component *@
1235
1236 @helper RenderCheckboxListField(CheckboxListField settings)
1237 {
1238 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1239 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1240 {
1241 <div class="u-full-width">
1242 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1243 @if (settings.Link != null) {
1244 <div class="u-pull--right">
1245 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1246 @Render(settings.Link)
1247 </div>
1248 }
1249 </div>
1250
1251 }
1252
1253 <div class="u-pull--left">
1254 @if (!string.IsNullOrEmpty(settings.HelpText))
1255 {
1256 <small class="form__help-text">@settings.HelpText</small>
1257 }
1258
1259 @foreach (var item in settings.Options)
1260 {
1261 if (settings.Required)
1262 {
1263 item.Required = true;
1264 }
1265 if (settings.Disabled)
1266 {
1267 item.Disabled = true;
1268 }
1269 if (!string.IsNullOrEmpty(settings.Name))
1270 {
1271 item.Name = settings.Name;
1272 }
1273 if (!string.IsNullOrEmpty(settings.CssClass))
1274 {
1275 item.CssClass += settings.CssClass;
1276 }
1277
1278 /* value is not supported */
1279
1280 if (!string.IsNullOrEmpty(settings.OnClick))
1281 {
1282 item.OnClick += settings.OnClick;
1283 }
1284 if (!string.IsNullOrEmpty(settings.OnChange))
1285 {
1286 item.OnChange += settings.OnChange;
1287 }
1288 @Render(item)
1289 }
1290
1291 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1292 </div>
1293
1294 </div>
1295 }
1296 @using Dynamicweb.Rapido.Blocks.Components.General
1297
1298 @* Component *@
1299
1300 @helper RenderSearch(Search settings)
1301 {
1302 var searchValue = HttpContext.Current.Request.QueryString.Get(settings.SearchParameter) ?? "";
1303 var groupValue = HttpContext.Current.Request.QueryString.Get(settings.GroupsParameter) ?? "";
1304
1305 if (string.IsNullOrEmpty(settings.Id))
1306 {
1307 settings.Id = Guid.NewGuid().ToString("N");
1308 }
1309
1310 var resultAttributes = new Dictionary<string, string>();
1311
1312 if (settings.PageSize != 0)
1313 {
1314 resultAttributes.Add("data-page-size", settings.PageSize.ToString());
1315 }
1316 if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl))
1317 {
1318 resultAttributes.Add("data-groups-feed-url", settings.GroupItemsFeedUrl);
1319 if (!string.IsNullOrEmpty(groupValue))
1320 {
1321 resultAttributes.Add("data-selected-group", groupValue);
1322 }
1323 if (!string.IsNullOrEmpty(settings.GroupsParameter))
1324 {
1325 resultAttributes.Add("data-groups-parameter", settings.GroupsParameter);
1326 }
1327 }
1328 resultAttributes.Add("data-force-init", "true");
1329 if (settings.GoToFirstSearchResultOnEnter)
1330 {
1331 resultAttributes.Add("data-go-to-first-search-result-on-enter", settings.GoToFirstSearchResultOnEnter.ToString().ToLower());
1332 }
1333 if (!string.IsNullOrEmpty(settings.SearchParameter))
1334 {
1335 resultAttributes.Add("data-search-parameter", settings.SearchParameter);
1336 }
1337 resultAttributes.Add("data-search-feed-url", settings.SearchData.SearchFeedUrl);
1338 resultAttributes.Add("data-results-template-id", settings.SearchData.ResultsTemplateId);
1339
1340 if (settings.SecondSearchData != null)
1341 {
1342 resultAttributes.Add("data-second-search-feed-url", settings.SecondSearchData.SearchFeedUrl);
1343 resultAttributes.Add("data-second-results-template-id", settings.SecondSearchData.ResultsTemplateId);
1344 }
1345 if (!string.IsNullOrEmpty(settings.ResultsPageUrl))
1346 {
1347 resultAttributes.Add("data-results-page-url", settings.ResultsPageUrl);
1348 }
1349
1350 resultAttributes = resultAttributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1351
1352 string searchFieldCss = (settings.SearchButton == null) ? "search--with-icon" : "";
1353
1354 <div class="search @settings.CssClass @searchFieldCss js-search-data-source dw-mod" id="@settings.Id" @ComponentMethods.AddAttributes(resultAttributes)>
1355 @if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl))
1356 {
1357 <button type="button" class="search__groups-btn dw-mod js-search-groups-btn">@Translate("All")</button>
1358 <ul class="dropdown dropdown--absolute-position dw-mod search__groups-results js-search-groups-list"></ul>
1359 }
1360
1361 <input type="text" class="search__field dw-mod js-search-field @settings.CssClass" placeholder="@settings.Placeholder" value="@searchValue" id="@settings.Id-Test">
1362
1363 <div class="dropdown dropdown--absolute-position search__results dw-mod js-search-results @(settings.SecondSearchData != null ? "search__results--combined" : "")">
1364 @if (settings.SecondSearchData != null)
1365 {
1366 <div class="search__column search__column--products dw-mod">
1367 <div class="search__column-header dw-mod">@Translate("Products")</div>
1368 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul>
1369 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl))
1370 {
1371 @Render(new Link {
1372 Title = Translate("View all"),
1373 CssClass = "js-view-all-button u-margin",
1374 Href = settings.SearchData.ResultsPageUrl
1375 });
1376 }
1377 </div>
1378 <div class="search__column search__column--pages dw-mod">
1379 <div class="search__column-header">@Translate("Pages")</div>
1380 <ul class="search__results-list dw-mod js-search-results-second-list" id="@(settings.Id)_SecondResultsList"></ul>
1381 @if (!string.IsNullOrEmpty(settings.SecondSearchData.ResultsPageUrl))
1382 {
1383 @Render(new Link
1384 {
1385 Title = Translate("View all"),
1386 CssClass = "js-view-all-button u-margin",
1387 Href = settings.SecondSearchData.ResultsPageUrl
1388 });
1389 }
1390 </div>
1391 }
1392 else
1393 {
1394 <div class="search__column search__column--only dw-mod">
1395 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul>
1396 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl))
1397 {
1398 @Render(new Link {
1399 Title = Translate("View all"),
1400 CssClass = "js-view-all-button u-margin",
1401 Href = settings.SearchData.ResultsPageUrl
1402 });
1403 }
1404 </div>
1405 }
1406 </div>
1407
1408 @if (settings.SearchButton != null)
1409 {
1410 settings.SearchButton.CssClass += " search__btn js-search-btn";
1411 if (settings.RenderDefaultSearchIcon)
1412 {
1413 settings.SearchButton.Icon = new Icon { Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue };
1414 }
1415 @Render(settings.SearchButton);
1416 }
1417 </div>
1418 }
1419 @using System.Reflection
1420 @using Dynamicweb.Rapido.Blocks.Components.General
1421 @using Dynamicweb.Rapido.Blocks.Components
1422
1423
1424 @* Component *@
1425
1426 @helper RenderSelectField(SelectField settings)
1427 {
1428 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1429 {
1430 settings.Id = Guid.NewGuid().ToString("N");
1431 }
1432
1433 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod">
1434 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1435 {
1436 <div class="u-full-width">
1437 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1438 @if (settings.Link != null) {
1439 <div class="u-pull--right">
1440 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1441 @Render(settings.Link)
1442 </div>
1443 }
1444 </div>
1445 }
1446
1447 @if (!string.IsNullOrEmpty(settings.HelpText))
1448 {
1449 <small class="form__help-text">@settings.HelpText</small>
1450 }
1451
1452 @if (settings.ActionButton != null)
1453 {
1454 settings.ActionButton.CssClass += " btn--condensed u-no-margin";
1455 <div class="form__field-combi u-no-margin dw-mod">
1456 @RenderSelectBase(settings)
1457 @Render(settings.ActionButton)
1458 </div>
1459 }
1460 else
1461 {
1462 @RenderSelectBase(settings)
1463 }
1464
1465 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1466 </div>
1467 }
1468
1469 @helper RenderSelectBase(SelectField settings)
1470 {
1471 var attributes = new Dictionary<string, string>();
1472
1473 /*base settings*/
1474 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1475 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1476 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1477 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1478 if (settings.Required) { attributes.Add("required", "true"); }
1479 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1480 /*end*/
1481
1482 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1483
1484 <select @ComponentMethods.AddAttributes(resultAttributes) class="u-full-width @settings.CssClass dw-mod">
1485 @if (settings.Default != null)
1486 {
1487 @Render(settings.Default)
1488 }
1489
1490 @foreach (var item in settings.Options)
1491 {
1492 if (settings.Value != null) {
1493 item.Checked = item.Value == settings.Value;
1494 }
1495 @Render(item)
1496 }
1497 </select>
1498 }
1499 @using System.Reflection
1500 @using Dynamicweb.Rapido.Blocks.Components.General
1501 @using Dynamicweb.Rapido.Blocks.Components
1502
1503 @* Component *@
1504
1505 @helper RenderRadioButtonField(RadioButtonField settings)
1506 {
1507 var attributes = new Dictionary<string, string>();
1508 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1509 {
1510 settings.Id = Guid.NewGuid().ToString("N");
1511 }
1512
1513 /*base settings*/
1514 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1515 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1516 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1517 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1518 if (settings.Required) { attributes.Add("required", "true"); }
1519 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1520 /*end*/
1521
1522 attributes.Add("type", "radio");
1523 if (settings.Checked) { attributes.Add("checked", "true"); }
1524 settings.CssClass = "form__control " + settings.CssClass;
1525 if (settings.Value != null) { attributes.Add("value", settings.Value); }
1526
1527 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1528
1529 <div class="form__field-group @settings.WrapperCssClass dw-mod">
1530 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1531 @if (!string.IsNullOrEmpty(settings.Label))
1532 {
1533 <label for="@settings.Id" class="dw-mod">@settings.Label</label>
1534 }
1535 @if (!string.IsNullOrEmpty(settings.HelpText))
1536 {
1537 <small class="form__help-text">@settings.HelpText</small>
1538 }
1539 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1540 </div>
1541 }
1542 @using System.Reflection
1543 @using Dynamicweb.Rapido.Blocks.Components.General
1544 @using Dynamicweb.Rapido.Blocks.Components
1545
1546
1547 @* Component *@
1548
1549 @helper RenderRadioButtonListField(RadioButtonListField settings)
1550 {
1551 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
1552
1553 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1554 @if (!string.IsNullOrEmpty(settings.Label))
1555 {
1556 <label>@settings.Label</label>
1557 }
1558 @if (!string.IsNullOrEmpty(settings.HelpText))
1559 {
1560 <small class="form__help-text">@settings.HelpText</small>
1561 }
1562
1563 @foreach (var item in settings.Options)
1564 {
1565 if (settings.Required)
1566 {
1567 item.Required = true;
1568 }
1569 if (settings.Disabled)
1570 {
1571 item.Disabled = true;
1572 }
1573 if (!string.IsNullOrEmpty(settings.Name))
1574 {
1575 item.Name = settings.Name;
1576 }
1577 if (settings.Value != null && settings.Value == item.Value)
1578 {
1579 item.Checked = true;
1580 }
1581 if (!string.IsNullOrEmpty(settings.OnClick))
1582 {
1583 item.OnClick += settings.OnClick;
1584 }
1585 if (!string.IsNullOrEmpty(settings.OnChange))
1586 {
1587 item.OnChange += settings.OnChange;
1588 }
1589 if (!string.IsNullOrEmpty(settings.CssClass))
1590 {
1591 item.CssClass += settings.CssClass;
1592 }
1593 @Render(item)
1594 }
1595
1596 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1597 </div>
1598 }
1599 @using System.Reflection
1600 @using Dynamicweb.Rapido.Blocks.Components.General
1601 @using Dynamicweb.Rapido.Blocks.Components
1602
1603
1604 @* Component *@
1605
1606 @helper RenderNotificationMessage(NotificationMessage settings)
1607 {
1608 if (!string.IsNullOrEmpty(settings.Message))
1609 {
1610 var attributes = new Dictionary<string, string>();
1611 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1612
1613 string messageTypeClass = Enum.GetName(typeof(NotificationMessageType), settings.MessageType).ToLower();
1614 string messageLayoutClass = Enum.GetName(typeof(NotificationMessageLayout), settings.MessageLayout).ToLower();
1615 string minHeightClass = settings.Icon != null ? "u-min-h70px" : "";
1616
1617 <div class="notification-message-@messageTypeClass notification-message-@messageLayoutClass @messageLayoutClass @minHeightClass @settings.CssClass u-full-width dw-mod" @ComponentMethods.AddAttributes(attributes)>
1618 @if (settings.Icon != null) {
1619 settings.Icon.Label = !string.IsNullOrEmpty(settings.Icon.Label) ? settings.Message + settings.Icon.Label : settings.Message;
1620 @Render(settings.Icon)
1621 } else {
1622 @settings.Message
1623 }
1624 </div>
1625 }
1626 }
1627 @using Dynamicweb.Rapido.Blocks.Components.General
1628
1629
1630 @* Component *@
1631
1632 @helper RenderHandlebarsRoot(HandlebarsRoot settings) {
1633 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : "";
1634
1635 <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>
1636 @if (settings.SubBlocks != null) {
1637 @RenderBlockList(settings.SubBlocks)
1638 }
1639 </div>
1640 }
1641 @using System.Reflection
1642 @using Dynamicweb.Rapido.Blocks.Components.General
1643 @using Dynamicweb.Rapido.Blocks.Components
1644 @using System.Text.RegularExpressions
1645
1646
1647 @* Component *@
1648
1649 @helper RenderSticker(Sticker settings) {
1650 if (!String.IsNullOrEmpty(settings.Title)) {
1651 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : "";
1652 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : "";
1653
1654 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>();
1655 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) {
1656 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : "";
1657 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : "";
1658 optionalAttributes.Add("style", styleTag);
1659 }
1660
1661 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div>
1662 }
1663 }
1664
1665 @using System.Reflection
1666 @using Dynamicweb.Rapido.Blocks.Components.General
1667 @using Dynamicweb.Rapido.Blocks.Components
1668
1669
1670 @* Component *@
1671
1672 @helper RenderStickersCollection(StickersCollection settings)
1673 {
1674 if (settings.Stickers.Count > 0)
1675 {
1676 string position = "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower();
1677
1678 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1679 @foreach (Sticker sticker in settings.Stickers)
1680 {
1681 @Render(sticker)
1682 }
1683 </div>
1684 }
1685 }
1686
1687 @using Dynamicweb.Rapido.Blocks.Components.General
1688
1689
1690 @* Component *@
1691
1692 @helper RenderForm(Form settings) {
1693 if (settings != null)
1694 {
1695 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>();
1696 if (!string.IsNullOrEmpty(settings.Action)) { optionalAttributes.Add("action", settings.Action); };
1697 if (!string.IsNullOrEmpty(settings.Name)) { optionalAttributes.Add("name", settings.Name); };
1698 if (!string.IsNullOrEmpty(settings.OnSubmit)) { optionalAttributes.Add("onsubmit", settings.OnSubmit); };
1699 var enctypes = new Dictionary<string, string>
1700 {
1701 { "multipart", "multipart/form-data" },
1702 { "text", "text/plain" },
1703 { "application", "application/x-www-form-urlencoded" }
1704 };
1705 if (settings.Enctype != FormEnctype.none) { optionalAttributes.Add("enctype", enctypes[Enum.GetName(typeof(FormEnctype), settings.Enctype).ToLower()]); };
1706 optionalAttributes.Add("method", settings.Method.ToString());
1707
1708 if (!string.IsNullOrEmpty(settings.FormStartMarkup))
1709 {
1710 @settings.FormStartMarkup
1711 }
1712 else
1713 {
1714 @:<form class="@settings.CssClass u-no-margin dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1715 }
1716
1717 foreach (var field in settings.GetFields())
1718 {
1719 @Render(field)
1720 }
1721
1722 @:</form>
1723 }
1724 }
1725 @using System.Reflection
1726 @using Dynamicweb.Rapido.Blocks.Components.General
1727 @using Dynamicweb.Rapido.Blocks.Components
1728
1729
1730 @* Component *@
1731
1732 @helper RenderText(Text settings)
1733 {
1734 @settings.Content
1735 }
1736 @using System.Reflection
1737 @using Dynamicweb.Rapido.Blocks.Components.General
1738 @using Dynamicweb.Rapido.Blocks.Components
1739
1740
1741 @* Component *@
1742
1743 @helper RenderContentModule(ContentModule settings) {
1744 if (!string.IsNullOrEmpty(settings.Content))
1745 {
1746 @settings.Content
1747 }
1748 }
1749 @using System.Reflection
1750 @using Dynamicweb.Rapido.Blocks.Components.General
1751 @using Dynamicweb.Rapido.Blocks.Components
1752
1753
1754 @* Component *@
1755
1756 @helper RenderModal(Modal settings) {
1757 if (settings != null)
1758 {
1759 string modalId = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N");
1760
1761 string onchange = !string.IsNullOrEmpty(settings.OnClose) ? "onchange=\"if(!this.checked){" + settings.OnClose + "}\"" : "";
1762
1763 <input type="checkbox" id="@(modalId)ModalTrigger" class="modal-trigger" @onchange />
1764
1765 <div class="modal-container">
1766 @if (!settings.DisableDarkOverlay)
1767 {
1768 <label for="@(modalId)ModalTrigger" id="@(modalId)ModalOverlay" class="modal-overlay"></label>
1769 }
1770 <div class="modal modal--@settings.Width.ToString().ToLower() modal-height--@settings.Height.ToString().ToLower()" id="@(modalId)Modal">
1771 @if (settings.Heading != null)
1772 {
1773 if (!string.IsNullOrEmpty(settings.Heading.Title))
1774 {
1775 <div class="modal__header">
1776 @Render(settings.Heading)
1777 </div>
1778 }
1779 }
1780 <div class="modal__body @(settings.Width.ToString().ToLower() == "full" ? "modal__body--full" : "")">
1781 @if (!string.IsNullOrEmpty(settings.BodyText))
1782 {
1783 @settings.BodyText
1784 }
1785 @if (settings.BodyTemplate != null)
1786 {
1787 @settings.BodyTemplate
1788 }
1789 @{
1790 var actions = settings.GetActions();
1791 }
1792 </div>
1793 @if (actions.Length > 0)
1794 {
1795 <div class="modal__footer">
1796 @foreach (var action in actions)
1797 {
1798 if (Pageview.Device.ToString() != "Mobile") {
1799 action.CssClass += " u-no-margin";
1800 } else {
1801 action.CssClass += " u-full-width u-margin-bottom";
1802 }
1803
1804 @Render(action)
1805 }
1806 </div>
1807 }
1808 <label class="modal__close-btn" for="@(modalId)ModalTrigger"></label>
1809 </div>
1810 </div>
1811 }
1812 }
1813 @using Dynamicweb.Rapido.Blocks.Components.General
1814
1815 @* Component *@
1816
1817 @helper RenderMediaListItem(MediaListItem settings)
1818 {
1819 <div class="media-list-item @settings.CssClass dw-mod" @(!string.IsNullOrEmpty(settings.Id) ? "id=\"" + settings.Id + "\"" : "")>
1820 @if (!string.IsNullOrEmpty(settings.Label))
1821 {
1822 if (!string.IsNullOrEmpty(settings.Link))
1823 {
1824 @Render(new Link
1825 {
1826 Href = settings.Link,
1827 CssClass = "media-list-item__sticker dw-mod",
1828 ButtonLayout = ButtonLayout.None,
1829 Title = settings.Label,
1830 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : ""
1831 })
1832 }
1833 else if (!string.IsNullOrEmpty(settings.OnClick))
1834 {
1835 <span class="media-list-item__sticker dw-mod" onclick="@(settings.OnClick)">
1836 <span class="u-uppercase">@settings.Label</span>
1837 </span>
1838 }
1839 else
1840 {
1841 <span class="media-list-item__sticker media-list-item__sticker--no-link dw-mod">
1842 <span class="u-uppercase">@settings.Label</span>
1843 </span>
1844 }
1845 }
1846 <div class="media-list-item__wrap">
1847 <div class="media-list-item__info dw-mod">
1848 <div class="media-list-item__header dw-mod">
1849 @if (!string.IsNullOrEmpty(settings.Title))
1850 {
1851 if (!string.IsNullOrEmpty(settings.Link))
1852 {
1853 @Render(new Link
1854 {
1855 Href = settings.Link,
1856 CssClass = "media-list-item__name dw-mod",
1857 ButtonLayout = ButtonLayout.None,
1858 Title = settings.Title,
1859 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : ""
1860 })
1861 }
1862 else if (!string.IsNullOrEmpty(settings.OnClick))
1863 {
1864 <span class="media-list-item__name dw-mod" onclick="@(settings.OnClick)">@settings.Title</span>
1865 }
1866 else
1867 {
1868 <span class="media-list-item__name media-list-item__name--no-link dw-mod">@settings.Title</span>
1869 }
1870 }
1871
1872 @if (!string.IsNullOrEmpty(settings.Status))
1873 {
1874 <div class="media-list-item__state dw-mod">@settings.Status</div>
1875 }
1876 </div>
1877 @{
1878 settings.InfoTable.CssClass += " media-list-item__parameters-table";
1879 }
1880
1881 @Render(settings.InfoTable)
1882 </div>
1883 <div class="media-list-item__actions dw-mod">
1884 <div class="media-list-item__actions-list dw-mod">
1885 @{
1886 var actions = settings.GetActions();
1887
1888 foreach (ButtonBase action in actions)
1889 {
1890 action.ButtonLayout = ButtonLayout.None;
1891 action.CssClass += " media-list-item__action link";
1892
1893 @Render(action)
1894 }
1895 }
1896 </div>
1897
1898 @if (settings.SelectButton != null && !string.IsNullOrEmpty(settings.SelectButton.Title))
1899 {
1900 settings.SelectButton.CssClass += " u-no-margin";
1901
1902 <div class="media-list-item__action-button">
1903 @Render(settings.SelectButton)
1904 </div>
1905 }
1906 </div>
1907 </div>
1908 </div>
1909 }
1910 @using Dynamicweb.Rapido.Blocks.Components.General
1911 @using Dynamicweb.Rapido.Blocks.Components
1912
1913 @helper RenderTable(Table settings)
1914 {
1915 Dictionary<string, string> attributes = new Dictionary<string, string>();
1916 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1917
1918 var enumToClasses = new Dictionary<TableDesign, string>
1919 {
1920 { TableDesign.Clean, "table--clean" },
1921 { TableDesign.Bordered, "table--bordered" },
1922 { TableDesign.Striped, "table--striped" },
1923 { TableDesign.Hover, "table--hover" },
1924 { TableDesign.Compact, "table--compact" },
1925 { TableDesign.Condensed, "table--condensed" },
1926 { TableDesign.NoTopBorder, "table--no-top-border" }
1927 };
1928 string tableDesignClass = "";
1929 if (settings.Design != TableDesign.None)
1930 {
1931 tableDesignClass = enumToClasses[settings.Design];
1932 }
1933
1934 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableDesign.None) { attributes.Add("class", "table " + tableDesignClass + " " + settings.CssClass + " dw-mod"); }
1935
1936 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);
1937
1938 <table @ComponentMethods.AddAttributes(resultAttributes)>
1939 @if (settings.Header != null)
1940 {
1941 <thead>
1942 @Render(settings.Header)
1943 </thead>
1944 }
1945 <tbody>
1946 @foreach (var row in settings.Rows)
1947 {
1948 @Render(row)
1949 }
1950 </tbody>
1951 @if (settings.Footer != null)
1952 {
1953 <tfoot>
1954 @Render(settings.Footer)
1955 </tfoot>
1956 }
1957 </table>
1958 }
1959 @using Dynamicweb.Rapido.Blocks.Components.General
1960 @using Dynamicweb.Rapido.Blocks.Components
1961
1962 @helper RenderTableRow(TableRow settings)
1963 {
1964 Dictionary<string, string> attributes = new Dictionary<string, string>();
1965 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1966
1967 var enumToClasses = new Dictionary<TableRowDesign, string>
1968 {
1969 { TableRowDesign.NoBorder, "table__row--no-border" },
1970 { TableRowDesign.Border, "table__row--border" },
1971 { TableRowDesign.TopBorder, "table__row--top-line" },
1972 { TableRowDesign.BottomBorder, "table__row--bottom-line" },
1973 { TableRowDesign.Solid, "table__row--solid" }
1974 };
1975
1976 string tableRowDesignClass = "";
1977 if (settings.Design != TableRowDesign.None)
1978 {
1979 tableRowDesignClass = enumToClasses[settings.Design];
1980 }
1981
1982 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableRowDesign.None) { attributes.Add("class", "table__row " + tableRowDesignClass + " " + settings.CssClass + " dw-mod"); }
1983
1984 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);
1985
1986 <tr @ComponentMethods.AddAttributes(resultAttributes)>
1987 @foreach (var cell in settings.Cells)
1988 {
1989 if (settings.IsHeaderRow)
1990 {
1991 cell.IsHeader = true;
1992 }
1993 @Render(cell)
1994 }
1995 </tr>
1996 }
1997 @using Dynamicweb.Rapido.Blocks.Components.General
1998 @using Dynamicweb.Rapido.Blocks.Components
1999 @using Dynamicweb.Core
2000
2001 @helper RenderTableCell(TableCell settings)
2002 {
2003 Dictionary<string, string> attributes = new Dictionary<string, string>();
2004 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
2005 if (settings.Colspan != 0) { attributes.Add("colspan", Converter.ToString(settings.Colspan)); }
2006 if (settings.Rowspan != 0) { attributes.Add("rowspan", Converter.ToString(settings.Rowspan)); }
2007 if (!string.IsNullOrEmpty(settings.CssClass)) { attributes.Add("class", settings.CssClass + " dw-mod"); }
2008
2009 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);
2010
2011 string tagName = settings.IsHeader ? "th" : "td";
2012
2013 @("<" + tagName + " " + ComponentMethods.AddAttributes(resultAttributes) + ">")
2014 @settings.Content
2015 @("</" + tagName + ">");
2016 }
2017 @using System.Linq
2018 @using Dynamicweb.Rapido.Blocks.Components.General
2019
2020 @* Component *@
2021
2022 @helper RenderPagination(Dynamicweb.Rapido.Blocks.Components.General.Pagination settings)
2023 {
2024 var pageNumberQueryStringName = Dynamicweb.Rapido.Services.Pagination.GetPageNumberQueryStringName(settings); // Get the proper 'page number' query string parameter
2025 var queryParameters = Dynamicweb.Rapido.Services.Url.GetQueryParameters(pageNumberQueryStringName); // Get the NameValueCollection from the querystring
2026
2027 if (settings.NumberOfPages > 1)
2028 {
2029 string url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/Default.aspx";
2030 string ariaLabel = !string.IsNullOrWhiteSpace(settings.AriaLabel) ? settings.AriaLabel : Translate("Page navigation");
2031 Dictionary<string, int> startAndEndPageNumber = Dynamicweb.Rapido.Services.Pagination.GetStartAndEndPageNumber(settings);
2032
2033 <div class="pager u-margin-top dw-mod @settings.CssClass" aria-label="@ariaLabel">
2034 @if (settings.ShowPagingInfo)
2035 {
2036 <div class="pager__info dw-mod">
2037 @Translate("Page") @settings.CurrentPageNumber @Translate("of") @settings.NumberOfPages
2038 </div>
2039 }
2040 <ul class="pager__list dw-mod">
2041 @if (!string.IsNullOrWhiteSpace(settings.FirstPageUrl) && settings.ShowFirstAndLastControls)
2042 {
2043 @Render(new PaginationItem { Link = settings.FirstPageUrl, Icon = settings.FirstIcon })
2044 }
2045 @if (!string.IsNullOrWhiteSpace(settings.PreviousPageUrl) && settings.ShowNextAndPrevControls)
2046 {
2047 @Render(new PaginationItem { Link = settings.PreviousPageUrl, Icon = settings.PrevIcon })
2048 }
2049 @if (settings.GetPages().Any())
2050 {
2051 foreach (var page in settings.GetPages())
2052 {
2053 @Render(page)
2054 }
2055 }
2056 else
2057 {
2058 for (var page = startAndEndPageNumber["StartPage"]; page <= startAndEndPageNumber["EndPage"]; page++)
2059 {
2060 queryParameters = Dynamicweb.Rapido.Services.Url.UpdateQueryStringParameter(queryParameters, pageNumberQueryStringName, page.ToString());
2061 @Render(new PaginationItem { Label = page.ToString(), Link = Dynamicweb.Rapido.Services.Url.BuildUri(url, queryParameters).PathAndQuery, IsActive = (settings.CurrentPageNumber == page) });
2062 }
2063 }
2064 @if (!string.IsNullOrWhiteSpace(settings.NextPageUrl) && settings.ShowNextAndPrevControls)
2065 {
2066 @Render(new PaginationItem { Link = settings.NextPageUrl, Icon = settings.NextIcon })
2067 }
2068 @if (!string.IsNullOrWhiteSpace(settings.LastPageUrl) && settings.ShowFirstAndLastControls)
2069 {
2070 @Render(new PaginationItem { Link = settings.LastPageUrl, Icon = settings.LastIcon })
2071 }
2072 </ul>
2073 </div>
2074 }
2075 }
2076
2077 @helper RenderPaginationItem(PaginationItem settings)
2078 {
2079 if (settings.Icon == null)
2080 {
2081 settings.Icon = new Icon();
2082 }
2083
2084 settings.Icon.Label = settings.Label;
2085 <li class="pager__btn dw-mod">
2086 @if (settings.IsActive)
2087 {
2088 <span class="pager__num pager__num--current dw-mod">
2089 @Render(settings.Icon)
2090 </span>
2091 }
2092 else
2093 {
2094 <a href="@settings.Link" class="pager__num dw-mod">
2095 @Render(settings.Icon)
2096 </a>
2097 }
2098 </li>
2099 }
2100
2101
2102 @using Dynamicweb.Rapido.Blocks.Components.General
2103 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
2104
2105
2106
2107
2108
2109 @{
2110 var navigationSettings = new NavigationSettings();
2111 navigationSettings.StartLevel = 1;
2112 navigationSettings.StopLevel = 10;
2113 navigationSettings.ExpandMode = ExpandMode.PathOnly;
2114
2115 if (!string.IsNullOrEmpty(Model.Item.GetString("NavigationRoot")))
2116 {
2117 int rootPageId = Convert.ToInt32(Model.Item.GetString("NavigationRoot").Substring(Model.Item.GetString("NavigationRoot").LastIndexOf('=') + 1));
2118 navigationSettings.RootPageId = rootPageId;
2119 }
2120 }
2121
2122 <div class="u-full-width">
2123 @BreadcrumbHelper.GetBreadcrumb(Pageview.ID, HttpContext.Current.Request["groupid"], HttpContext.Current.Request["productid"])
2124 </div>
Vedr. fragt på varer bestilt i vores erhvervskunde-shop