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