Error compiling template "Designs/ClientBase_generated/Paragraph/DefaultParagraph.cshtml"
Line 518: 'CTAButton' does not contain a definition for 'Configuration' and no accessible extension method 'Configuration' accepting a first argument of type 'CTAButton' could be found (are you missing a using directive or an assembly reference?)
Line 518: 'CTAButton' does not contain a definition for 'Configuration' and no accessible extension method 'Configuration' accepting a first argument of type 'CTAButton' could be found (are you missing a using directive or an assembly reference?)
Line 529: 'CTAButton' does not contain a definition for 'Configuration' and no accessible extension method 'Configuration' accepting a first argument of type 'CTAButton' could be found (are you missing a using directive or an assembly reference?)
Line 529: 'CTAButton' does not contain a definition for 'Configuration' and no accessible extension method 'Configuration' accepting a first argument of type 'CTAButton' could be found (are you missing a using directive or an assembly reference?)
1 //------------------------------------------------------------------------------
2 // <auto-generated>
3 // This code was generated by a tool.
4 // Runtime Version:4.0.30319.42000
5 //
6 // Changes to this file may cause incorrect behavior and will be lost if
7 // the code is regenerated.
8 // </auto-generated>
9 //------------------------------------------------------------------------------
10
11 namespace CompiledRazorTemplates.Dynamic {
12 using System;
13 using System.Collections.Generic;
14 using System.Linq;
15
16 #line 28 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
17 using Dynamicweb;
18
19 #line default
20 #line hidden
21
22 #line 29 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
23 using Dynamicweb.Content.Items;
24
25 #line default
26 #line hidden
27
28 #line 30 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
29 using Bluedesk.DynamicWeb.ItemTypes;
30
31 #line default
32 #line hidden
33
34 #line 10 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
35 using Bluedesk.DynamicWeb.ItemTypes.Extensions;
36
37 #line default
38 #line hidden
39
40 #line 11 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
41 using Bluedesk.DynamicWeb.ItemTypes.Configuration;
42
43 #line default
44 #line hidden
45
46 #line 12 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
47 using Bluedesk.DynamicWeb.ItemTypes.Settings.Configuration;
48
49 #line default
50 #line hidden
51
52 #line 14 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
53 using Dynamicweb.Frontend;
54
55 #line default
56 #line hidden
57
58 #line 15 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
59 using Bluedesk.DynamicWeb.ItemTypes.BaseSolution;
60
61 #line default
62 #line hidden
63
64
65 public class RazorEngine_085b066fe53248568705687d268e1c41 : Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> {
66
67 #line hidden
68
69 #line 17 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
70 public RazorEngine.Templating.TemplateWriter RenderButton(CTAButton button, PageView Pageview)
71 {
72 #line default
73 #line hidden
74 return new RazorEngine.Templating.TemplateWriter(__razor_helper_writer => {
75
76 #line 18 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
77
78
79 if (!string.IsNullOrWhiteSpace(button.GetLink(Pageview)))
80 {
81 string Template = button.GetButtonTemplate().Replace("{{ ButtonLink }}", button.GetLink(Pageview));
82
83
84 #line default
85 #line hidden
86
87 #line 23 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
88 WriteTo(__razor_helper_writer, Template);
89
90
91 #line default
92 #line hidden
93
94 #line 23 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
95 ;
96 }
97
98
99 #line default
100 #line hidden
101 });
102
103 #line 25 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
104 }
105 #line default
106 #line hidden
107
108
109 #line 32 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
110
111
112 Dictionary<string, string> GetFontConfiguration(string TextColor, FontConfigurationItemTab FontConfiguration)
113 {
114 var colorService = new ColorSwatchService();
115 TextColor = !string.IsNullOrWhiteSpace(TextColor) ? TextColor : "" ;
116 TextColor = !TextColor.Contains("#") ? colorService.GetHexColor(Pageview.AreaID, TextColor) : TextColor;
117 Dictionary<string, string> FontConfig = new Dictionary<string, string>() {
118 { "textColor" , TextColor },
119 { "fontSize" , FontConfiguration.FontSize },
120 { "lineHeight", FontConfiguration.LineHeight},
121 { "fontFamily" , FontConfiguration.FontConfiguration.FontFamily },
122 { "fontWeight" , FontConfiguration.FontWeight },
123 { "fontStyle" , FontConfiguration.FontStyle }
124 };
125 return FontConfig;
126 }
127
128 public string GenerateButtonConfigVariables(ButtonConfiguration BC, MasterConfig mc, int areaId)
129 {
130 string ButtonLabelAlignment = BC.ButtonLabelAlignment;
131 switch (ButtonLabelAlignment)
132 {
133 case "align-left":
134 ButtonLabelAlignment = "flex-start";
135 break;
136 case "align-center":
137 ButtonLabelAlignment = "center";
138 break;
139 case "align-right":
140 ButtonLabelAlignment = "flex-end";
141 break;
142 case "align-full":
143 ButtonLabelAlignment = "space-between";
144 break;
145 default:
146 ButtonLabelAlignment = "flex-start";
147 break;
148 }
149
150 var btnStyleBlock = new System.Text.StringBuilder();
151
152 // General Config
153 btnStyleBlock.Append(GenerateCssVar("btn-min-height", $"{mc.GeneralConfiguration.ButtonHeight}px"));
154 btnStyleBlock.Append(GenerateCssVar("btn-border-radius", $"{mc.GeneralConfiguration.RoundedCornerValue}px"));
155
156 // Button Config
157 btnStyleBlock.Append(GenerateCssVar("btn-border-width", $"{BC.BorderSize.ToString()}px"));
158 btnStyleBlock.Append(GenerateCssVar("btn-label-alignment", ButtonLabelAlignment));
159
160 // Button Config Tab
161 btnStyleBlock.Append(GenerateCssVar("btn-bg-color", BC.ButtonColorConfiguration.BackgroundColor.GetColorCode(areaId)));
162 btnStyleBlock.Append(GenerateCssVar("btn-font-color", BC.ButtonColorConfiguration.FontColor.GetColorCode(areaId)));
163 btnStyleBlock.Append(GenerateCssVar("btn-border-color", BC.ButtonColorConfiguration.BorderColor.GetColorCode(areaId)));
164
165 // Button Config Hover tab
166 btnStyleBlock.Append(GenerateCssVar("btn-bg-color-hover", BC.ButtonHoverColorConfiguration.BackgroundColor.GetColorCode(areaId)));
167 btnStyleBlock.Append(GenerateCssVar("btn-font-color-hover", BC.ButtonHoverColorConfiguration.FontColor.GetColorCode(areaId)));
168 btnStyleBlock.Append(GenerateCssVar("btn-border-color-hover", BC.ButtonHoverColorConfiguration.BorderColor.GetColorCode(areaId)));
169
170 // Button Config Font Config
171 btnStyleBlock.Append(GenerateCssVar("btn-font-size", BC.FontConfiguration.FontSize));
172 btnStyleBlock.Append(GenerateCssVar("btn-font-config-color", BC.FontConfiguration.Color.GetColorCode(areaId)));
173 btnStyleBlock.Append(GenerateCssVar("btn-font-line-height", BC.FontConfiguration.LineHeight));
174 btnStyleBlock.Append(GenerateCssVar("btn-font-family", BC.FontConfiguration.FontConfiguration.FontFamily));
175 btnStyleBlock.Append(GenerateCssVar("btn-font-weight", BC.FontConfiguration.FontWeight));
176 btnStyleBlock.Append(GenerateCssVar("btn-font-transform", BC.FontConfiguration.FontStyle));
177
178 return btnStyleBlock.ToString();
179 }
180
181 public string GenerateCssVar(string name, string value)
182 {
183 if (!string.IsNullOrWhiteSpace(value)) {
184 return $"--{name}: {value};";
185 } else {
186 return "";
187 }
188 }
189
190 #line default
191 #line hidden
192
193
194 public RazorEngine_085b066fe53248568705687d268e1c41() {
195 }
196
197 public override void Execute() {
198 WriteLiteral("\r\n");
199
200 WriteLiteral("\r\n");
201
202 WriteLiteral("\r\n");
203
204 WriteLiteral("\r\n");
205
206 WriteLiteral("\r\n\r\n");
207
208
209 #line 114 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
210
211 DefaultParagraph _data = ItemManager.Storage.GetById<DefaultParagraph>(Pageview.CurrentParagraph.ItemId ?? "0");
212 var paragraphID = Pageview.CurrentParagraph.ID;
213 var backgroundClass = !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundClass) ? string.Format("bg-{0}", _data.BackgroundConfiguration.BackgroundClass) : "";
214
215
216 #line default
217 #line hidden
218 WriteLiteral("\r\n\r\n");
219
220
221 #line 120 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
222 if (_data != null)
223 {
224
225
226 #line default
227 #line hidden
228 WriteLiteral("\t<section");
229
230 WriteAttribute("class", Tuple.Create(" class=\"", 5129), Tuple.Create("\"", 5156)
231 , Tuple.Create(Tuple.Create("", 5137), Tuple.Create("dp", 5137), true)
232
233 #line 122 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
234 , Tuple.Create(Tuple.Create(" ", 5139), Tuple.Create<System.Object, System.Int32>(backgroundClass
235
236 #line default
237 #line hidden
238 , 5140), false)
239 );
240
241 WriteLiteral(" data-paragraphid=\"");
242
243
244 #line 122 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
245 Write(paragraphID);
246
247
248 #line default
249 #line hidden
250 WriteLiteral("\"");
251
252 WriteAttribute("id", Tuple.Create(" id=\"", 5189), Tuple.Create("\"", 5206)
253
254 #line 122 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
255 , Tuple.Create(Tuple.Create("", 5194), Tuple.Create<System.Object, System.Int32>(paragraphID
256
257 #line default
258 #line hidden
259 , 5194), false)
260 );
261
262 WriteLiteral(">\r\n\t\t<div");
263
264 WriteLiteral(" class=\"dp__container container\"");
265
266 WriteLiteral(">\r\n\t\t\t<section");
267
268 WriteLiteral(" class=\"dp__content\"");
269
270 WriteLiteral(">\r\n\r\n");
271
272
273 #line 126 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
274
275
276 #line default
277 #line hidden
278
279 #line 126 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
280 if (_data.Image.Image != null && !string.IsNullOrWhiteSpace(_data.Image.Image))
281 {
282 string ImageUrl = "/Admin/Public/GetImage.ashx?Image=" + @_data.Image.Image + "&Crop=7&Format=webp&Quality=90";
283
284
285 #line default
286 #line hidden
287 WriteLiteral("<figure");
288
289 WriteLiteral(" class=\"dp__image-wrapper\"");
290
291 WriteLiteral(">\t\t\t\t\t\r\n\t\t\t\t\t\t<picture>\r\n\t\t\t\t\t\t\t<source");
292
293 WriteLiteral(" media=\"(max-width: 400px)\"");
294
295 WriteAttribute("srcset", Tuple.Create(" srcset=\"", 5602), Tuple.Create("\"", 5630)
296
297 #line 131 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
298 , Tuple.Create(Tuple.Create("", 5611), Tuple.Create<System.Object, System.Int32>(ImageUrl
299
300 #line default
301 #line hidden
302 , 5611), false)
303 , Tuple.Create(Tuple.Create("", 5620), Tuple.Create("&Width=400", 5620), true)
304 );
305
306 WriteLiteral(">\r\n\t\t\t\t\t\t\t<source");
307
308 WriteLiteral(" media=\"(max-width: 994px)\"");
309
310 WriteAttribute("srcset", Tuple.Create(" srcset=\"", 5675), Tuple.Create("\"", 5703)
311
312 #line 132 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
313 , Tuple.Create(Tuple.Create("", 5684), Tuple.Create<System.Object, System.Int32>(ImageUrl
314
315 #line default
316 #line hidden
317 , 5684), false)
318 , Tuple.Create(Tuple.Create("", 5693), Tuple.Create("&Width=994", 5693), true)
319 );
320
321 WriteLiteral(">\r\n\t\t\t\t\t\t\t<img");
322
323 WriteLiteral(" class=\"dp__image\"");
324
325 WriteAttribute("src", Tuple.Create(" src=\"", 5736), Tuple.Create("\"", 5762)
326
327 #line 133 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
328 , Tuple.Create(Tuple.Create("", 5742), Tuple.Create<System.Object, System.Int32>(ImageUrl
329
330 #line default
331 #line hidden
332 , 5742), false)
333 , Tuple.Create(Tuple.Create("", 5751), Tuple.Create("&width=1980", 5751), true)
334 );
335
336 WriteLiteral(" loading=\"lazy\"");
337
338 WriteAttribute("alt", Tuple.Create(" alt=\"", 5778), Tuple.Create("\"", 5805)
339
340 #line 133 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
341 , Tuple.Create(Tuple.Create("", 5784), Tuple.Create<System.Object, System.Int32>(_data.Image.ImageAlt
342
343 #line default
344 #line hidden
345 , 5784), false)
346 );
347
348 WriteLiteral(" width=\"1980\"");
349
350 WriteLiteral(" height=\"500\"");
351
352 WriteLiteral("/>\r\n\t\t\t\t\t\t</picture>\r\n\t\t\t\t\t</figure>\r\n");
353
354
355 #line 136 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
356 }
357
358
359 #line default
360 #line hidden
361 WriteLiteral("\r\n\t\t\t\t<section");
362
363 WriteLiteral(" class=\"dp__inner-content\"");
364
365 WriteLiteral(">\r\n");
366
367
368 #line 139 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
369
370
371 #line default
372 #line hidden
373
374 #line 139 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
375 if (!string.IsNullOrWhiteSpace(_data.Header.HeaderFormatted()))
376 {
377
378
379 #line default
380 #line hidden
381 WriteLiteral("\t\t\t\t\t\t<header");
382
383 WriteLiteral(" class=\"dp__header\"");
384
385 WriteLiteral(">\r\n");
386
387 WriteLiteral("\t\t\t\t\t\t\t");
388
389
390 #line 142 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
391 Write(_data.SubHeader.HeaderFormatted("dp__subheader"));
392
393
394 #line default
395 #line hidden
396 WriteLiteral("\r\n");
397
398 WriteLiteral("\t\t\t\t\t\t\t");
399
400
401 #line 143 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
402 Write(_data.Header.HeaderFormatted("dp__header"));
403
404
405 #line default
406 #line hidden
407 WriteLiteral("\r\n\t\t\t\t\t\t</header>\r\n");
408
409
410 #line 145 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
411 }
412
413
414 #line default
415 #line hidden
416 WriteLiteral("\r\n");
417
418
419 #line 147 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
420
421
422 #line default
423 #line hidden
424
425 #line 147 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
426 if (!string.IsNullOrWhiteSpace(_data.Content.Text))
427 {
428
429
430 #line default
431 #line hidden
432 WriteLiteral("\t\t\t\t\t\t<div");
433
434 WriteLiteral(" class=\"dp__text\"");
435
436 WriteLiteral(">");
437
438
439 #line 149 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
440 Write(_data.Content.Text);
441
442
443 #line default
444 #line hidden
445 WriteLiteral("</div>\r\n");
446
447
448 #line 150 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
449 }
450
451
452 #line default
453 #line hidden
454 WriteLiteral("\r\n");
455
456
457 #line 152 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
458
459
460 #line default
461 #line hidden
462
463 #line 152 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
464 if (!string.IsNullOrWhiteSpace(GetString("ParagraphModule")))
465 {
466
467
468 #line default
469 #line hidden
470 WriteLiteral("\t\t\t\t\t\t<div");
471
472 WriteLiteral(" class=\"dp__module\"");
473
474 WriteLiteral(">");
475
476
477 #line 154 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
478 Write(GetString("ParagraphModule"));
479
480
481 #line default
482 #line hidden
483 WriteLiteral("</div>\r\n");
484
485
486 #line 155 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
487 }
488
489
490 #line default
491 #line hidden
492 WriteLiteral("\r\n");
493
494
495 #line 157 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
496
497
498 #line default
499 #line hidden
500
501 #line 157 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
502 if(!string.IsNullOrWhiteSpace(_data.Button.ButtonText) || !string.IsNullOrWhiteSpace(_data.ExtraButton.ButtonText))
503 {
504
505
506 #line default
507 #line hidden
508 WriteLiteral("\t\t\t\t\t\t<nav");
509
510 WriteLiteral(" class=\"dp__cta-container\"");
511
512 WriteLiteral(">\r\n");
513
514 WriteLiteral("\t\t\t\t\t\t\t");
515
516
517 #line 160 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
518 Write(RenderButton(_data.Button.Configuration, _data.Button.ButtonLink, _data.Button.Configuration.ButtonClass, _data.Button.ButtonText, _data.Button.ButtonAriaLabel, _data.Button.NewWindow));
519
520
521 #line default
522 #line hidden
523 WriteLiteral("\r\n\r\n");
524
525 WriteLiteral("\t\t\t\t\t\t\t");
526
527
528 #line 162 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
529 Write(RenderButton(_data.ExtraButton.Configuration, _data.ExtraButton.ButtonLink, _data.ExtraButton.Configuration.ButtonClass, _data.ExtraButton.ButtonText, _data.ExtraButton.ButtonAriaLabel, _data.ExtraButton.NewWindow));
530
531
532 #line default
533 #line hidden
534 WriteLiteral("\r\n\t\t\t\t\t\t</nav>\r\n");
535
536
537 #line 164 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
538 }
539
540
541 #line default
542 #line hidden
543 WriteLiteral("\t\t\t\t</section>\r\n\t\t\t</section>\r\n\t\t</div>\r\n\t</section>\r\n");
544
545
546 #line 169 "D:\dynamicweb.net\Solutions\IPG\Production\files\Templates\Designs\ClientBase_generated\Paragraph\DefaultParagraph.cshtml"
547 }
548
549
550 #line default
551 #line hidden
552 }
553 }
554 }
555
1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
2 @using Dynamicweb;
3 @using Dynamicweb.Content.Items;
4 @using Bluedesk.DynamicWeb.ItemTypes;
5
6 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
7 @using Dynamicweb;
8 @using Dynamicweb.Content.Items;
9 @using Bluedesk.DynamicWeb.ItemTypes;
10 @using Bluedesk.DynamicWeb.ItemTypes.Extensions;
11 @using Bluedesk.DynamicWeb.ItemTypes.Configuration;
12 @using Bluedesk.DynamicWeb.ItemTypes.Settings.Configuration;
13 @using Dynamicweb;
14 @using Dynamicweb.Frontend
15 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution;
16
17 @helper RenderButton(CTAButton button, PageView Pageview)
18 {
19
20 if (!string.IsNullOrWhiteSpace(button.GetLink(Pageview)))
21 {
22 string Template = button.GetButtonTemplate().Replace("{{ ButtonLink }}", button.GetLink(Pageview));
23 @Template;
24 }
25 }
26
27 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
28 @using Dynamicweb;
29 @using Dynamicweb.Content.Items;
30 @using Bluedesk.DynamicWeb.ItemTypes;
31
32 @functions {
33
34 Dictionary<string, string> GetFontConfiguration(string TextColor, FontConfigurationItemTab FontConfiguration)
35 {
36 var colorService = new ColorSwatchService();
37 TextColor = !string.IsNullOrWhiteSpace(TextColor) ? TextColor : "" ;
38 TextColor = !TextColor.Contains("#") ? colorService.GetHexColor(Pageview.AreaID, TextColor) : TextColor;
39 Dictionary<string, string> FontConfig = new Dictionary<string, string>() {
40 { "textColor" , TextColor },
41 { "fontSize" , FontConfiguration.FontSize },
42 { "lineHeight", FontConfiguration.LineHeight},
43 { "fontFamily" , FontConfiguration.FontConfiguration.FontFamily },
44 { "fontWeight" , FontConfiguration.FontWeight },
45 { "fontStyle" , FontConfiguration.FontStyle }
46 };
47 return FontConfig;
48 }
49
50 public string GenerateButtonConfigVariables(ButtonConfiguration BC, MasterConfig mc, int areaId)
51 {
52 string ButtonLabelAlignment = BC.ButtonLabelAlignment;
53 switch (ButtonLabelAlignment)
54 {
55 case "align-left":
56 ButtonLabelAlignment = "flex-start";
57 break;
58 case "align-center":
59 ButtonLabelAlignment = "center";
60 break;
61 case "align-right":
62 ButtonLabelAlignment = "flex-end";
63 break;
64 case "align-full":
65 ButtonLabelAlignment = "space-between";
66 break;
67 default:
68 ButtonLabelAlignment = "flex-start";
69 break;
70 }
71
72 var btnStyleBlock = new System.Text.StringBuilder();
73
74 // General Config
75 btnStyleBlock.Append(GenerateCssVar("btn-min-height", $"{mc.GeneralConfiguration.ButtonHeight}px"));
76 btnStyleBlock.Append(GenerateCssVar("btn-border-radius", $"{mc.GeneralConfiguration.RoundedCornerValue}px"));
77
78 // Button Config
79 btnStyleBlock.Append(GenerateCssVar("btn-border-width", $"{BC.BorderSize.ToString()}px"));
80 btnStyleBlock.Append(GenerateCssVar("btn-label-alignment", ButtonLabelAlignment));
81
82 // Button Config Tab
83 btnStyleBlock.Append(GenerateCssVar("btn-bg-color", BC.ButtonColorConfiguration.BackgroundColor.GetColorCode(areaId)));
84 btnStyleBlock.Append(GenerateCssVar("btn-font-color", BC.ButtonColorConfiguration.FontColor.GetColorCode(areaId)));
85 btnStyleBlock.Append(GenerateCssVar("btn-border-color", BC.ButtonColorConfiguration.BorderColor.GetColorCode(areaId)));
86
87 // Button Config Hover tab
88 btnStyleBlock.Append(GenerateCssVar("btn-bg-color-hover", BC.ButtonHoverColorConfiguration.BackgroundColor.GetColorCode(areaId)));
89 btnStyleBlock.Append(GenerateCssVar("btn-font-color-hover", BC.ButtonHoverColorConfiguration.FontColor.GetColorCode(areaId)));
90 btnStyleBlock.Append(GenerateCssVar("btn-border-color-hover", BC.ButtonHoverColorConfiguration.BorderColor.GetColorCode(areaId)));
91
92 // Button Config Font Config
93 btnStyleBlock.Append(GenerateCssVar("btn-font-size", BC.FontConfiguration.FontSize));
94 btnStyleBlock.Append(GenerateCssVar("btn-font-config-color", BC.FontConfiguration.Color.GetColorCode(areaId)));
95 btnStyleBlock.Append(GenerateCssVar("btn-font-line-height", BC.FontConfiguration.LineHeight));
96 btnStyleBlock.Append(GenerateCssVar("btn-font-family", BC.FontConfiguration.FontConfiguration.FontFamily));
97 btnStyleBlock.Append(GenerateCssVar("btn-font-weight", BC.FontConfiguration.FontWeight));
98 btnStyleBlock.Append(GenerateCssVar("btn-font-transform", BC.FontConfiguration.FontStyle));
99
100 return btnStyleBlock.ToString();
101 }
102
103 public string GenerateCssVar(string name, string value)
104 {
105 if (!string.IsNullOrWhiteSpace(value)) {
106 return $"--{name}: {value};";
107 } else {
108 return "";
109 }
110 }
111 }
112
113
114 @{
115 DefaultParagraph _data = ItemManager.Storage.GetById<DefaultParagraph>(Pageview.CurrentParagraph.ItemId ?? "0");
116 var paragraphID = Pageview.CurrentParagraph.ID;
117 var backgroundClass = !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundClass) ? string.Format("bg-{0}", _data.BackgroundConfiguration.BackgroundClass) : "";
118 }
119
120 @if (_data != null)
121 {
122 <section class="dp @backgroundClass" data-paragraphid="@paragraphID" id="@paragraphID">
123 <div class="dp__container container">
124 <section class="dp__content">
125
126 @if (_data.Image.Image != null && !string.IsNullOrWhiteSpace(_data.Image.Image))
127 {
128 string ImageUrl = "/Admin/Public/GetImage.ashx?Image=" + @_data.Image.Image + "&Crop=7&Format=webp&Quality=90";
129 <figure class="dp__image-wrapper">
130 <picture>
131 <source media="(max-width: 400px)" srcset="@ImageUrl&Width=400">
132 <source media="(max-width: 994px)" srcset="@ImageUrl&Width=994">
133 <img class="dp__image" src="@ImageUrl&width=1980" loading="lazy" alt="@_data.Image.ImageAlt" width="1980" height="500"/>
134 </picture>
135 </figure>
136 }
137
138 <section class="dp__inner-content">
139 @if (!string.IsNullOrWhiteSpace(_data.Header.HeaderFormatted()))
140 {
141 <header class="dp__header">
142 @_data.SubHeader.HeaderFormatted("dp__subheader")
143 @_data.Header.HeaderFormatted("dp__header")
144 </header>
145 }
146
147 @if (!string.IsNullOrWhiteSpace(_data.Content.Text))
148 {
149 <div class="dp__text">@_data.Content.Text</div>
150 }
151
152 @if (!string.IsNullOrWhiteSpace(GetString("ParagraphModule")))
153 {
154 <div class="dp__module">@GetString("ParagraphModule")</div>
155 }
156
157 @if(!string.IsNullOrWhiteSpace(_data.Button.ButtonText) || !string.IsNullOrWhiteSpace(_data.ExtraButton.ButtonText))
158 {
159 <nav class="dp__cta-container">
160 @RenderButton(_data.Button.Configuration, _data.Button.ButtonLink, _data.Button.Configuration.ButtonClass, _data.Button.ButtonText, _data.Button.ButtonAriaLabel, _data.Button.NewWindow)
161
162 @RenderButton(_data.ExtraButton.Configuration, _data.ExtraButton.ButtonLink, _data.ExtraButton.Configuration.ButtonClass, _data.ExtraButton.ButtonText, _data.ExtraButton.ButtonAriaLabel, _data.ExtraButton.NewWindow)
163 </nav>
164 }
165 </section>
166 </section>
167 </div>
168 </section>
169 }
170