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