News

Category
Error executing template "Designs/Rapido/ItemPublisher/List/DynamicList.cshtml"
System.ArgumentException: Object of type 'Dynamicweb.Rapido.Blocks.Components.Articles.ArticleListItem' cannot be converted to type 'S_DW_HD2412.CustomCode.ArticleListItemExtended'.
   at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)
   at System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
   at System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c7f2436f97943bcbc8d88fe2b63d469.<>c__DisplayClass5_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_HD2412\Files\Templates\Designs\Rapido\ItemPublisher\List\DynamicList.cshtml:line 524
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c7f2436f97943bcbc8d88fe2b63d469.<>c__DisplayClass4_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_HD2412\Files\Templates\Designs\Rapido\ItemPublisher\List\DynamicList.cshtml:line 445
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c7f2436f97943bcbc8d88fe2b63d469.<>c__DisplayClass5_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_HD2412\Files\Templates\Designs\Rapido\ItemPublisher\List\DynamicList.cshtml:line 534
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c7f2436f97943bcbc8d88fe2b63d469.<>c__DisplayClass4_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_HD2412\Files\Templates\Designs\Rapido\ItemPublisher\List\DynamicList.cshtml:line 410
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c7f2436f97943bcbc8d88fe2b63d469.<>c__DisplayClass5_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_HD2412\Files\Templates\Designs\Rapido\ItemPublisher\List\DynamicList.cshtml:line 534
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c7f2436f97943bcbc8d88fe2b63d469.<>c__DisplayClass4_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_HD2412\Files\Templates\Designs\Rapido\ItemPublisher\List\DynamicList.cshtml:line 445
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c7f2436f97943bcbc8d88fe2b63d469.<>c__DisplayClass5_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_HD2412\Files\Templates\Designs\Rapido\ItemPublisher\List\DynamicList.cshtml:line 534
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c7f2436f97943bcbc8d88fe2b63d469.<>c__DisplayClass4_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_HD2412\Files\Templates\Designs\Rapido\ItemPublisher\List\DynamicList.cshtml:line 410
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c7f2436f97943bcbc8d88fe2b63d469.Execute() in D:\dynamicweb.net\Solutions\S_DW_HD2412\Files\Templates\Designs\Rapido\ItemPublisher\List\DynamicList.cshtml:line 3533
   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() in E:\Agent\_work\169\s\06 - Dynamicweb Host\Dynamicweb\Dynamicweb-9.9\Dynamicweb\Rendering\Template.cs:line 902

1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using System.Web 3 @using System.IO 4 @using Dynamicweb.Rapido.Blocks 5 @using Dynamicweb.Rapido.Blocks.Components.Articles 6 @using Dynamicweb.Rapido.Blocks.Components.General 7 8 9 @functions { 10 public string Truncate(string value, int maxChars) 11 { 12 return value.Length <= maxChars ? value : value.Substring(0, maxChars) + "..."; 13 } 14 15 public string GetArticleCategory(int pageId) 16 { 17 string categoryName = null; 18 19 //Secure that the article is not in the root folder = Actual has a category 20 if (!String.IsNullOrEmpty(Dynamicweb.Services.Pages.GetPage(pageId).Parent.Parent.ItemType)) 21 { 22 categoryName = Dynamicweb.Services.Pages.GetPage(pageId).Parent.GetDisplayName(); 23 } 24 25 return categoryName; 26 } 27 28 public string GetArticleCategoryColor(int pageId) 29 { 30 string categoryColor = ""; 31 32 //Secure that the article is not in the root folder = Actual has a category 33 if (!String.IsNullOrEmpty(Dynamicweb.Services.Pages.GetPage(pageId).Parent.Parent.ItemType)) 34 { 35 if (Dynamicweb.Services.Pages.GetPage(pageId).Parent.Item["CategoryColor"] != null) 36 { 37 categoryColor = Dynamicweb.Services.Pages.GetPage(pageId).Parent.Item["CategoryColor"].ToString(); 38 } 39 } 40 41 return categoryColor; 42 } 43 44 public string GetParentSettingsItem(string systemName) 45 { 46 string item = null; 47 48 Dynamicweb.Content.Page current = Dynamicweb.Services.Pages.GetPage(Convert.ToInt32(GetGlobalValue("Global:Page.ID"))); 49 while (current != null && current.Parent != current) 50 { 51 var temp = current.Item != null ? current.Item[systemName] : ""; 52 53 if (temp != null) 54 { 55 item = temp.ToString(); 56 57 if (!String.IsNullOrEmpty(item) && !String.Equals("default", item, StringComparison.OrdinalIgnoreCase)) 58 { 59 break; 60 } 61 } 62 63 current = current.Parent; 64 } 65 66 return item; 67 } 68 } 69 70 @{ 71 bool isParagraph = Pageview.CurrentParagraph != null ? true : false; 72 string blocksPageName = isParagraph ? "DynamicList" + Pageview.CurrentParagraph.ID.ToString() : "DynamicList"; 73 BlocksPage articlePage = BlocksPage.GetBlockPage(blocksPageName); 74 75 string stickerPosition = "TopLeft"; 76 string listLayout = "default"; 77 78 if (isParagraph) 79 { 80 listLayout = Pageview.CurrentParagraph.Item["ListLayout"].ToString() != null ? Pageview.CurrentParagraph.Item["ListLayout"].ToString() : "default"; 81 stickerPosition = Pageview.CurrentParagraph.Item["MainListStickerPosition"] != null ? Pageview.CurrentParagraph.Item["MainListStickerPosition"].ToString() : stickerPosition; 82 } 83 else 84 { 85 listLayout = Pageview.Item["ListLayout"].ToString() != null ? Pageview.Item["ListLayout"].ToString() : "default"; 86 stickerPosition = Pageview.Item["MainListStickerPosition"] != null ? Pageview.Item["MainListStickerPosition"].ToString() : stickerPosition; 87 } 88 89 listLayout = listLayout == "default" && !String.IsNullOrEmpty(GetParentSettingsItem("ListLayout")) ? GetParentSettingsItem("ListLayout").ToString().ToLower() : listLayout; 90 91 92 Block listContainer = new Block 93 { 94 Id = "ArticleListContainer", 95 SortId = 10, 96 Design = new Design 97 { 98 RenderType = RenderType.Row 99 }, 100 BlocksList = new List<Block> { 101 new Block { 102 Id = "ArticleListBody", 103 SortId = 30, 104 Design = new Design { 105 RenderType = RenderType.Column, 106 Size = "12", 107 HidePadding = true 108 } 109 } 110 } 111 }; 112 articlePage.Add(listContainer); 113 114 Block articleListBodyRow = new Block 115 { 116 Id = "ArticleListBodyRow", 117 SortId = 10, 118 Design = new Design 119 { 120 RenderType = RenderType.Row 121 } 122 }; 123 articlePage.Add("ArticleListBody", articleListBodyRow); 124 125 int index = 0; 126 foreach (LoopItem listItem in GetLoop("ItemPublisher:Items.List")) 127 { 128 Block articleListItem = new Block 129 { 130 Id = "ArticleListItem" + index, 131 SortId = (index * 10), 132 Design = new Design 133 { 134 RenderType = RenderType.Column, 135 CssClass = "image-hover--zoom" 136 } 137 }; 138 139 ArticleListItem articleListItemComponent = new ArticleListItem 140 { 141 Title = listItem.GetString("ItemPublisher:Item.Title"), 142 Summary = Truncate(listItem.GetString("ItemPublisher:Item.Summary"), 120), 143 Stickers = new StickersCollection 144 { 145 Position = (StickersListPosition)System.Enum.Parse(typeof(StickersListPosition), stickerPosition), 146 Stickers = new List<Sticker> 147 { 148 new Sticker { 149 Title = GetArticleCategory(listItem.GetInteger("ItemPublisher:Item.Field.PageId")), 150 Color = "#fff", 151 BackgroundColor = GetArticleCategoryColor(listItem.GetInteger("ItemPublisher:Item.Field.PageId")) 152 } 153 } 154 }, 155 Link = "/Default.aspx?ID=" + listItem.GetString("ItemPublisher:Item.Field.PageId"), 156 Image = new Image 157 { 158 Title = listItem.GetString("ItemPublisher:Item.Title"), 159 Path = listItem.GetString("ItemPublisher:Item.Image"), 160 ImageSmall = new ImageSettings 161 { 162 Width = 1024, 163 Height = 473, 164 Crop = 0, 165 DoNotUpscale = true 166 }, 167 ImageMedium = new ImageSettings 168 { 169 Width = 1150, 170 Height = 531, 171 Crop = 0, 172 DoNotUpscale = true 173 } 174 }, 175 }; 176 177 if (!String.IsNullOrEmpty(listItem.GetString("ItemPublisher:Item.Logo"))) 178 { 179 articleListItemComponent.Logo = new Image 180 { 181 Path = listItem.GetString("ItemPublisher:Item.Logo") 182 }; 183 } 184 185 switch (listLayout) 186 { 187 case "list": 188 articleListItemComponent.Type = ArticleListItemType.List; 189 articleListItem.Component = articleListItemComponent; 190 articleListItem.Design.Size = "12"; 191 articleListItemComponent.Image.ImageDefault = new ImageSettings 192 { 193 Width = 350, 194 Height = 162, 195 Crop = 0, 196 DoNotUpscale = true 197 }; 198 break; 199 case "simple-list": 200 articleListItemComponent.Type = ArticleListItemType.Simple; 201 articleListItem.Component = articleListItemComponent; 202 articleListItem.Design.Size = "12"; 203 break; 204 case "carousel": 205 articleListItem.Component = new ArticleCarouselSlide 206 { 207 Image = listItem.GetString("ItemPublisher:Item.Image"), 208 ImageSettings = new ImageSettings 209 { 210 Width = 900, 211 Crop = 0, 212 DoNotUpscale = true 213 }, 214 Title = listItem.GetString("ItemPublisher:Item.Title"), 215 Link = "/Default.aspx?ID=" + listItem.GetString("ItemPublisher:Item.Field.PageId"), 216 Author = listItem.GetString("ItemPublisher:Item.Author"), 217 Date = !string.IsNullOrWhiteSpace(listItem.GetString("ItemPublisher:Item.Date")) ? listItem.GetDate("ItemPublisher:Item.Date").ToString("dd.MM.yyyy, HH:mm") : "", 218 Stickers = new StickersCollection 219 { 220 Position = StickersListPosition.Custom, 221 Stickers = new List<Sticker> 222 { 223 new Sticker { 224 Title = GetArticleCategory(listItem.GetInteger("ItemPublisher:Item.Field.PageId")), 225 Color = "#fff", 226 BackgroundColor = GetArticleCategoryColor(listItem.GetInteger("ItemPublisher:Item.Field.PageId")) 227 } 228 } 229 }, 230 Summary = Truncate(listItem.GetString("ItemPublisher:Item.Summary"), 120), 231 UseFilters = true 232 }; 233 articleListItem.Design = null; 234 articleListBodyRow.Component = new ArticleCarousel 235 { 236 Id = "General", 237 SubBlocks = articlePage.GetBlockListById("ArticleListBodyRow").OrderBy(item => item.SortId).ToList() 238 }; 239 articleListBodyRow.Design = null; 240 articleListBodyRow.SkipRenderBlocksList = true; 241 break; 242 case "default": 243 articleListItemComponent.Type = ArticleListItemType.List; 244 articleListItem.Component = articleListItemComponent; 245 articleListItem.Design.Size = "12"; 246 break; 247 } 248 249 int value = 0; 250 if (int.TryParse(listLayout, out value)) 251 { 252 articleListItemComponent.Type = ArticleListItemType.Card; 253 articleListItem.Component = articleListItemComponent; 254 articleListItem.Design.Size = listLayout; 255 256 switch (listLayout) 257 { 258 case "3": 259 articleListItemComponent.Image.ImageDefault = new ImageSettings 260 { 261 Width = 350, 262 Height = 162, 263 Crop = 0, 264 DoNotUpscale = true 265 }; 266 break; 267 case "4": 268 articleListItemComponent.Image.ImageDefault = new ImageSettings 269 { 270 Width = 450, 271 Height = 208, 272 Crop = 0, 273 DoNotUpscale = true 274 }; 275 break; 276 case "6": 277 articleListItemComponent.Image.ImageDefault = new ImageSettings 278 { 279 Width = 680, 280 Height = 314, 281 Crop = 0, 282 DoNotUpscale = true 283 }; 284 break; 285 case "12": 286 articleListItemComponent.Image.ImageDefault = new ImageSettings 287 { 288 Width = 1300, 289 Height = 600, 290 Crop = 0, 291 DoNotUpscale = true 292 }; 293 break; 294 } 295 } 296 297 articlePage.Add("ArticleListBodyRow", articleListItem); 298 299 index++; 300 } 301 302 if (GetLoop("ItemPublisher:Items.List").Count == 0) 303 { 304 Block notFoundInfo = new Block 305 { 306 Id = "NotFoundInfo", 307 SortId = 40, 308 Component = new ArticleListNoResultsInfo { }, 309 Design = new Design 310 { 311 RenderType = RenderType.Column, 312 Size = "12" 313 } 314 }; 315 articlePage.Add("ArticleListContainer", notFoundInfo); 316 } 317 318 if (GetInteger("ItemPublisher:Items.Paging.TotalPages") > 1) 319 { 320 Block paginationBlock = new Block 321 { 322 Id = "ArticleListPagination", 323 SortId = 40, 324 Component = new Pagination { PagingTag = "ItemPublisher:Items" }, 325 Design = new Design 326 { 327 RenderType = RenderType.Column, 328 Size = "12" 329 } 330 }; 331 articlePage.Add("ArticleListContainer", paginationBlock); 332 } 333 } 334 335 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ 336 337 338 @using System.Text.RegularExpressions 339 @using System.Reflection 340 @using System.Web.UI.HtmlControls 341 @using Dynamicweb.Rapido.Blocks.Components 342 @using Dynamicweb.Rapido.Blocks.Components.Articles 343 @using Dynamicweb.Rapido.Blocks.Components.Documentation 344 @using Dynamicweb.Rapido.Blocks 345 @using System 346 @using System.Web 347 @using System.Collections.Generic 348 @using Dynamicweb.Frontend 349 @*--- START: Base block renderers ---*@ 350 351 @helper RenderBlockList(List<Block> blocks) 352 { 353 blocks = blocks.OrderBy(item => item.SortId).ToList(); 354 355 foreach (Block item in blocks) 356 { 357 <!-- START: @item.Id --> 358 359 if (item.Design == null) 360 { 361 @RenderBlock(item) 362 } 363 else if (item.Design.RenderType == RenderType.None) 364 { 365 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 366 367 <div class="@cssClass dw-mod"> 368 @RenderBlock(item) 369 </div> 370 } 371 else if (item.Design.RenderType != RenderType.Hide) 372 { 373 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 374 375 if (!item.SkipRenderBlocksList) 376 { 377 378 379 if (item.Design.RenderType == RenderType.Row) 380 { 381 382 //Custom if sentence to check if grid/container has the id "ArticleContainer" to change the Dynamic Article/Nyhedsside layout 383 384 if (item.Id == "ArticleContainer") 385 { 386 387 <div class="grid grid--align-content-start grid-custom-layout @cssClass dw-mod" id="Block__@item.Id"> 388 @RenderBlock(item) 389 </div> 390 } 391 392 else if (item.Id == "CaseContainer") 393 { 394 <div class="grid grid--align-content-start grid-custom-layout-third @cssClass dw-mod" id="Block__@item.Id"> 395 @RenderBlock(item) 396 </div> 397 } 398 399 else if (item.Id == "OrderContainerRow") 400 { 401 <div class="grid grid--align-content-start grid-custom-layout-third @cssClass mobile-order-container-row dw-mod" id="Block__@item.Id"> 402 @RenderBlock(item) 403 </div> 404 } 405 406 407 else 408 { 409 <div class="grid grid--align-content-start grid-custom-layout-third @cssClass dw-mod" id="Block__@item.Id"> 410 @RenderBlock(item) 411 </div> 412 413 } 414 415 416 } 417 418 if (item.Design.RenderType == RenderType.Column) 419 { 420 string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; 421 string size = item.Design.Size ?? "12"; 422 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; 423 424 //Custom if sentence to check if grid/container has the id "MasterFooter" to change the footer layout 425 if (item.Id.Contains("MasterFooter")) 426 { 427 <div class="@(item.Id.Contains("MasterFooterColumnOne") || item.Id.Contains("MasterFooterColumnTwo") ? "grid__col-lg-3 grid__col-6 mobile-flex-order" : "grid__col-12") @(item.Id.Contains("MasterFooterColumnThree") ? "grid__col-6 grid--align-end mobile-flex-order" : "grid__col-12") grid--align-content-space-between grid--justify-start @hidePadding @cssClass dw-mod" id="Block__@item.Id"> 428 @RenderBlock(item) 429 </div> 430 } 431 432 //Custom if sentence to check if grid/container has the id "ArticleParagraphImage" to change the Dynamic Article image to be full width on desktop 433 else if (item.Id.Contains("ArticleParagraph")) 434 { 435 436 <div class="grid__col-12 @hidePadding @cssClass dw-mod" id="Block__@item.Id "> 437 @RenderBlock(item) 438 </div> 439 } 440 441 442 else 443 { 444 <section 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"> 445 @RenderBlock(item) 446 </section> 447 } 448 449 } 450 451 452 if (item.Design.RenderType == RenderType.Table) 453 { 454 <table class="table @cssClass dw-mod" id="Block__@item.Id"> 455 @RenderBlock(item) 456 </table> 457 } 458 459 if (item.Design.RenderType == RenderType.TableRow) 460 { 461 <tr class="@cssClass dw-mod" id="Block__@item.Id"> 462 @RenderBlock(item) 463 </tr> 464 } 465 466 if (item.Design.RenderType == RenderType.TableColumn) 467 { 468 <td class="@cssClass dw-mod" id="Block__@item.Id"> 469 @RenderBlock(item) 470 </td> 471 } 472 473 if (item.Design.RenderType == RenderType.CardHeader) 474 { 475 <div class="card-header @cssClass dw-mod"> 476 @RenderBlock(item) 477 </div> 478 } 479 480 if (item.Design.RenderType == RenderType.CardBody) 481 { 482 <div class="card @cssClass dw-mod"> 483 @RenderBlock(item) 484 </div> 485 } 486 487 if (item.Design.RenderType == RenderType.CardFooter) 488 { 489 <div class="card-footer @cssClass dw-mod"> 490 @RenderBlock(item) 491 </div> 492 493 } 494 495 496 } 497 else 498 { 499 @RenderBlock(item) 500 } 501 } 502 503 <!-- END: @item.Id --> 504 } 505 } 506 507 @helper RenderBlock(Block item) 508 { 509 if (item.Template != null) 510 { 511 @BlocksPage.RenderTemplate(item.Template) 512 } 513 514 if (item.Component != null) 515 { 516 string methodName = item.Component.HelperName; 517 dynamic[] methodParameters = new dynamic[1]; 518 methodParameters[0] = item.Component; 519 Type methodType = this.GetType(); 520 MethodInfo generalMethod = methodType.GetMethod(methodName); 521 522 if (generalMethod != null) 523 { 524 @generalMethod.Invoke(this, methodParameters).ToString(); 525 } 526 else 527 { 528 throw new Exception(item.Component.GetType().Name + " method '" + methodName + "' could not be invoked"); 529 } 530 } 531 532 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList) 533 { 534 @RenderBlockList(item.BlocksList) 535 } 536 } 537 538 @*--- END: Base block renderers ---*@ 539 540 @using Dynamicweb.Rapido.Blocks.Components 541 @using Dynamicweb.Rapido.Blocks.Components.General 542 @using Dynamicweb.Rapido.Blocks 543 544 545 @* Components *@ 546 @using System.Reflection 547 @using Dynamicweb.Rapido.Blocks.Components.General 548 549 550 @* Component *@ 551 552 @helper RenderIcon(Icon settings) { 553 if (settings != null) 554 { 555 dynamic[] methodParameters = new dynamic[1]; 556 methodParameters[0] = settings; 557 MethodInfo customMethod = this.GetType().GetMethod("RenderIconCustom"); 558 559 if (customMethod != null) 560 { 561 @customMethod.Invoke(this, methodParameters).ToString(); 562 } else { 563 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 564 565 if (settings.Name != null) 566 { 567 if (String.IsNullOrEmpty(settings.Label)) { 568 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> 569 } else { 570 if (settings.LabelPosition == IconLabelPosition.Before) { 571 <span>@settings.Label <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i></span> 572 } else { 573 <span><i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> @settings.Label</span> 574 } 575 } 576 } 577 } 578 } 579 } 580 @using System.Reflection 581 @using Dynamicweb.Rapido.Blocks.Components.General 582 @using Dynamicweb.Rapido.Blocks.Components 583 @using S_DW_HD2412.CustomCode 584 585 @* Component *@ 586 587 @helper RenderButtonExtended(ButtonExtended settings) 588 { 589 dynamic[] methodParameters = new dynamic[1]; 590 methodParameters[0] = settings; 591 MethodInfo customMethod = this.GetType().GetMethod("RenderButtonCustom"); 592 593 if (customMethod != null) 594 { 595 @customMethod.Invoke(this, methodParameters).ToString(); 596 } 597 else 598 { 599 string target; 600 string disabled = settings.Disabled ? "disabled" : ""; 601 string buttonType = settings.ButtonType == ButtonType.Submit ? "submit" : "button"; 602 buttonType = settings.ButtonType == ButtonType.Reset ? "reset" : buttonType; 603 string buttonLayout = settings.ButtonLayout.ToString().ToLower(); 604 string nofollow = settings.ButtonNofollow != false ? "rel='nofollow'" : null; 605 606 switch (settings.Target) 607 { 608 case LinkTargetType.Blank: 609 target = "_blank"; 610 break; 611 case LinkTargetType.Parent: 612 target = "_parent"; 613 break; 614 case LinkTargetType.Self: 615 target = "_self"; 616 break; 617 case LinkTargetType.Top: 618 target = "_top"; 619 break; 620 default: 621 target = "_self"; 622 break; 623 } 624 625 string onClickAction = settings.OnClick != null ? settings.OnClick : ""; 626 string noOpener = target == "_blank" ? "rel=\"noopener\"" : ""; 627 628 if (!String.IsNullOrEmpty(settings.ConfirmText)) 629 { 630 string modalId = settings.Id; 631 @RenderConfirmDialog(settings); 632 onClickAction = "document.getElementById('" + modalId + "ModalTrigger').checked = true"; 633 } 634 635 if (settings.Icon != null) 636 { 637 if (settings.IconPosition == null) 638 { 639 settings.Icon.LabelPosition = IconLabelPosition.After; 640 } 641 else 642 { 643 settings.Icon.LabelPosition = settings.IconPosition == IconPosition.Before ? IconLabelPosition.After : IconLabelPosition.Before; 644 } 645 if (settings.Icon.Label == null) 646 { 647 settings.Icon.Label = settings.Title; 648 } 649 } 650 string content = settings.Icon == null ? settings.Title : Convert.ToString(RenderIcon(settings.Icon)); 651 652 if (!String.IsNullOrEmpty(settings.Link) && String.IsNullOrEmpty(settings.ConfirmText)) 653 { 654 <a href="@settings.Link" target="@target" class="btn btn--@buttonLayout @settings.CssClass @disabled dw-mod" @nofollow onclick="@onClickAction" @ComponentMethods.AddAttributes(settings.ExtraAttributes) @disabled>@content</a> } 655 else 656 { 657 <button type="@buttonType" class="btn btn--@buttonLayout @settings.CssClass @disabled dw-mod" onclick="@onClickAction" @ComponentMethods.AddAttributes(settings.ExtraAttributes) @disabled>@content</button> 658 } 659 } 660 } 661 662 @helper RenderButton(Button settings) 663 { 664 dynamic[] methodParameters = new dynamic[1]; 665 methodParameters[0] = settings; 666 MethodInfo customMethod = this.GetType().GetMethod("RenderButtonCustom"); 667 668 if (customMethod != null) 669 { 670 @customMethod.Invoke(this, methodParameters).ToString(); 671 } 672 else 673 { 674 string target; 675 string disabled = settings.Disabled ? "disabled" : ""; 676 string buttonType = settings.ButtonType == ButtonType.Submit ? "submit" : "button"; 677 buttonType = settings.ButtonType == ButtonType.Reset ? "reset" : buttonType; 678 string buttonLayout = settings.ButtonLayout.ToString().ToLower(); 679 680 switch (settings.Target) 681 { 682 case LinkTargetType.Blank: 683 target = "_blank"; 684 break; 685 case LinkTargetType.Parent: 686 target = "_parent"; 687 break; 688 case LinkTargetType.Self: 689 target = "_self"; 690 break; 691 case LinkTargetType.Top: 692 target = "_top"; 693 break; 694 default: 695 target = "_self"; 696 break; 697 } 698 699 string onClickAction = settings.OnClick != null ? settings.OnClick : ""; 700 string noOpener = target == "_blank" ? "rel=\"noopener\"" : ""; 701 702 if (!String.IsNullOrEmpty(settings.ConfirmText)) 703 { 704 string modalId = settings.Id; 705 @RenderConfirmDialog(settings); 706 onClickAction = "document.getElementById('" + modalId + "ModalTrigger').checked = true"; 707 } 708 709 if (settings.Icon != null) 710 { 711 if (settings.IconPosition == null) 712 { 713 settings.Icon.LabelPosition = IconLabelPosition.After; 714 } 715 else 716 { 717 settings.Icon.LabelPosition = settings.IconPosition == IconPosition.Before ? IconLabelPosition.After : IconLabelPosition.Before; 718 } 719 if (settings.Icon.Label == null) 720 { 721 settings.Icon.Label = settings.Title; 722 } 723 } 724 string content = settings.Icon == null ? settings.Title : Convert.ToString(RenderIcon(settings.Icon)); 725 726 if (!String.IsNullOrEmpty(settings.Link) && String.IsNullOrEmpty(settings.ConfirmText)) 727 { 728 <a href="@settings.Link" target="@target" @noOpener class="btn btn--@buttonLayout @settings.CssClass @disabled dw-mod" onclick="@onClickAction" @ComponentMethods.AddAttributes(settings.ExtraAttributes) @disabled>@content</a> } 729 else 730 { 731 <button type="@buttonType" class="btn btn--@buttonLayout @settings.CssClass @disabled dw-mod" onclick="@onClickAction" @ComponentMethods.AddAttributes(settings.ExtraAttributes) @disabled>@content</button> 732 } 733 } 734 } 735 736 737 @helper RenderConfirmDialog(Button settings) 738 { 739 dynamic[] methodParameters = new dynamic[1]; 740 methodParameters[0] = settings; 741 MethodInfo customMethod = this.GetType().GetMethod("RenderConfirmDialogCustom"); 742 743 if (customMethod != null) 744 { 745 @customMethod.Invoke(this, methodParameters).ToString(); 746 } 747 else 748 { 749 string modalTriggerId = settings.Id + "ModalTrigger"; 750 751 <!-- Trigger for the confirm modal --> 752 <input type="checkbox" id="@modalTriggerId" class="modal-trigger" /> 753 754 <!-- Login modal --> 755 <div class="modal-container"> 756 <label for="@modalTriggerId" class="modal-overlay"></label> 757 <div class="modal modal--xs"> 758 <div class="modal__header"> 759 <h2>@settings.ConfirmText</h2> 760 </div> 761 <div class="modal__body"> 762 @RenderButton(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = settings.OnClick, CssClass = "u-full-width", Link = settings.Link }) 763 </div> 764 </div> 765 </div> 766 } 767 } 768 @using System.Reflection 769 @using Dynamicweb.Rapido.Blocks.Components 770 @using Dynamicweb.Rapido.Blocks.Components.General 771 @using Dynamicweb.Rapido.Blocks 772 773 774 @* Component *@ 775 776 @helper RenderRating(Rating settings) 777 { 778 dynamic[] methodParameters = new dynamic[1]; 779 methodParameters[0] = settings; 780 MethodInfo customMethod = this.GetType().GetMethod("RenderRatingCustom"); 781 782 if (customMethod != null) 783 { 784 @customMethod.Invoke(this, methodParameters).ToString(); 785 } else { 786 if (settings.Score > 0) 787 { 788 int rating = settings.Score; 789 string iconType = "fa-star"; 790 791 switch (settings.Type.ToString()) { 792 case "Stars": 793 iconType = "fa-star"; 794 break; 795 case "Hearts": 796 iconType = "fa-heart"; 797 break; 798 case "Lemons": 799 iconType = "fa-lemon"; 800 break; 801 case "Bombs": 802 iconType = "fa-bomb"; 803 break; 804 } 805 806 <div class="u-ta-right"> 807 @for (int i = 0; i < settings.OutOf; i++) 808 { 809 <i class="@(rating > i ? "fas" : "far") @iconType"></i> 810 } 811 </div> 812 } 813 } 814 } 815 @using System.Reflection 816 @using Dynamicweb.Rapido.Blocks.Components.General 817 @using Dynamicweb.Rapido.Blocks.Components 818 819 820 @* Component *@ 821 822 @helper RenderFieldListOption(FieldListOption settings) { 823 dynamic[] methodParameters = new dynamic[1]; 824 methodParameters[0] = settings; 825 MethodInfo customMethod = this.GetType().GetMethod("RenderFieldListOptionCustom"); 826 827 if (customMethod != null) 828 { 829 @customMethod.Invoke(this, methodParameters).ToString(); 830 } else { 831 string disabled = settings.Disabled ? "disabled" : ""; 832 string selected = settings.Checked ? "checked" : ""; 833 834 if (settings.Type.ToString() == "RadioButton") 835 { 836 <input class="form__control @disabled dw-mod" onchange="@settings.OnChange" onclick="@settings.OnClick" type="radio" name="@settings.Name" id="@settings.Id" value="@settings.Value" @selected @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 837 <label for="@settings.Id" class="u-inline @disabled dw-mod">@settings.Label</label> 838 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 839 } 840 841 if (settings.Type.ToString() == "Checkbox") 842 { 843 @RenderCheckboxField(settings) 844 } 845 846 if (settings.Type.ToString() == "SelectOption") 847 { 848 <option value="@settings.Value" id="@settings.Id" onclick="@settings.OnClick" class="@disabled" @disabled @selected @ComponentMethods.AddAttributes(settings.ExtraAttributes) >@settings.Name</option> 849 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 850 } 851 } 852 } 853 854 @using System.Reflection 855 @using Dynamicweb.Rapido.Blocks.Components.General 856 @using Dynamicweb.Rapido.Blocks.Components 857 858 859 @* Component *@ 860 861 @helper RenderNavigation(Navigation settings) { 862 dynamic[] methodParameters = new dynamic[1]; 863 methodParameters[0] = settings; 864 MethodInfo customMethod = this.GetType().GetMethod("RenderNavigationCustom"); 865 866 if (customMethod != null) 867 { 868 @customMethod.Invoke(this, methodParameters).ToString(); 869 } else { 870 @RenderNavigation(new 871 { 872 id = settings.Id, 873 cssclass = settings.CssClass, 874 startLevel = settings.StartLevel, 875 endlevel = settings.EndLevel, 876 expandmode = settings.Expandmode, 877 template = settings.Template 878 }) 879 } 880 } 881 @using System.Reflection 882 @using Dynamicweb.Rapido.Blocks.Components.General 883 @using Dynamicweb.Rapido.Blocks.Components 884 885 886 @* Component *@ 887 888 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) { 889 dynamic[] methodParameters = new dynamic[1]; 890 methodParameters[0] = settings; 891 MethodInfo customMethod = this.GetType().GetMethod("RenderBreadcrumbNavigationCustom"); 892 893 if (customMethod != null) 894 { 895 @customMethod.Invoke(this, methodParameters).ToString(); 896 } else { 897 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 898 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 899 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 900 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 901 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 902 903 @RenderNavigation(settings) 904 } 905 } 906 @using System.Reflection 907 @using Dynamicweb.Rapido.Blocks.Components.General 908 909 910 @* Component *@ 911 912 @helper RenderHeading(Heading settings) { 913 dynamic[] methodParameters = new dynamic[1]; 914 methodParameters[0] = settings; 915 MethodInfo customMethod = this.GetType().GetMethod("RenderHeadingCustom"); 916 917 if (customMethod != null) 918 { 919 @customMethod.Invoke(this, methodParameters).ToString(); 920 } else { 921 string startTag = "<h" + settings.Level.ToString() + " class=\"" + settings.CssClass + "\">"; 922 string endTag = "</h" + settings.Level.ToString() + "\">"; 923 924 if (settings.Icon != null) 925 { 926 if (settings.IconPosition == null) { 927 settings.Icon.LabelPosition = IconLabelPosition.After; 928 } else { 929 settings.Icon.LabelPosition = settings.IconPosition == IconPosition.Before ? IconLabelPosition.After : IconLabelPosition.Before; 930 } 931 if (settings.Icon.Label == null) { 932 settings.Icon.Label = settings.Title; 933 } 934 935 @startTag@RenderIcon(settings.Icon)@endTag 936 } else { 937 @startTag@settings.Title@endTag 938 } 939 } 940 } 941 @using System.Reflection 942 @using Dynamicweb.Rapido.Blocks.Components 943 @using Dynamicweb.Rapido.Blocks.Components.General 944 @using Dynamicweb.Rapido.Blocks 945 946 947 @* Component *@ 948 949 @helper RenderImage(Image settings) 950 { 951 if (settings.Path != null) 952 { 953 dynamic[] methodParameters = new dynamic[1]; 954 methodParameters[0] = settings; 955 MethodInfo customMethod = this.GetType().GetMethod("RenderImageCustom"); 956 957 if (customMethod != null) 958 { 959 @customMethod.Invoke(this, methodParameters).ToString(); 960 } else { 961 <div> 962 @if (settings.Link != null) 963 { 964 <a href="@settings.Link"> 965 @RenderTheImage(settings); 966 </a> 967 } 968 else 969 { 970 @RenderTheImage(settings); 971 } 972 </div> 973 } 974 } 975 } 976 977 @functions { 978 string getImagePathFromSettings(ImageSettings settings) 979 { 980 string result = ""; 981 982 if (settings != null) 983 { 984 result += settings.Width != 0 ? "Width=" + settings.Width + "&" : ""; 985 result += settings.Height != 0 ? "Height=" + settings.Height + "&" : ""; 986 result += "Crop=" + settings.Crop + "&"; 987 result += "Compression=" + settings.Compression + "&"; 988 result += "DoNotUpscale=" + settings.DoNotUpscale.ToString() + "&"; 989 result += "FillCanvas=" + settings.FillCanvas.ToString() + "&"; 990 } 991 992 return result; 993 } 994 } 995 996 @helper RenderTheImage(Image settings) 997 { 998 if (settings != null) 999 { 1000 dynamic[] methodParameters = new dynamic[1]; 1001 methodParameters[0] = settings; 1002 MethodInfo customMethod = this.GetType().GetMethod("RenderTheImageCustom"); 1003 1004 if (customMethod != null) 1005 { 1006 @customMethod.Invoke(this, methodParameters).ToString(); 1007 } else { 1008 string placeholderImage = "/Files/Images/placeholder.gif"; 1009 string imageEngine = "/Admin/Public/GetImage.ashx?"; 1010 1011 string imageStyle = ""; 1012 1013 switch (settings.Style) 1014 { 1015 case ImageStyle.Ball: 1016 imageStyle = "grid__cell-img--ball"; 1017 break; 1018 } 1019 1020 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle) 1021 { 1022 if (settings.ImageDefault != null) 1023 { 1024 settings.ImageDefault.Height = settings.ImageDefault.Width; 1025 } 1026 if (settings.ImageMedium != null) 1027 { 1028 settings.ImageMedium.Height = settings.ImageMedium.Width; 1029 } 1030 if (settings.ImageSmall != null) 1031 { 1032 settings.ImageSmall.Height = settings.ImageSmall.Width; 1033 } 1034 } 1035 1036 string defaultImage = imageEngine; 1037 string imageSmall = ""; 1038 string imageMedium = ""; 1039 1040 if (settings.DisableImageEngine) { 1041 defaultImage = settings.Path; 1042 } else { 1043 if (settings.ImageDefault != null) 1044 { 1045 defaultImage += getImagePathFromSettings(settings.ImageDefault); 1046 1047 if (settings.Path.GetType() != typeof(string)) 1048 { 1049 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 1050 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 1051 } 1052 else 1053 { 1054 defaultImage += settings.Path != null ? "Image=" + settings.Path : ""; 1055 } 1056 } 1057 1058 if (settings.ImageSmall != null) 1059 { 1060 imageSmall = "data-src-small=\"" + imageEngine; 1061 imageSmall += getImagePathFromSettings(settings.ImageSmall); 1062 1063 if (settings.Path.GetType() != typeof(string)) 1064 { 1065 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 1066 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 1067 } 1068 else 1069 { 1070 imageSmall += settings.Path != null ? "Image=" + settings.Path : ""; 1071 } 1072 1073 imageSmall += "\""; 1074 } 1075 1076 if (settings.ImageMedium != null) 1077 { 1078 imageMedium = "data-src-medium=\"" + imageEngine; 1079 imageMedium += getImagePathFromSettings(settings.ImageMedium); 1080 1081 if (settings.Path.GetType() != typeof(string)) 1082 { 1083 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 1084 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 1085 } 1086 else 1087 { 1088 imageMedium += settings.Path != null ? "Image=" + settings.Path : ""; 1089 } 1090 1091 imageMedium += "\""; 1092 } 1093 } 1094 1095 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 1096 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); } 1097 if (!String.IsNullOrEmpty(settings.Title)) { optionalAttributes.Add("alt", settings.Title); } 1098 1099 if (settings.DisableLazyLoad) { 1100 <img class="grid__cell-img @imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) alt="@settings.Path" /> 1101 } else { 1102 <img class="grid__cell-img b-lazy @imageStyle @settings.CssClass dw-mod" src="@placeholderImage" data-src="@defaultImage" @imageSmall @imageMedium @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) alt="@settings.Path" /> 1103 } 1104 1105 if (settings.Caption != null) 1106 { 1107 <span class="image-caption dw-mod">@settings.Caption</span> 1108 } 1109 } 1110 } 1111 } 1112 @using System.Reflection 1113 @using Dynamicweb.Rapido.Blocks.Components.General 1114 @using Dynamicweb.Rapido.Blocks.Components 1115 1116 1117 @* Component *@ 1118 1119 @helper RenderTextField(TextField settings) { 1120 dynamic[] methodParameters = new dynamic[1]; 1121 methodParameters[0] = settings; 1122 MethodInfo customMethod = this.GetType().GetMethod("RenderTextFieldCustom"); 1123 1124 if (customMethod != null) 1125 { 1126 @customMethod.Invoke(this, methodParameters).ToString(); 1127 } else { 1128 int maxLength = settings.MaxLength != 0 ? settings.MaxLength : 524288; 1129 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 1130 if (settings.Type == TextFieldType.Password) { optionalAttributes.Add("autocomplete", "off"); }; 1131 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); } 1132 if (!String.IsNullOrEmpty(settings.Placeholder)) { optionalAttributes.Add("placeholder", settings.Placeholder); } 1133 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); } 1134 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); } 1135 if (settings.MaxLength != 0) { optionalAttributes.Add("maxlength", settings.MaxLength.ToString()); } 1136 1137 <div class="form__field-group dw-mod"> 1138 @if (!String.IsNullOrEmpty(settings.Label)) 1139 { 1140 <label for="@settings.Id">@settings.Label</label> 1141 } 1142 1143 <input type="@settings.Type" class="u-full-width @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 1144 1145 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 1146 </div> 1147 } 1148 } 1149 @using System.Reflection 1150 @using Dynamicweb.Rapido.Blocks.Components.General 1151 @using Dynamicweb.Rapido.Blocks.Components 1152 1153 1154 @* Component *@ 1155 1156 @helper RenderNumberField(NumberField settings) { 1157 dynamic[] methodParameters = new dynamic[1]; 1158 methodParameters[0] = settings; 1159 MethodInfo customMethod = this.GetType().GetMethod("RenderNumberFieldCustom"); 1160 1161 if (customMethod != null) 1162 { 1163 @customMethod.Invoke(this, methodParameters).ToString(); 1164 } else { 1165 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 1166 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); } 1167 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); } 1168 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); } 1169 if (settings.Max != 0) { optionalAttributes.Add("max", settings.Max.ToString()); } 1170 if (settings.Min != 0) { optionalAttributes.Add("min", settings.Min.ToString()); } 1171 if (settings.Step != 0) { optionalAttributes.Add("step", settings.Step.ToString()); } 1172 1173 <div class="form__field-group dw-mod"> 1174 @if (!String.IsNullOrEmpty(settings.Label)) 1175 { 1176 <div> 1177 <label for="@settings.Id">@settings.Label</label> 1178 </div> 1179 } 1180 1181 <input type="Number" class="u-w70px @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 1182 1183 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 1184 </div> 1185 } 1186 } 1187 @using System.Reflection 1188 @using Dynamicweb.Rapido.Blocks.Components.General 1189 @using Dynamicweb.Rapido.Blocks.Components 1190 1191 1192 @* Component *@ 1193 1194 @helper RenderTextareaField(TextareaField settings) { 1195 dynamic[] methodParameters = new dynamic[1]; 1196 methodParameters[0] = settings; 1197 MethodInfo customMethod = this.GetType().GetMethod("RenderTextareaFieldCustom"); 1198 1199 if (customMethod != null) 1200 { 1201 @customMethod.Invoke(this, methodParameters).ToString(); 1202 } else { 1203 int maxLength = settings.MaxLength != 0 ? settings.MaxLength : 524288; 1204 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 1205 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); } 1206 if (!String.IsNullOrEmpty(settings.Placeholder)) { optionalAttributes.Add("placeholder", settings.Placeholder); } 1207 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); } 1208 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); } 1209 if (settings.MaxLength != 0) { optionalAttributes.Add("maxlength", settings.MaxLength.ToString()); } 1210 if (settings.Rows != 0) { optionalAttributes.Add("rows", settings.Rows.ToString()); } 1211 1212 <div class="form__field-group dw-mod"> 1213 @if (!String.IsNullOrEmpty(@settings.Label)) 1214 { 1215 <label for="@settings.Id">@settings.Label</label> 1216 } 1217 1218 <textarea class="u-full-width @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)></textarea> 1219 1220 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 1221 </div> 1222 } 1223 } 1224 @using System.Reflection 1225 @using Dynamicweb.Rapido.Blocks.Components.General 1226 @using Dynamicweb.Rapido.Blocks.Components 1227 1228 1229 @* Component *@ 1230 1231 @helper RenderHiddenField(HiddenField settings) { 1232 dynamic[] methodParameters = new dynamic[1]; 1233 methodParameters[0] = settings; 1234 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 1235 1236 if (customMethod != null) 1237 { 1238 @customMethod.Invoke(this, methodParameters).ToString(); 1239 } else { 1240 <input type="hidden" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(settings.ExtraAttributes)/> 1241 } 1242 } 1243 @using System.Reflection 1244 @using Dynamicweb.Rapido.Blocks.Components.General 1245 @using Dynamicweb.Rapido.Blocks.Components 1246 1247 1248 @* Component *@ 1249 1250 @helper RenderCheckboxField(dynamic settings) { 1251 dynamic[] methodParameters = new dynamic[1]; 1252 methodParameters[0] = settings; 1253 MethodInfo customMethod = this.GetType().GetMethod("RenderCheckboxFieldCustom"); 1254 1255 if (customMethod != null) 1256 { 1257 @customMethod.Invoke(this, methodParameters).ToString(); 1258 } else { 1259 settings.Type = FieldListOptionType.Checkbox; 1260 string disabled = settings.Disabled ? "disabled" : ""; 1261 string required = settings.Required ? "required" : ""; 1262 string checkedString = settings.Checked == true ? "checked" : ""; 1263 string id = settings.Id != null ? settings.Id : settings.Label.Replace(" ", ""); 1264 1265 <div class="form__field-group dw-mod"> 1266 <input type="checkbox" class="form__control @settings.CssClass @disabled dw-mod" name="@settings.Name" id="@id" value="@settings.Value" onclick="@settings.OnClick" @disabled @required @checkedString @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 1267 1268 @if (!String.IsNullOrEmpty(settings.Label)) 1269 { 1270 <label for="@id" class="@disabled dw-mod">@settings.Label</label> 1271 } 1272 1273 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 1274 </div> 1275 } 1276 } 1277 @using System.Reflection 1278 @using Dynamicweb.Rapido.Blocks.Components.General 1279 @using Dynamicweb.Rapido.Blocks.Components 1280 1281 1282 @* Component *@ 1283 1284 @helper RenderCheckboxListField(CheckboxListField settings) { 1285 dynamic[] methodParameters = new dynamic[1]; 1286 methodParameters[0] = settings; 1287 MethodInfo customMethod = this.GetType().GetMethod("RenderCheckboxListFieldCustom"); 1288 1289 if (customMethod != null) 1290 { 1291 @customMethod.Invoke(this, methodParameters).ToString(); 1292 } else { 1293 string disabled = settings.Disabled ? "disabled" : ""; 1294 1295 <div class="form__field-group @settings.CssClass u-margin-bottom @disabled dw-mod" @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1296 @if (!String.IsNullOrEmpty(settings.Label)) 1297 { 1298 <div class="u-bold u-margin-bottom">@settings.Label</div> 1299 } 1300 1301 @foreach (var item in settings.Options) 1302 { 1303 item.Type = FieldListOptionType.Checkbox; 1304 @RenderFieldListOption(item) 1305 } 1306 1307 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 1308 </div> 1309 } 1310 } 1311 1312 @using System.Reflection 1313 @using Dynamicweb.Rapido.Blocks.Components.General 1314 @using Dynamicweb.Rapido.Blocks.Components 1315 1316 1317 @* Component *@ 1318 1319 @helper RenderSelectField(SelectField settings) { 1320 dynamic[] methodParameters = new dynamic[1]; 1321 methodParameters[0] = settings; 1322 MethodInfo customMethod = this.GetType().GetMethod("RenderSelectFieldCustom"); 1323 1324 if (customMethod != null) 1325 { 1326 @customMethod.Invoke(this, methodParameters).ToString(); 1327 } else { 1328 string disabled = settings.Disabled ? "disabled" : ""; 1329 string required = settings.Required ? "required" : ""; 1330 1331 if (settings.Default != null) 1332 { 1333 settings.Default.Type = FieldListOptionType.SelectOption; 1334 } 1335 1336 <div class="form__field-group u-full-width dw-mod"> 1337 @if (!String.IsNullOrEmpty(settings.Label)) 1338 { 1339 <label for="@settings.Id">@settings.Label</label> 1340 } 1341 1342 <div class="form__field-combi u-no-margin dw-mod"> 1343 <select id="@settings.Id" class="u-full-width @settings.CssClass dw-mod" onchange="@settings.OnChange" @ComponentMethods.AddAttributes(settings.ExtraAttributes) > 1344 @if (settings.Default.Value != null) 1345 { 1346 @RenderFieldListOption(settings.Default) 1347 } 1348 1349 @foreach (var item in settings.Options) 1350 { 1351 item.Type = FieldListOptionType.SelectOption; 1352 @RenderFieldListOption(item) 1353 } 1354 </select> 1355 @if (settings.ActionButton.Link != null || settings.ActionButton.OnClick != null) { 1356 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1357 @RenderButton(settings.ActionButton); 1358 } 1359 </div> 1360 1361 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 1362 </div> 1363 } 1364 } 1365 @using System.Reflection 1366 @using Dynamicweb.Rapido.Blocks.Components.General 1367 @using Dynamicweb.Rapido.Blocks.Components 1368 1369 1370 @* Component *@ 1371 1372 @helper RenderRadioButtonField(RadioButtonField settings) { 1373 dynamic[] methodParameters = new dynamic[1]; 1374 methodParameters[0] = settings; 1375 MethodInfo customMethod = this.GetType().GetMethod("RenderRadioButtonFieldCustom"); 1376 1377 if (customMethod != null) 1378 { 1379 @customMethod.Invoke(this, methodParameters).ToString(); 1380 } else { 1381 string disabled = settings.Disabled ? "disabled" : ""; 1382 1383 <div class="form__field-group @settings.CssClass u-margin-bottom @disabled" @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1384 @if (!String.IsNullOrEmpty(settings.Label)) 1385 { 1386 <div class="u-bold u-margin-bottom">@settings.Label</div> 1387 } 1388 1389 @foreach (var item in settings.Options) 1390 { 1391 item.Type = FieldListOptionType.RadioButton; 1392 1393 if (settings.Name != null) 1394 { 1395 item.Name = settings.Name; 1396 } 1397 1398 if (settings.RenderOptionsInline) 1399 { 1400 @RenderFieldListOption(item) 1401 } 1402 else 1403 { 1404 <div> 1405 @RenderFieldListOption(item) 1406 </div> 1407 } 1408 } 1409 1410 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 1411 </div> 1412 } 1413 } 1414 @using System.Reflection 1415 @using Dynamicweb.Rapido.Blocks.Components.General 1416 @using Dynamicweb.Rapido.Blocks.Components 1417 1418 1419 @* Component *@ 1420 1421 @helper RenderNotificationMessage(NotificationMessage settings) { 1422 dynamic[] methodParameters = new dynamic[1]; 1423 methodParameters[0] = settings; 1424 MethodInfo customMethod = this.GetType().GetMethod("RenderNotificationMessageCustom"); 1425 1426 if (customMethod != null) 1427 { 1428 @customMethod.Invoke(this, methodParameters).ToString(); 1429 } else { 1430 if (!String.IsNullOrEmpty(settings.Message)) 1431 { 1432 string messageTypeClass = settings.MessageType.ToString().ToLower(); 1433 <div class="field-@messageTypeClass @settings.CssClass u-full-width dw-mod">@settings.Message</div> 1434 } 1435 } 1436 } 1437 @using System.Reflection 1438 @using Dynamicweb.Rapido.Blocks.Components.General 1439 1440 1441 @* Component *@ 1442 1443 @helper RenderHandlebarsRoot(HandlebarsRoot settings) { 1444 dynamic[] methodParameters = new dynamic[1]; 1445 methodParameters[0] = settings; 1446 MethodInfo customMethod = this.GetType().GetMethod("RenderHandlebarsRootCustom"); 1447 1448 if (customMethod != null) 1449 { 1450 @customMethod.Invoke(this, methodParameters).ToString(); 1451 } else { 1452 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : ""; 1453 1454 <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> 1455 @if (settings.SubBlocks != null) { 1456 @RenderBlockList(settings.SubBlocks) 1457 } 1458 </div> 1459 } 1460 } 1461 @using System.Reflection 1462 @using Dynamicweb.Rapido.Blocks.Components.General 1463 @using Dynamicweb.Rapido.Blocks.Components 1464 @using System.Text.RegularExpressions 1465 1466 1467 @* Component *@ 1468 1469 @helper RenderSticker(Sticker settings) { 1470 dynamic[] methodParameters = new dynamic[1]; 1471 methodParameters[0] = settings; 1472 MethodInfo customMethod = this.GetType().GetMethod("RenderStickerCustom"); 1473 1474 if (customMethod != null) 1475 { 1476 @customMethod.Invoke(this, methodParameters).ToString(); 1477 } 1478 else 1479 { 1480 if (!String.IsNullOrEmpty(settings.Title)) { 1481 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : ""; 1482 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : ""; 1483 1484 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 1485 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) { 1486 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : ""; 1487 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : ""; 1488 optionalAttributes.Add("style", styleTag); 1489 } 1490 1491 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div> 1492 } 1493 } 1494 } 1495 1496 @using System.Reflection 1497 @using Dynamicweb.Rapido.Blocks.Components.General 1498 @using Dynamicweb.Rapido.Blocks.Components 1499 1500 1501 @* Component *@ 1502 1503 @helper RenderStickersCollection(StickersCollection settings) { 1504 dynamic[] methodParameters = new dynamic[1]; 1505 methodParameters[0] = settings; 1506 MethodInfo customMethod = this.GetType().GetMethod("RenderStickersCollectionCustom"); 1507 1508 if (customMethod != null) 1509 { 1510 @customMethod.Invoke(this, methodParameters).ToString(); 1511 } 1512 else 1513 { 1514 if (settings.Stickers.Count > 0) { 1515 string position = settings.Position != null ? "" + "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower() : ""; 1516 1517 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1518 @foreach (Sticker sticker in settings.Stickers) 1519 { 1520 @RenderSticker(sticker) 1521 } 1522 </div> 1523 } 1524 } 1525 } 1526 1527 @using System.Reflection 1528 @using Dynamicweb.Rapido.Blocks.Components.General 1529 @using Dynamicweb.Rapido.Blocks.Components 1530 1531 1532 1533 @* Component *@ 1534 1535 @helper RenderField(Field settings) { 1536 dynamic[] methodParameters = new dynamic[1]; 1537 methodParameters[0] = settings; 1538 MethodInfo customMethod = this.GetType().GetMethod("RenderFieldCustom"); 1539 1540 if (customMethod != null) 1541 { 1542 @customMethod.Invoke(this, methodParameters).ToString(); 1543 } else { 1544 switch (settings.FieldType) 1545 { 1546 case FieldType.Checkbox: 1547 CheckboxField checkbox = new CheckboxField 1548 { 1549 Label = settings.Label, 1550 Id = settings.Id, 1551 Name = settings.Label.Replace(" ", ""), 1552 Value = settings.Value, 1553 Checked = Convert.ToBoolean(settings.Placeholder), 1554 OnClick = settings.OnClick, 1555 Disabled = settings.Disabled, 1556 Required = settings.Required, 1557 CssClass = settings.CssClass, 1558 ExtraAttributes = settings.ExtraAttributes, 1559 ErrorMessage = settings.ErrorMessage 1560 }; 1561 1562 @RenderCheckboxField(checkbox) 1563 break; 1564 case FieldType.Email: 1565 TextField emailField = new TextField 1566 { 1567 Label = settings.Label != null ? settings.Label : Translate("Email"), 1568 Id = settings.Id, 1569 Value = settings.Value, 1570 OnClick = settings.OnClick, 1571 Disabled = settings.Disabled, 1572 Required = settings.Required, 1573 CssClass = settings.CssClass, 1574 ExtraAttributes = settings.ExtraAttributes, 1575 ErrorMessage = settings.ErrorMessage, 1576 Placeholder = settings.Placeholder, 1577 Type = TextFieldType.Email 1578 }; 1579 1580 @RenderTextField(emailField) 1581 break; 1582 case FieldType.Hidden: 1583 HiddenField hiddenField = new HiddenField 1584 { 1585 Label = settings.Label, 1586 Id = settings.Id, 1587 Value = settings.Value, 1588 Disabled = settings.Disabled, 1589 Required = settings.Required, 1590 CssClass = settings.CssClass, 1591 ExtraAttributes = settings.ExtraAttributes, 1592 ErrorMessage = settings.ErrorMessage 1593 }; 1594 1595 @RenderHiddenField(hiddenField) 1596 break; 1597 case FieldType.Integer: 1598 NumberField numberField = new NumberField 1599 { 1600 Label = settings.Label, 1601 Id = settings.Id, 1602 Value = settings.Value.GetType() == typeof(int) ? Convert.ToInt32(settings.Value) : 1, 1603 OnClick = settings.OnClick, 1604 Disabled = settings.Disabled, 1605 Required = settings.Required, 1606 CssClass = settings.CssClass, 1607 ExtraAttributes = settings.ExtraAttributes, 1608 ErrorMessage = settings.ErrorMessage, 1609 Step = 1 1610 }; 1611 1612 @RenderNumberField(numberField) 1613 break; 1614 case FieldType.Password: 1615 TextField passwordField = new TextField 1616 { 1617 Label = settings.Label != null ? settings.Label : Translate("Password"), 1618 Id = settings.Id, 1619 Value = settings.Value, 1620 OnClick = settings.OnClick, 1621 Disabled = settings.Disabled, 1622 Required = settings.Required, 1623 CssClass = settings.CssClass, 1624 ExtraAttributes = settings.ExtraAttributes, 1625 ErrorMessage = settings.ErrorMessage, 1626 Placeholder = settings.Placeholder, 1627 Type = TextFieldType.Password 1628 }; 1629 1630 @RenderTextField(passwordField) 1631 break; 1632 case FieldType.Reset: 1633 Button resetField = new Button 1634 { 1635 Title = settings.Label != null ? settings.Label : Translate("Reset"), 1636 Id = settings.Id, 1637 OnClick = settings.OnClick, 1638 Disabled = settings.Disabled, 1639 CssClass = settings.CssClass, 1640 ExtraAttributes = settings.ExtraAttributes, 1641 ButtonLayout = ButtonLayout.Secondary, 1642 ButtonType = ButtonType.Reset 1643 }; 1644 1645 @RenderButton(resetField) 1646 break; 1647 case FieldType.Submit: 1648 Button submitField = new Button 1649 { 1650 Title = settings.Label != null ? settings.Label : Translate("Submit"), 1651 Id = settings.Id, 1652 OnClick = settings.OnClick, 1653 Disabled = settings.Disabled, 1654 CssClass = settings.CssClass, 1655 ExtraAttributes = settings.ExtraAttributes, 1656 ButtonLayout = ButtonLayout.Primary, 1657 ButtonType = ButtonType.Submit 1658 }; 1659 1660 @RenderButton(submitField) 1661 break; 1662 case FieldType.Tel: 1663 TextField telField = new TextField 1664 { 1665 Label = settings.Label != null ? settings.Label : Translate("Phone"), 1666 Id = settings.Id, 1667 Value = settings.Value, 1668 OnClick = settings.OnClick, 1669 Disabled = settings.Disabled, 1670 Required = settings.Required, 1671 CssClass = settings.CssClass, 1672 ExtraAttributes = settings.ExtraAttributes, 1673 ErrorMessage = settings.ErrorMessage, 1674 Placeholder = settings.Placeholder, 1675 Type = TextFieldType.Tel 1676 }; 1677 1678 @RenderTextField(telField) 1679 break; 1680 case FieldType.Text: 1681 TextField textField = new TextField 1682 { 1683 Label = settings.Label, 1684 Id = settings.Id, 1685 Value = settings.Value, 1686 OnClick = settings.OnClick, 1687 Disabled = settings.Disabled, 1688 Required = settings.Required, 1689 CssClass = settings.CssClass, 1690 ExtraAttributes = settings.ExtraAttributes, 1691 ErrorMessage = settings.ErrorMessage, 1692 Placeholder = settings.Placeholder, 1693 Type = TextFieldType.Text 1694 }; 1695 1696 @RenderTextField(textField) 1697 break; 1698 case FieldType.Textarea: 1699 TextareaField textareaField = new TextareaField 1700 { 1701 Label = settings.Label, 1702 Id = settings.Id, 1703 Value = settings.Value, 1704 OnClick = settings.OnClick, 1705 Disabled = settings.Disabled, 1706 Required = settings.Required, 1707 CssClass = settings.CssClass, 1708 ExtraAttributes = settings.ExtraAttributes, 1709 ErrorMessage = settings.ErrorMessage, 1710 Placeholder = settings.Placeholder 1711 }; 1712 1713 @RenderTextareaField(textareaField) 1714 break; 1715 default: 1716 TextField defaultField = new TextField 1717 { 1718 Label = settings.Label, 1719 Id = settings.Id, 1720 Value = settings.Value, 1721 OnClick = settings.OnClick, 1722 Disabled = settings.Disabled, 1723 Required = settings.Required, 1724 CssClass = settings.CssClass, 1725 ExtraAttributes = settings.ExtraAttributes, 1726 ErrorMessage = settings.ErrorMessage, 1727 Placeholder = settings.Placeholder, 1728 Type = TextFieldType.Text 1729 }; 1730 1731 @RenderTextField(defaultField) 1732 break; 1733 } 1734 } 1735 } 1736 1737 1738 @using Dynamicweb.Frontend 1739 @using System.Reflection 1740 @using Dynamicweb.Content.Items 1741 @using System.Web.UI.HtmlControls 1742 @using Dynamicweb.Rapido.Blocks.Components 1743 @using Dynamicweb.Rapido.Blocks 1744 1745 1746 @* Components for the articles - Remeber to make a NZ copy of this template - and change line NZheader.cshtml to [Include file 'NZHeader.cshtml' not found in 'Templates/Designs/Rapido/Components/ArticleComponents.cshtml'] *@ 1747 @using System.Reflection 1748 @using Dynamicweb.Rapido.Blocks.Components.Articles 1749 @using System.Text.RegularExpressions 1750 1751 1752 @* Component for the articles *@ 1753 1754 @helper RenderArticleBanner(dynamic settings) 1755 { 1756 string headline = settings.Heading; 1757 //Video 1758 //getting video ID from youtube URL 1759 string videoCode = ""; 1760 var userAgent = HttpContext.Current.Request.UserAgent.ToString(); 1761 1762 bool ie9String = userAgent.Contains("Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"); 1763 bool ie10String = userAgent.Contains("Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)"); 1764 bool ie11String = userAgent.Contains("Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko"); 1765 Regex regex = new Regex(@".be\/(.[^?]*)"); 1766 Match match = regex.Match(videoCode); 1767 1768 string videoId = ""; 1769 if (match.Success) 1770 { 1771 videoId = match.Groups[1].Value; 1772 } 1773 else 1774 { 1775 regex = new Regex(@"v=([^&]+)"); 1776 match = regex.Match(videoCode); 1777 if (match.Success) 1778 { 1779 videoId = match.Groups[1].Value; 1780 } 1781 } 1782 1783 string heroHeight = string.IsNullOrEmpty(videoCode) ? "heroheight" : ""; 1784 1785 string placeHolderImage = "/Files/Images/placeholder.gif"; 1786 string backgroundImage = ""; 1787 string backgroundImageLarge = ""; 1788 string backgroundImageMedium = ""; 1789 string backgroundImageSmall = ""; 1790 int backgroundImageWidth = 2500; 1791 int backgroundImageLargeWidth = 1440; 1792 int backgroundImageMediumWidth = 1300; 1793 int backgroundImageSmallWidth = 1024; 1794 1795 if (settings.Image != null) 1796 { 1797 string focalPointParameters = settings.Image.Path != null ? "&" + settings.Image.Path.GetFocalPointParameters() : ""; 1798 backgroundImage = "/Admin/Public/GetImage.ashx?width=" + backgroundImageWidth + "&amp;height=1100&amp;crop=7" + "&amp;Compression=85&amp;DoNotUpscale=true&amp;image=" + settings.Image.Path + focalPointParameters; 1799 backgroundImageLarge = "/Admin/Public/GetImage.ashx?width=" + backgroundImageLargeWidth + "&amp;height=370&amp;crop=7" + "&amp;Compression=85&amp;DoNotUpscale=true&amp;image=" + settings.Image.Path + focalPointParameters; 1800 backgroundImageMedium = "/Admin/Public/GetImage.ashx?width=" + backgroundImageMediumWidth + "&amp;height=572&amp;crop=7" + "&amp;Compression=85&amp;DoNotUpscale=true&amp;image=" + settings.Image.Path + focalPointParameters; 1801 backgroundImageSmall = "/Admin/Public/GetImage.ashx?width=" + backgroundImageSmallWidth + "&amp;height=450&amp;crop=7" + "&amp;Compression=85&amp;DoNotUpscale=true&amp;image=" + settings.Image.Path + focalPointParameters; 1802 } 1803 1804 string imageAlt = ""; 1805 imageAlt = settings.Image.Path.ToString(); 1806 1807 dynamic[] methodParameters = new dynamic[1]; 1808 methodParameters[0] = settings; 1809 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerCustom"); 1810 1811 var ieClass = ie10String || ie9String || ie11String ? "ie-hero" : ""; 1812 1813 if (customMethod != null) 1814 { 1815 @customMethod.Invoke(this, methodParameters).ToString(); 1816 } 1817 else 1818 { 1819 settings.Layout = ArticleHeaderLayout.Banner; 1820 1821 if (settings.Image != null) 1822 { 1823 if (settings.Image.Path != null) 1824 { 1825 <div class="grid__col-md-12 grid__col--bleed u-padding-bottom--lg"> 1826 <section class="@ieClass hero multiple-paragraphs-container paragraph-container grid--justify-center"> 1827 <div class="background-image image-filter"> 1828 <div class="background-image__wrapper image-filter"> 1829 <img class="background-image__cover dw-mod b-lazy" src="@placeHolderImage" data-src="@backgroundImage" data-src-small="@backgroundImageSmall" data-src-medium="@backgroundImageMedium" data-src-large="@backgroundImageLarge" alt="@imageAlt"> 1830 @if (!string.IsNullOrEmpty(videoCode)) 1831 { 1832 1833 <div class="video-background"> 1834 <div class="video-background__container"> 1835 <div class="js-youtube-video" data-video="@videoCode" id="ytPlayer"></div> 1836 </div> 1837 </div> 1838 } 1839 </div> 1840 </div> 1841 <div class="grid paragraph-container--height-xl @heroHeight grid--justify-center dw-mod"> 1842 <div class="grid__col-sm-12 grid__col-xs-12 paragraph-container dw-mod grid--justify-center "> 1843 </div> 1844 </div> 1845 @if (ie10String || ie9String || ie11String) 1846 { 1847 <svg class="ie-svg-header-without-text" width="1440px" height="203px" viewBox="0 0 1440 203" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> 1848 <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> 1849 <g id="shop_forside_1" transform="translate(0.000000, -376.000000)" fill="#FFFFFF"> 1850 <path d="M0,578.015878 L1440,578.015878 C1885.14583,319.758548 1885.14583,252.418132 1440,375.994629 C994.854167,499.571126 514.854167,566.911543 0,578.015878 Z" id="Path"></path> 1851 </g> 1852 </g> 1853 </svg> 1854 } 1855 1856 else 1857 { 1858 <svg width="1440px" height="203px" viewBox="0 0 1440 203" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> 1859 <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> 1860 <g id="shop_forside_1" transform="translate(0.000000, -376.000000)" fill="#FFFFFF"> 1861 <path d="M0,578.015878 L1440,578.015878 C1885.14583,319.758548 1885.14583,252.418132 1440,375.994629 C994.854167,499.571126 514.854167,566.911543 0,578.015878 Z" id="Path"></path> 1862 </g> 1863 </g> 1864 </svg> 1865 } 1866 </section> 1867 </div> 1868 } 1869 else 1870 { 1871 settings.Layout = ArticleHeaderLayout.Clean; 1872 @RenderArticleCleanHeader(settings); 1873 } 1874 } 1875 else 1876 { 1877 settings.Layout = ArticleHeaderLayout.Clean; 1878 @RenderArticleCleanHeader(settings); 1879 } 1880 1881 if (!String.IsNullOrEmpty(headline)) 1882 { 1883 <h1 class="article__leadtext dw-mod grid-custom-layout-third">@headline</h1> 1884 1885 } 1886 } 1887 } 1888 @using System.Reflection 1889 @using Dynamicweb.Frontend 1890 @using Dynamicweb.Rapido.Blocks.Components 1891 @using Dynamicweb.Rapido.Blocks.Components.General 1892 @using Dynamicweb.Rapido.Blocks.Components.Articles 1893 @using Dynamicweb.Rapido.Blocks 1894 @using S_DW_HD2412.CustomCode 1895 1896 1897 1898 @* Component for the articles *@ 1899 1900 @helper RenderArticleHeaderExtended(ArticleHeaderExtended settings) 1901 { 1902 dynamic[] methodParameters = new dynamic[1]; 1903 methodParameters[0] = settings; 1904 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleHeaderCustom"); 1905 1906 if (customMethod != null) 1907 { 1908 @customMethod.Invoke(this, methodParameters).ToString(); 1909 } 1910 else 1911 { 1912 switch (settings.Layout) 1913 { 1914 case ArticleHeaderLayout.Clean: 1915 @RenderArticleCleanHeader(settings); 1916 break; 1917 case ArticleHeaderLayout.Split: 1918 @RenderArticleSplitHeader(settings); 1919 break; 1920 case ArticleHeaderLayout.Banner: 1921 @RenderArticleBannerHeader(settings); 1922 break; 1923 case ArticleHeaderLayout.Overlay: 1924 @RenderArticleOverlayHeader(settings); 1925 break; 1926 default: 1927 @RenderArticleCleanHeader(settings); 1928 break; 1929 } 1930 } 1931 } 1932 1933 @helper RenderArticleCleanHeader(ArticleHeader settings) 1934 { 1935 dynamic[] methodParameters = new dynamic[1]; 1936 methodParameters[0] = settings; 1937 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom"); 1938 1939 if (customMethod != null) 1940 { 1941 @customMethod.Invoke(this, methodParameters).ToString(); 1942 } 1943 else 1944 { 1945 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 1946 1947 <div class="grid grid--align-content-start grid--justify-start"> 1948 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod"> 1949 1950 1951 <div class="grid__cell"> 1952 @if (settings.Image != null) 1953 { 1954 if (settings.Image.Path != null) 1955 { 1956 <div class="u-padding-bottom--lg"> 1957 @RenderImage(settings.Image) 1958 </div> 1959 1960 } 1961 } 1962 1963 @if (!String.IsNullOrEmpty(settings.Heading)) 1964 { 1965 1966 //Check to hide heading if the item is not a Dynamic Article 1967 var ItemName = PageView.Current().Item.SystemName; 1968 1969 if (ItemName == "DynamicArticle") 1970 { 1971 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 1972 } 1973 1974 else 1975 { 1976 } 1977 1978 } 1979 1980 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0) 1981 { 1982 <div class="u-padding-bottom"> 1983 @*@if (!String.IsNullOrEmpty(settings.Category)) 1984 { 1985 <div class="u-pull--left"> 1986 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 1987 </div> 1988 }*@ 1989 <div class=""> 1990 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1991 { 1992 <small class="article__post-info dw-mod">@Translate("Author"): @settings.Author, @settings.Date</small> 1993 } 1994 @*@if (settings.RatingOutOf != 0) 1995 { 1996 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 1997 }*@ 1998 </div> 1999 </div> 2000 2001 } 2002 2003 @if (!String.IsNullOrEmpty(settings.Subheading)) 2004 { 2005 <div class="article__leadtext news-article-leadtext dw-mod">@settings.Subheading</div> 2006 } 2007 @if (!String.IsNullOrEmpty(settings.Link)) 2008 { 2009 <div class="grid__cell"> 2010 @RenderButton(new Button { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2011 </div> 2012 } 2013 </div> 2014 </div> 2015 @if (settings.ExternalParagraphId != 0) 2016 { 2017 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod"> 2018 @RenderParagraphContent(settings.ExternalParagraphId) 2019 </div> 2020 } 2021 </div> 2022 } 2023 } 2024 2025 @helper RenderArticleSplitHeader(ArticleHeader settings) 2026 { 2027 dynamic[] methodParameters = new dynamic[1]; 2028 methodParameters[0] = settings; 2029 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSplitHeaderCustom"); 2030 2031 if (customMethod != null) 2032 { 2033 @customMethod.Invoke(this, methodParameters).ToString(); 2034 } 2035 else 2036 { 2037 string headerColumnWidth = settings.ExternalParagraphId != 0 ? "4" : "6"; 2038 2039 if (settings.Image != null) 2040 { 2041 if (settings.Image.Path != null) 2042 { 2043 <section class="multiple-paragraphs-container paragraph-container--full-width"> 2044 <div class="grid"> 2045 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod"> 2046 <div class="u-left-middle u-padding--lg"> 2047 <div> 2048 @if (!String.IsNullOrEmpty(settings.Category)) 2049 { 2050 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 2051 } 2052 @if (!String.IsNullOrEmpty(settings.Heading)) 2053 { 2054 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 2055 } 2056 @if (!String.IsNullOrEmpty(settings.Subheading)) 2057 { 2058 <div class="article__leadtext dw-mod">@settings.Subheading</div> 2059 } 2060 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2061 { 2062 <small class="article__post-info u-pull--left dw-mod">@settings.Author @settings.Date</small> 2063 } 2064 @if (settings.RatingOutOf != 0) 2065 { 2066 <div class="u-pull--right"> 2067 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 2068 </div> 2069 } 2070 @if (!String.IsNullOrEmpty(settings.Link)) 2071 { 2072 @RenderButton(new Button { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2073 } 2074 </div> 2075 </div> 2076 </div> 2077 <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> 2078 @if (settings.ExternalParagraphId != 0) 2079 { 2080 <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"> 2081 @RenderParagraphContent(settings.ExternalParagraphId) 2082 </div> 2083 } 2084 </div> 2085 </section> 2086 } 2087 } 2088 else 2089 { 2090 @RenderArticleCleanHeader(settings); 2091 } 2092 } 2093 } 2094 2095 @helper RenderArticleOverlayHeader(ArticleHeader settings) 2096 { 2097 dynamic[] methodParameters = new dynamic[1]; 2098 methodParameters[0] = settings; 2099 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleOverlayHeaderCustom"); 2100 2101 if (customMethod != null) 2102 { 2103 @customMethod.Invoke(this, methodParameters).ToString(); 2104 } 2105 else 2106 { 2107 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 2108 string contentAlignment = settings.TextLayout == ArticleHeaderTextLayout.Center ? "grid--justify-center" : ""; 2109 2110 if (settings.Image != null) 2111 { 2112 if (settings.Image.Path != null) 2113 { 2114 if (settings.ExternalParagraphId == 0) 2115 { 2116 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> 2117 <div class="background-image image-filter image-filter--darken dw-mod"> 2118 <div class="background-image__wrapper image-filter image-filter--darken dw-mod"> 2119 @{ 2120 settings.Image.CssClass += "background-image__cover dw-mod"; 2121 } 2122 @RenderImage(settings.Image) 2123 </div> 2124 </div> 2125 <div class="center-container dw-mod"> 2126 <div class="grid @contentAlignment"> 2127 <div class="grid__col-md-@contentColumns grid__col-xs-12 paragraph-container paragraph-container--height-xl u-no-padding dw-mod"> 2128 @if (!String.IsNullOrEmpty(settings.Heading)) 2129 { 2130 <h1 class="article__header article__header--giant u-padding-top--lg dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> 2131 } 2132 @if (!String.IsNullOrEmpty(settings.Subheading)) 2133 { 2134 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> 2135 } 2136 <div class="u-margin-top"> 2137 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2138 { 2139 <small class="article__post-info u-pull--left dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> 2140 } 2141 @if (settings.RatingOutOf != 0) 2142 { 2143 <div class="u-pull--right"> 2144 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 2145 </div> 2146 } 2147 </div> 2148 @if (!String.IsNullOrEmpty(settings.Link)) 2149 { 2150 <div class="grid__cell"> 2151 @RenderButtonExtended(new ButtonExtended { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2152 </div> 2153 } 2154 </div> 2155 </div> 2156 </div> 2157 </section> 2158 } 2159 else 2160 { 2161 @RenderArticleBanner(settings); 2162 } 2163 } 2164 } 2165 else 2166 { 2167 @RenderArticleCleanHeader(settings); 2168 } 2169 } 2170 } 2171 2172 @helper RenderArticleBannerHeader(dynamic settings) 2173 { 2174 dynamic[] methodParameters = new dynamic[1]; 2175 methodParameters[0] = settings; 2176 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerHeaderCustom"); 2177 2178 if (customMethod != null) 2179 { 2180 @customMethod.Invoke(this, methodParameters).ToString(); 2181 } 2182 else 2183 { 2184 @RenderArticleBanner(settings); 2185 } 2186 } 2187 2188 2189 @using System.Reflection 2190 @using System.Text.RegularExpressions; 2191 @using Dynamicweb.Frontend 2192 @using Dynamicweb.Content.Items 2193 @using Dynamicweb.Rapido.Blocks.Components 2194 @using Dynamicweb.Rapido.Blocks.Components.Articles 2195 @using Dynamicweb.Rapido.Blocks 2196 2197 @* Component for the articles *@ 2198 2199 @helper RenderArticleBodyRow(ArticleBodyRow settings) 2200 { 2201 dynamic[] methodParameters = new dynamic[1]; 2202 methodParameters[0] = settings; 2203 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBodyRowCustom"); 2204 2205 if (customMethod != null) 2206 { 2207 @customMethod.Invoke(this, methodParameters).ToString(); 2208 } else { 2209 string position = settings.TopLayout == "overlay" ? "article__overlay-offset" : ""; 2210 string contentAlignment = settings.TextLayout == "center" ? "grid--justify-center" : ""; 2211 2212 <div class="grid grid--align-content-start @contentAlignment @position dw-mod"> 2213 @RenderBlockList(settings.SubBlocks) 2214 </div> 2215 } 2216 } 2217 @using System.Reflection 2218 @using Dynamicweb.Rapido.Blocks.Components 2219 @using Dynamicweb.Rapido.Blocks.Components.General 2220 @using Dynamicweb.Rapido.Blocks.Components.Articles 2221 @using Dynamicweb.Rapido.Blocks 2222 2223 @* Component for the articles *@ 2224 2225 @helper RenderArticleImage(ArticleImage settings) 2226 { 2227 dynamic[] methodParameters = new dynamic[1]; 2228 methodParameters[0] = settings; 2229 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleImageCustom"); 2230 2231 if (customMethod != null) 2232 { 2233 @customMethod.Invoke(this, methodParameters).ToString(); 2234 } 2235 else 2236 { 2237 if (settings.Image != null) 2238 { 2239 if (settings.Image.Path != null) 2240 { 2241 <div class="u-margin-bottom--lg"> 2242 @RenderImage(settings.Image) 2243 </div> 2244 } 2245 } 2246 } 2247 } 2248 @using System.Reflection 2249 @using Dynamicweb.Rapido.Blocks.Components 2250 @using Dynamicweb.Rapido.Blocks.Components.Articles 2251 2252 2253 @* Component for the articles *@ 2254 2255 @helper RenderArticleSubHeader(ArticleSubHeader settings) 2256 { 2257 dynamic[] methodParameters = new dynamic[1]; 2258 methodParameters[0] = settings; 2259 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSubHeaderCustom"); 2260 2261 if (customMethod != null) 2262 { 2263 @customMethod.Invoke(this, methodParameters).ToString(); 2264 } else { 2265 if (!String.IsNullOrEmpty(settings.Title)) 2266 { 2267 <h2 class="article__header">@settings.Title</h2> 2268 } 2269 } 2270 } 2271 @using System.Reflection 2272 @using Dynamicweb.Rapido.Blocks.Components 2273 @using Dynamicweb.Rapido.Blocks.Components.Articles 2274 @using Dynamicweb.Rapido.Blocks 2275 2276 2277 @* Component for the articles *@ 2278 2279 @helper RenderArticleText(ArticleText settings) 2280 { 2281 dynamic[] methodParameters = new dynamic[1]; 2282 methodParameters[0] = settings; 2283 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleTextCustom"); 2284 2285 if (customMethod != null) 2286 { 2287 @customMethod.Invoke(this, methodParameters).ToString(); 2288 } else { 2289 if (!String.IsNullOrEmpty(settings.Text)) 2290 { 2291 string greatTextClass = settings.EnableLargeText == true ? "article__paragraph--great-text" : ""; 2292 2293 <div class="article__paragraph @greatTextClass"> 2294 @settings.Text 2295 </div> 2296 } 2297 } 2298 } 2299 @using System.Reflection 2300 @using Dynamicweb.Rapido.Blocks.Components 2301 @using Dynamicweb.Rapido.Blocks.Components.Articles 2302 @using Dynamicweb.Rapido.Blocks 2303 2304 2305 @* Component for the articles - REMEMBER TO MAKE NZ COPY OF THIS AND REFERENCE IT IN DYNAMICLISTPAGE.CSHTML *@ 2306 2307 @helper RenderArticleQuote(ArticleQuote settings) 2308 { 2309 dynamic[] methodParameters = new dynamic[1]; 2310 methodParameters[0] = settings; 2311 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleQuoteCustom"); 2312 2313 if (customMethod != null) 2314 { 2315 @customMethod.Invoke(this, methodParameters).ToString(); 2316 } else { 2317 string text = Regex.Replace(settings.Text, "<.*?>", String.Empty); 2318 2319 <div class="grid u-padding-bottom--lg"> 2320 @if (settings.Image != null) 2321 { 2322 if (settings.Image.Path != null) { 2323 <div class="grid__col-md-3 grid__col-12"> 2324 <div class="grid__cell-img"> 2325 @{ 2326 settings.Image.Title = !String.IsNullOrEmpty(settings.Image.Title) ? settings.Image.Title : settings.Author; 2327 settings.Image.CssClass += " article__image article__image--square"; 2328 settings.Image.ImageDefault.Width = 200; 2329 settings.Image.ImageDefault.Height = 200; 2330 } 2331 @RenderImage(settings.Image) 2332 </div> 2333 </div> 2334 } 2335 } 2336 <div class="grid__col-auto"> 2337 <div class="custombackground"> 2338 @if (!String.IsNullOrEmpty(settings.Text)) 2339 { 2340 <div class="article__quote dw-mod"> 2341 @settings.Text 2342 </div> 2343 } 2344 @if (!String.IsNullOrEmpty(settings.Author)) 2345 { 2346 <div class="article__quote-author dw-mod"> 2347 - @settings.Author 2348 </div> 2349 } 2350 </div> 2351 </div> 2352 </div> 2353 } 2354 } 2355 @using System.Reflection 2356 @using Dynamicweb.Rapido.Blocks.Components 2357 @using Dynamicweb.Rapido.Blocks.Components.Articles 2358 @using Dynamicweb.Rapido.Blocks 2359 2360 @* Component for the articles *@ 2361 2362 @helper RenderArticleInfoTable(ArticleInfoTable settings) 2363 { 2364 dynamic[] methodParameters = new dynamic[1]; 2365 methodParameters[0] = settings; 2366 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleInfoTableCustom"); 2367 2368 if (customMethod != null) 2369 { 2370 @customMethod.Invoke(this, methodParameters).ToString(); 2371 } else { 2372 <h3>@Translate("Facts")</h3> 2373 <table class="table table--clean"> 2374 @foreach (var row in settings.Rows) 2375 { 2376 string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two"; 2377 2378 <tr> 2379 @if (!String.IsNullOrEmpty(row.Icon)) 2380 { 2381 <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td> 2382 } 2383 <td class="u-no-margin-on-p-elements"> 2384 <div class="u-bold">@row.Title</div> 2385 @if (!String.IsNullOrEmpty(row.SubTitle)) 2386 { 2387 if (row.Link == null) 2388 { 2389 <div>@row.SubTitle</div> 2390 } 2391 else 2392 { 2393 <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a> 2394 } 2395 } 2396 </td> 2397 </tr> 2398 } 2399 </table> 2400 } 2401 } 2402 @using System.Reflection 2403 @using Dynamicweb.Rapido.Blocks.Components 2404 @using Dynamicweb.Rapido.Blocks.Components.Articles 2405 @using Dynamicweb.Rapido.Blocks 2406 2407 @* Component for the articles *@ 2408 2409 @helper RenderArticleGalleryModal(ArticleGalleryModal settings) 2410 { 2411 dynamic[] methodParameters = new dynamic[1]; 2412 methodParameters[0] = settings; 2413 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 2414 2415 if (customMethod != null) 2416 { 2417 @customMethod.Invoke(this, methodParameters).ToString(); 2418 } 2419 else 2420 { 2421 <input type="checkbox" id="ParagraphGalleryTrigger" class="modal-trigger" /> 2422 <div class="modal-container"> 2423 <label for="ParagraphGalleryTrigger" id="ParagraphGalleryOverlay" class="modal-overlay"></label> 2424 <div class="modal modal--full" id="ParagraphGallery"> 2425 <div class="modal__body modal__body--full"> 2426 <img src="/Files/Images/placeholder.gif" alt="" id="ParagraphGalleryModalImage" style="margin: 0 auto;" /> 2427 <div class="u-padding u-ta-center" id="ParagraphGalleryModalCaption"></div> 2428 <label class="modal__close-btn dw-mod" for="ParagraphGalleryTrigger"></label> 2429 </div> 2430 </div> 2431 </div> 2432 <script> 2433 function showImageInModal(image) { 2434 let imageNode = document.getElementById('ParagraphGalleryModalImage'); 2435 let captionNode = document.getElementById('ParagraphGalleryModalCaption'); 2436 let trigger = document.getElementById('ParagraphGalleryTrigger'); 2437 imageNode.src = image.src; 2438 if (image.alt != "") { 2439 captionNode.innerText = image.alt; 2440 imageNode.alt = image.alt; 2441 captionNode.style.display = "block"; 2442 } else { 2443 captionNode.style.display = "none"; 2444 } 2445 trigger.checked = true; 2446 } 2447 </script> 2448 } 2449 } 2450 @using System.Reflection 2451 @using Dynamicweb.Rapido.Blocks.Components 2452 @using Dynamicweb.Rapido.Blocks.Components.Articles 2453 @using Dynamicweb.Rapido.Blocks 2454 2455 2456 @* Component for the articles *@ 2457 2458 @helper RenderArticleRelated(ArticleRelated settings) 2459 { 2460 string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : ""; 2461 string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : ""; 2462 2463 <section class="multiple-paragraphs-container related-articles-container paragraph-container--full-width"> 2464 <div class="center-container dw-mod"> 2465 <div class="grid u-padding u-margin-bottom--lg"> 2466 <div class="grid__col-md-12 grid__col-xs-12 u-margin-bottom--lg"> 2467 <h2 class="article__header related-header u-no-margin u-margin-top dw-mod">@Translate("Andre relevante nyheder")</h2> 2468 </div> 2469 </div> 2470 2471 <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> 2472 2473 <script id="RelatedSimpleTemplate" type="text/x-template"> 2474 {{#.}} 2475 <div class="grid u-padding-bottom--lg"> 2476 {{#Cases}} 2477 <div class="grid__col-md-3 grid__col-12 image-hover--zoom dw-mod"> 2478 <a href="{{link}}" class="u-full-height related-articles-container"> 2479 {{#if image}} 2480 <div class="u-color-light--bg u-no-padding dw-mod"> 2481 <div class="flex-img image-hover__wrapper"> 2482 <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}}" /> 2483 </div> 2484 </div> 2485 {{/if}} 2486 2487 <div class="card related-articles-container article-content-container dw-mod"> 2488 <p class="article__post-info dw-mod">{{date}}</p> 2489 <h3 class="article-list__item-header u-color-dark dw-mod">{{title}}</h3> 2490 @*<p class="article__short-summary dw-mod">{{summary}}</p>*@ 2491 </div> 2492 </a> 2493 </div> 2494 {{/Cases}} 2495 </div> 2496 {{/.}} 2497 </script> 2498 </div> 2499 </section> 2500 } 2501 @using System.Reflection 2502 @using Dynamicweb.Rapido.Blocks.Components 2503 @using Dynamicweb.Rapido.Blocks.Components.Articles 2504 @using Dynamicweb.Rapido.Blocks 2505 2506 2507 @* Component for the articles *@ 2508 2509 @helper RenderArticleMenu(ArticleMenu settings) 2510 { 2511 dynamic[] methodParameters = new dynamic[1]; 2512 methodParameters[0] = settings; 2513 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleMenuCustom"); 2514 2515 if (customMethod != null) 2516 { 2517 @customMethod.Invoke(this, methodParameters).ToString(); 2518 } else { 2519 if (!String.IsNullOrEmpty(settings.Title)) { 2520 <div class="u-margin u-border-bottom"> 2521 <h3 class="u-no-margin">@settings.Title</h3> 2522 </div> 2523 } 2524 2525 <ul class="menu-left u-margin-bottom dw-mod"> 2526 @foreach (var item in settings.Items) 2527 { 2528 @RenderArticleMenuItem(item) 2529 } 2530 </ul> 2531 } 2532 } 2533 2534 @helper RenderArticleMenuItem(ArticleMenuItem settings) 2535 { 2536 dynamic[] methodParameters = new dynamic[1]; 2537 methodParameters[0] = settings; 2538 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleMenuItemCustom"); 2539 2540 if (customMethod != null) 2541 { 2542 @customMethod.Invoke(this, methodParameters).ToString(); 2543 } else { 2544 string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#"; 2545 2546 if (!String.IsNullOrEmpty(settings.Title)) { 2547 <li class="menu-left__item dw-mod"> 2548 <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a> 2549 </li> 2550 } 2551 } 2552 } 2553 @using System.Reflection 2554 @using Dynamicweb.Rapido.Blocks.Components 2555 @using Dynamicweb.Rapido.Blocks.Components.Articles 2556 @using Dynamicweb.Rapido.Blocks 2557 2558 @* Component for the articles *@ 2559 2560 @helper RenderArticleList(ArticleList settings) 2561 { 2562 dynamic[] methodParameters = new dynamic[1]; 2563 methodParameters[0] = settings; 2564 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListCustom"); 2565 2566 if (customMethod != null) 2567 { 2568 @customMethod.Invoke(this, methodParameters).ToString(); 2569 } else { 2570 if (Pageview != null) 2571 { 2572 bool isParagraph = Pageview.CurrentParagraph != null ? true : false; 2573 string[] sortArticlesListBy = new string[2]; 2574 2575 if (isParagraph) { 2576 sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2577 } 2578 else { 2579 sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2580 } 2581 2582 string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString(); 2583 2584 @RenderItemList(new 2585 { 2586 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle", 2587 ListSourceType = settings.SourceType, 2588 ListSourcePage = sourcePage, 2589 ItemFieldsList = "*", 2590 Filter = settings.Filter, 2591 ListOrderBy = sortArticlesListBy[0], 2592 ListOrderByDirection = sortArticlesListBy[1], 2593 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date", 2594 ListSecondOrderByDirection = "ASC", 2595 IncludeAllChildItems = true, 2596 ListTemplate = settings.Template, 2597 ListPageSize = settings.PageSize.ToString() 2598 }); 2599 } 2600 } 2601 } 2602 @using System.Reflection 2603 @using Dynamicweb.Rapido.Blocks.Components.Articles 2604 2605 2606 @* Component for the articles *@ 2607 2608 @helper RenderArticleSummary(ArticleSummary settings) 2609 { 2610 dynamic[] methodParameters = new dynamic[1]; 2611 methodParameters[0] = settings; 2612 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSummaryCustom"); 2613 2614 if (customMethod != null) 2615 { 2616 @customMethod.Invoke(this, methodParameters).ToString(); 2617 } else { 2618 if (!String.IsNullOrEmpty(settings.Text)) 2619 { 2620 <div class="article__summary dw-mod">@settings.Text</div> 2621 } 2622 } 2623 } 2624 @using System.Reflection 2625 @using Dynamicweb.Rapido.Blocks.Components 2626 @using Dynamicweb.Rapido.Blocks.Components.Articles 2627 @using Dynamicweb.Rapido.Blocks 2628 2629 @* Component for the articles *@ 2630 2631 @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings) 2632 { 2633 dynamic[] methodParameters = new dynamic[1]; 2634 methodParameters[0] = settings; 2635 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListCategoryFilterCustom"); 2636 2637 if (customMethod != null) 2638 { 2639 @customMethod.Invoke(this, methodParameters).ToString(); 2640 } else { 2641 string pageId = Pageview.ID.ToString(); 2642 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All"); 2643 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2644 2645 foreach (var option in settings.Categories) 2646 { 2647 selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter; 2648 } 2649 2650 if (selectedFilter == pageId) 2651 { 2652 selectedFilter = Translate("All"); 2653 } 2654 2655 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2656 { 2657 <div class="u-pull--right u-margin-left"> 2658 <div class="collection u-no-margin"> 2659 <h5>@Translate("Category")</h5> 2660 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2661 <div class="dropdown u-w180px dw-mod"> 2662 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 2663 <div class="dropdown__content dw-mod"> 2664 @foreach (var option in settings.Categories) 2665 { 2666 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 2667 } 2668 </div> 2669 <label class="dropdown-trigger-off" for="CategorySelector"></label> 2670 </div> 2671 </div> 2672 </div> 2673 } 2674 else 2675 { 2676 <div class="u-full-width u-margin-bottom"> 2677 <h5 class="u-no-margin">@Translate("Category")</h5> 2678 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2679 <div class="dropdown u-full-width dw-mod"> 2680 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 2681 <div class="dropdown__content dw-mod"> 2682 @foreach (var option in settings.Categories) 2683 { 2684 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 2685 } 2686 </div> 2687 <label class="dropdown-trigger-off" for="CategorySelector"></label> 2688 </div> 2689 </div> 2690 } 2691 } 2692 } 2693 @using System.Reflection 2694 @using System.Web.Mvc 2695 @using Dynamicweb.Environment 2696 @using Dynamicweb.Rapido.Blocks.Components 2697 @using Dynamicweb.Rapido.Blocks.Components.Articles 2698 @using Dynamicweb.Rapido.Blocks 2699 2700 @* Component for the articles *@ 2701 2702 @helper RenderArticleListFilter(ArticleListFilter settings) 2703 { 2704 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All"); 2705 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2706 2707 if (settings.Options != null) 2708 { 2709 foreach (var option in settings.Options) 2710 { 2711 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter; 2712 } 2713 2714 @*DESKTOP*@ 2715 2716 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2717 { 2718 <div class="grid"> 2719 <div class="grid__col-12 paragraph-container customlist"> 2720 2721 <section class="grid__col-12" id="custom-facets-overall-container"> 2722 2723 <input type="checkbox" id="CheckFacetGroups" class="js-remember-state u-hidden" data-expand="CheckFacetGroups" /> 2724 <div class="grid grid--external-bleed-x facets-container facets-container--top expandable--collapsed grid--justify-center dw-mod" id="mobile-custom-facets-container" data-trigger="CheckFacetGroups"> 2725 <div class="grid__col-12"> 2726 2727 <input type="checkbox" id="OptionsGroup_{{name}}" class="expand-trigger js-remember-state mobile-facet-input" {{defaultState}} /> 2728 2729 <div class="grid__col-12 expand-container facets-container__box custom-expand-container dw-mod js-filter"> 2730 <label class="grid--justify-center expand-container__btn facets-container__header custom-btn-expand-container dw-mod" id="custom-btn-expand-container" for="OptionsGroup_{{name}}">@Translate("Filters")</label> 2731 <div class="expand-container__content custom-expand-content-container dw-mod"> 2732 <div class="facets-container__list dw-mod"> 2733 <div class="grid__col-12 grid--direction-row u-no-padding grid--wrap"> 2734 @foreach (var option in settings.Options) 2735 { 2736 2737 var currentUrl = HttpContext.Current.Request.QueryString.ToString(); 2738 2739 <div class="grid__col-lg-3 grid__col-sm-3 grid__col-xs-12 u-no-padding-y"> 2740 @if (currentUrl.Contains(settings.SystemName + "=" + option.Value)) 2741 { 2742 <input type="checkbox" class="checked checkbox-facet__checkbox form__control dw-mod" checked id="@(settings.SystemName + option.Value)" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')" name="@(settings.SystemName + option.Value)"> 2743 2744 } 2745 2746 else 2747 { 2748 <input type="checkbox" class="checkbox-facet__checkbox form__control dw-mod" id="@(settings.SystemName + option.Value)" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')" name="@(settings.SystemName + option.Value)"> 2749 2750 } 2751 <label class="u-border-bottom u-padding u-no-padding-x checkbox-facet custom-checkbox-facet dw-mod" for="@(settings.SystemName + option.Value)"><span class="checkbox-facet__label custom-checkbox-facet-label dw-mod">@Translate(option.Name)</span></label> 2752 </div> 2753 2754 } 2755 </div> 2756 </div> 2757 </div> 2758 </div> 2759 </div> 2760 </div> 2761 <label for="@(settings.SystemName)Selector" class="btn btn--primary btn--full dw-mod js-expand-hide facets-container-trigger" data-trigger="CheckFacetGroups">@Translate("Select filters")</label> 2762 <label for="@(settings.SystemName)Selector" class="btn btn--primary btn--full dw-mod expandable--collapsed facets-container-trigger" data-trigger="CheckFacetGroups">@Translate("Close filters")</label> 2763 </section> 2764 </div> 2765 </div> 2766 2767 } 2768 2769 @*MOBILE*@ 2770 2771 else 2772 { 2773 <div class="grid"> 2774 <div class="grid__col-12 customlist u-no-padding"> 2775 2776 <section class="grid__col-12 u-no-padding" id="custom-facets-overall-container"> 2777 2778 @* REMEMBER TO MATCH HTML ATTRIBUTES DATA-EXPAND AND DATA-TRIGGER WITH THE GIVEN BUTTON (IN THIS SCENARIO CHECKFILTERS BUTTON FROM ARTICLECOMPONENTS.CSHTML) *@ 2779 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" /> 2780 <div class="grid grid--external-bleed-x facets-container facets-container--top expandable--collapsed grid--justify-center dw-mod" id="mobile-custom-facets-container" data-trigger="CheckFilters"> 2781 <div class="grid__col-12"> 2782 2783 <input type="checkbox" id="OptionsGroup_{{name}}" class="expand-trigger js-remember-state mobile-facet-input" /> 2784 2785 <div class="grid__col-12 expand-container facets-container__box custom-expand-container dw-mod js-filter"> 2786 <label class="grid--justify-center expand-container__btn facets-container__header custom-btn-expand-container dw-mod" id="custom-btn-expand-container" for="OptionsGroup_{{name}}">@Translate("Filters")</label> 2787 <div class="expand-container__content custom-expand-content-container dw-mod"> 2788 <div class="facets-container__list dw-mod"> 2789 <div class="grid__col-12 grid--direction-row u-no-padding grid--wrap"> 2790 @foreach (var option in settings.Options) 2791 { 2792 2793 var currentUrl = HttpContext.Current.Request.QueryString.ToString(); 2794 2795 <div class="grid__col-lg-3 grid__col-sm-4 grid__col-xs-12 u-no-padding-y"> 2796 @if (currentUrl.Contains(settings.SystemName + "=" + option.Value)) 2797 { 2798 <input type="checkbox" class="checked checkbox-facet__checkbox form__control dw-mod" checked id="@(settings.SystemName + option.Value)" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')" name="@(settings.SystemName + option.Value)"> 2799 2800 } 2801 2802 else 2803 { 2804 <input type="checkbox" class="checkbox-facet__checkbox form__control dw-mod" id="@(settings.SystemName + option.Value)" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')" name="@(settings.SystemName + option.Value)"> 2805 2806 } 2807 <label class="u-border-bottom u-padding u-no-padding-x checkbox-facet custom-checkbox-facet dw-mod" for="@(settings.SystemName + option.Value)"><span class="checkbox-facet__label custom-checkbox-facet-label dw-mod">@Translate(option.Name)</span></label> 2808 </div> 2809 2810 } 2811 </div> 2812 </div> 2813 </div> 2814 </div> 2815 </div> 2816 </div> 2817 2818 </section> 2819 </div> 2820 </div> 2821 2822 } 2823 } 2824 } 2825 @using System.Reflection 2826 @using Dynamicweb.Rapido.Blocks.Components 2827 @using Dynamicweb.Rapido.Blocks.Components.Articles 2828 @using Dynamicweb.Rapido.Blocks 2829 2830 @* Component for the articles *@ 2831 2832 @helper RenderArticleListSearch(ArticleListSearch settings) 2833 { 2834 dynamic[] methodParameters = new dynamic[1]; 2835 methodParameters[0] = settings; 2836 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListSearchCustom"); 2837 2838 if (customMethod != null) 2839 { 2840 @customMethod.Invoke(this, methodParameters).ToString(); 2841 } else { 2842 string searchString = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("Title")) ? HttpContext.Current.Request.QueryString.Get("Title").Trim('*') : ""; 2843 string className = "u-w340px u-pull--right u-margin-left"; 2844 2845 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 2846 { 2847 className = "u-full-width"; 2848 } 2849 2850 <div class="typeahead u-color-inherit u-margin-bottom dw-mod @className"> 2851 <input type="text" class="typeahead-search-field u-no-margin dw-mod" placeholder="@Translate("Search in list")" value="@searchString" id="ArticleListSearchInput" onchange="QueryArray.setParameterInCurrentURL('Title', '*' + document.getElementById('ArticleListSearchInput').value + '*')"> 2852 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button> 2853 </div> 2854 } 2855 } 2856 @using System.Reflection 2857 @using Dynamicweb.Rapido.Blocks.Components 2858 @using Dynamicweb.Rapido.Blocks.Components.Articles 2859 @using Dynamicweb.Rapido.Blocks 2860 2861 @* Component for the articles *@ 2862 2863 @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings) 2864 { 2865 dynamic[] methodParameters = new dynamic[1]; 2866 methodParameters[0] = settings; 2867 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListNoResultsInfoCustom"); 2868 2869 if (customMethod != null) 2870 { 2871 @customMethod.Invoke(this, methodParameters).ToString(); 2872 } else { 2873 <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div> 2874 } 2875 } 2876 2877 @using System.Reflection 2878 @using Dynamicweb.Rapido.Blocks.Components 2879 @using Dynamicweb.Rapido.Blocks.Components.General 2880 @using Dynamicweb.Rapido.Blocks.Components.Articles 2881 @using Dynamicweb.Rapido.Blocks 2882 @using System.Text.RegularExpressions 2883 @using S_DW_HD2412.CustomCode 2884 2885 @* Component for the articles *@ 2886 2887 @helper RenderArticleListItem(ArticleListItemExtended settings) 2888 { 2889 switch (settings.Type) { 2890 case ArticleListItemType.Card: 2891 @RenderArticleListItemCard(settings); 2892 break; 2893 case ArticleListItemType.List: 2894 @RenderArticleListItemList(settings); 2895 break; 2896 case ArticleListItemType.Simple: 2897 @RenderArticleListItemSimple(settings); 2898 break; 2899 default: 2900 @RenderArticleListItemCard(settings); 2901 break; 2902 } 2903 } 2904 2905 @helper RenderArticleListItemExtended(ArticleListItemExtended settings) 2906 { 2907 switch (settings.Type) { 2908 case ArticleListItemType.Card: 2909 @RenderArticleListItemCard(settings); 2910 break; 2911 case ArticleListItemType.List: 2912 @RenderArticleListItemList(settings); 2913 break; 2914 case ArticleListItemType.Simple: 2915 @RenderArticleListItemSimple(settings); 2916 break; 2917 default: 2918 @RenderArticleListItemCard(settings); 2919 break; 2920 } 2921 } 2922 2923 @helper RenderArticleListItemCard(ArticleListItemExtended settings) { 2924 <a href="@settings.Link" class="u-full-height u-color-light--bg"> 2925 <div class="u-color-light--bg u-no-padding dw-mod"> 2926 @if (settings.Logo != null) 2927 { 2928 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;" : ""; 2929 settings.Logo.ImageDefault.Crop = 5; 2930 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 2931 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 2932 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 2933 @if (settings.Stickers != null) 2934 { 2935 if (settings.Stickers.Position != StickersListPosition.Custom) 2936 { 2937 @RenderStickersCollection(settings.Stickers); 2938 } 2939 } 2940 @RenderImage(settings.Logo) 2941 </div> 2942 } 2943 else if (settings.Image != null) 2944 { 2945 <div class="flex-img image-hover__wrapper u-position-relative dw-mod"> 2946 @if (settings.Stickers != null) 2947 { 2948 if (settings.Stickers.Position != StickersListPosition.Custom) 2949 { 2950 @RenderStickersCollection(settings.Stickers); 2951 } 2952 } 2953 @RenderImage(settings.Image) 2954 </div> 2955 } 2956 </div> 2957 2958 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 2959 { 2960 2961 <div class="paragraph-card u-color-light--bg dw-mod"> 2962 2963 2964 @if (settings.Stickers != null) 2965 { 2966 if (settings.Stickers.Position == StickersListPosition.Custom) 2967 { 2968 @RenderStickersCollection(settings.Stickers) 2969 ; 2970 } 2971 } 2972 @if (!String.IsNullOrEmpty(settings.Title)) 2973 { 2974 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 2975 } 2976 @if (!String.IsNullOrEmpty(settings.Date)) 2977 { 2978 <div class="article__post-info dw-mod">@DateTime.Parse(settings.Date).ToString("dd-MM-yyyy")</div> 2979 } 2980 @if (!String.IsNullOrEmpty(settings.SubTitle)) 2981 { 2982 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 2983 } 2984 @if (!String.IsNullOrEmpty(settings.Summary)) 2985 { 2986 <p class="article__short-summary dw-mod">@settings.Summary</p> 2987 } 2988 <a href="@settings.Link" class="search-result__name search"> 2989 @Translate("Read more") 2990 </a> 2991 </div> 2992 } 2993 </a> 2994 } 2995 2996 @helper RenderArticleListItemList(ArticleListItemExtended settings) { 2997 <a href="@settings.Link"> 2998 <div class="grid u-color-light--bg u-no-padding dw-mod"> 2999 <div class="grid__col-md-3"> 3000 <div class="u-color-light--bg u-no-padding dw-mod"> 3001 @if (settings.Logo != null) 3002 { 3003 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;" : ""; 3004 settings.Logo.ImageDefault.Crop = 5; 3005 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 3006 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 3007 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 3008 @if (settings.Stickers != null) 3009 { 3010 if (settings.Stickers.Position != StickersListPosition.Custom) 3011 { 3012 @RenderStickersCollection(settings.Stickers); 3013 } 3014 } 3015 @RenderImage(settings.Logo) 3016 </div> 3017 } else if (settings.Image != null) 3018 { 3019 <div class="flex-img image-hover__wrapper dw-mod"> 3020 @if (settings.Stickers != null) 3021 { 3022 if (settings.Stickers.Position != StickersListPosition.Custom) 3023 { 3024 @RenderStickersCollection(settings.Stickers); 3025 } 3026 } 3027 @RenderImage(settings.Image) 3028 </div> 3029 } 3030 </div> 3031 </div> 3032 3033 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 3034 { 3035 <div class="grid__col-md-9"> 3036 @if (!String.IsNullOrEmpty(settings.Title)) 3037 { 3038 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 3039 } 3040 @if (settings.Stickers != null) 3041 { 3042 if (settings.Stickers.Position == StickersListPosition.Custom) 3043 { 3044 @RenderStickersCollection(settings.Stickers); 3045 } 3046 } 3047 @if (!String.IsNullOrEmpty(settings.SubTitle)) 3048 { 3049 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 3050 } 3051 @if (!String.IsNullOrEmpty(settings.Summary)) 3052 { 3053 <p class="article__short-summary dw-mod">@settings.Summary</p> 3054 } 3055 </div> 3056 } 3057 </div> 3058 </a> 3059 } 3060 3061 @helper RenderArticleListItemSimple(ArticleListItemExtended settings) { 3062 <a href="@settings.Link" class="u-color-inherit"> 3063 <div class="grid u-color-light--bg u-no-padding dw-mod"> 3064 <div class="grid__col-md-12"> 3065 @if (!String.IsNullOrEmpty(settings.Title)) 3066 { 3067 <section class="grid__col-12 grid--justify-center"> 3068 @*<h2 class="search-headline-the-one"> 3069 @settings.Title 3070 </h2>*@ 3071 </section> 3072 3073 } 3074 @if (!String.IsNullOrEmpty(settings.SubTitle)) 3075 { 3076 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 3077 } 3078 </div> 3079 </div> 3080 </a> 3081 } 3082 @using System.Reflection 3083 @using Dynamicweb.Rapido.Blocks.Components.Articles 3084 3085 3086 @* Component for the articles *@ 3087 3088 @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings) 3089 { 3090 dynamic[] methodParameters = new dynamic[1]; 3091 methodParameters[0] = settings; 3092 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleAuthorAndDateCustom"); 3093 3094 if (customMethod != null) 3095 { 3096 @customMethod.Invoke(this, methodParameters).ToString(); 3097 } else { 3098 <small class="article__subscription"> 3099 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 3100 { 3101 <text>@Translate("Written")</text> 3102 } 3103 @if (!string.IsNullOrWhiteSpace(settings.Author)) 3104 { 3105 <text>@Translate("by") @settings.Author</text> 3106 } 3107 @if (!string.IsNullOrWhiteSpace(settings.Date)) 3108 { 3109 <text>@Translate("on") @settings.Date</text> 3110 } 3111 </small> 3112 } 3113 } 3114 @using System.Reflection 3115 @using Dynamicweb.Rapido.Blocks.Components.Articles 3116 3117 3118 @* Component for the articles *@ 3119 3120 @helper RenderArticleLink(ArticleLink settings) 3121 { 3122 dynamic[] methodParameters = new dynamic[1]; 3123 methodParameters[0] = settings; 3124 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleLinkCustom"); 3125 3126 if (customMethod != null) 3127 { 3128 @customMethod.Invoke(this, methodParameters).ToString(); 3129 } else { 3130 if (!String.IsNullOrEmpty(settings.Title)) 3131 { 3132 <div class="grid__cell"> 3133 @RenderButton(settings) 3134 </div> 3135 } 3136 } 3137 } 3138 @using System.Reflection 3139 @using Dynamicweb.Rapido.Blocks 3140 @using Dynamicweb.Rapido.Blocks.Components.Articles 3141 @using Dynamicweb.Rapido.Blocks.Components.General 3142 3143 3144 @* Component for the articles *@ 3145 3146 @helper RenderArticleCarousel(ArticleCarousel settings) 3147 { 3148 dynamic[] methodParameters = new dynamic[1]; 3149 methodParameters[0] = settings; 3150 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 3151 3152 if (customMethod != null) 3153 { 3154 @customMethod.Invoke(this, methodParameters).ToString(); 3155 } else { 3156 <div class="grid"> 3157 <div class="grid__col-12"> 3158 <div class="carousel" id="carousel_@settings.Id"> 3159 <div class="carousel__container js-carousel-slides dw-mod"> 3160 @RenderBlockList(settings.SubBlocks) 3161 </div> 3162 </div> 3163 </div> 3164 </div> 3165 3166 <script> 3167 document.addEventListener("DOMContentLoaded", function () { 3168 new CarouselModule("#carousel_@settings.Id", { 3169 slideTime: 0, 3170 dots: true 3171 }); 3172 }); 3173 </script> 3174 } 3175 } 3176 3177 @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings) 3178 { 3179 dynamic[] methodParameters = new dynamic[1]; 3180 methodParameters[0] = settings; 3181 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 3182 3183 if (customMethod != null) 3184 { 3185 @customMethod.Invoke(this, methodParameters).ToString(); 3186 } 3187 else 3188 { 3189 string imageEngine = "/Admin/Public/GetImage.ashx?"; 3190 3191 string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image; 3192 if (settings.ImageSettings != null) 3193 { 3194 defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : ""; 3195 defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : ""; 3196 defaultImage += "Crop=" + settings.ImageSettings.Crop + "&"; 3197 defaultImage += "Compression=" + settings.ImageSettings.Compression + "&"; 3198 defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&"; 3199 defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&"; 3200 } 3201 defaultImage += "&Image=" + settings.Image; 3202 3203 <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')"> 3204 <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title"> 3205 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2> 3206 <div class="article-list__item-info"> 3207 @if (settings.Stickers != null) 3208 { 3209 settings.Stickers.Position = StickersListPosition.Custom; 3210 @RenderStickersCollection(settings.Stickers); 3211 } 3212 3213 <small class="u-margin-top--lg u-color-light"> 3214 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 3215 { 3216 <text>@Translate("Written")</text> 3217 } 3218 @if (!string.IsNullOrWhiteSpace(settings.Author)) 3219 { 3220 <text>@Translate("by") @settings.Author</text> 3221 } 3222 @if (!string.IsNullOrWhiteSpace(settings.Date)) 3223 { 3224 <text>@Translate("on") @settings.Date</text> 3225 } 3226 </small> 3227 </div> 3228 3229 <h3 class="article__short-summary u-color-light">@settings.Summary</h3> 3230 </a> 3231 @if (settings.UseFilters == true) 3232 { 3233 <div class="background-image image-filter image-filter--darken dw-mod"></div> 3234 } 3235 </div> 3236 } 3237 } 3238 @using System.Text.RegularExpressions 3239 @using Dynamicweb.Rapido.Blocks.Components 3240 @using Dynamicweb.Rapido.Blocks.Components.General 3241 @using Dynamicweb.Rapido.Blocks.Components.Articles 3242 @using Dynamicweb.Rapido.Blocks 3243 3244 @* Component for the articles *@ 3245 3246 @helper RenderArticleVideo(ArticleVideo settings) 3247 { 3248 dynamic[] methodParameters = new dynamic[1]; 3249 methodParameters[0] = settings; 3250 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleTextCustom"); 3251 3252 if (customMethod != null) 3253 { 3254 @customMethod.Invoke(this, methodParameters).ToString(); 3255 } else { 3256 if (settings.Url != null) 3257 { 3258 //getting video ID from youtube URL 3259 string videoCode = settings.Url; 3260 Regex regex = new Regex(@".be\/(.[^?]*)"); 3261 Match match = regex.Match(videoCode); 3262 string videoId = ""; 3263 if (match.Success) 3264 { 3265 videoId = match.Groups[1].Value; 3266 } 3267 else 3268 { 3269 regex = new Regex(@"v=([^&]+)"); 3270 match = regex.Match(videoCode); 3271 if (match.Success) 3272 { 3273 videoId = match.Groups[1].Value; 3274 } 3275 } 3276 3277 int autoPlay = settings.AutoPlay == "true" ? 1 : 0; 3278 3279 <div class="video-wrapper"> 3280 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div> 3281 </div> 3282 } 3283 } 3284 } 3285 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3286 @using System.Reflection 3287 @using Dynamicweb.Rapido.Blocks.Components 3288 @using Dynamicweb.Rapido.Blocks.Components.General 3289 @using Dynamicweb.Rapido.Blocks.Components.Articles 3290 @using Dynamicweb.Rapido.Blocks 3291 @using S_DW_HD2412.CustomCode 3292 3293 3294 3295 @helper RenderSocialShare() 3296 { 3297 string siteURL = Pageview.SearchFriendlyUrl.ToString(); 3298 3299 <section class="socialshare grid__col-md-12 grid__col--bleed grid-custom-layout grid--justify-center u-padding--lg dw-mod"> 3300 <div class="socialheader grid__col-md-12 u-no-padding u-border-bottom"> 3301 <h3>@Translate("ShareThis")</h3> 3302 </div> 3303 <div class="sociallinks grid__col-md-12 u-no-padding"> 3304 <div class="social-container"> 3305 <div class="links"> 3306 <div class="icon-nz-nz-facebook links-share" data-sharer="facebook" data-url="@siteURL"></div> 3307 <div class="linkedin icon-nz-nz-linkedin links-share" data-sharer="linkedin" data-url="@siteURL"></div> 3308 <div data-icon-nz="nz-link" class="js-geturl icon-nz-nz-link links-share" aria-label="Copy link"> 3309 <div class="links-input js-show-hide"> 3310 <input class="js-urlCopied"> 3311 </div> 3312 </div> 3313 </div> 3314 </div> 3315 </div> 3316 </section> 3317 } 3318 3319 3320 @* Simple helpers *@ 3321 3322 @*Requires the Gallery ItemType that comes with Rapido*@ 3323 @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) 3324 { 3325 string placeHolderImage = "/Files/Images/placeholder.gif"; 3326 3327 <main class="wrapper grid grid--direction-row"> 3328 <section class="gallery grid__col-lg-9 grid__col-sm-12"> 3329 <div class="swiper-container gallery-top"> 3330 <div class="swiper-wrapper"> 3331 @if (gallery != null && gallery.Count > 0) 3332 { 3333 int count = 1; 3334 3335 foreach (var item in gallery) 3336 { 3337 if (item.GetFile("ImagePath") != null) 3338 { 3339 string focalPointParameters = item.GetFile("ImagePath") != null ? "&" + item.GetFile("ImagePath").GetFocalPointParameters() : ""; 3340 3341 string image = item.GetFile("ImagePath").PathUrlEncoded + focalPointParameters; 3342 int imagesCount = gallery.Count; 3343 string text = item.GetString("Text"); 3344 3345 <div class="swiper-slide b-lazy" src="@placeHolderImage" data-src="/Admin/Public/GetImage.ashx?width=1024&amp;height=583&amp;crop=0&amp;Compression=75&amp;DoNotUpscale=1&amp;image=@image" alt="@text"> 3346 <div class="swiper-text">@text</div> 3347 </div> 3348 3349 count++; 3350 } 3351 } 3352 } 3353 </div> 3354 <div class="swiper-button-next swiper-button-white"></div> 3355 <div class="swiper-button-prev swiper-button-white"></div> 3356 </div> 3357 </section> 3358 @if (gallery != null && gallery.Count > 0) 3359 { 3360 <section class="thumbs grid__col-lg-3 grid__col-sm-12"> 3361 <div class="swiper-container gallery-thumbs"> 3362 <div class="swiper-wrapper"> 3363 @{ 3364 int count = 1; 3365 } 3366 3367 @foreach (var item in gallery) 3368 { 3369 if (item.GetFile("ImagePath") != null) 3370 { 3371 string focalPointParameters = item.GetFile("ImagePath") != null ? "&" + item.GetFile("ImagePath").GetFocalPointParameters() : ""; 3372 3373 string image = item.GetFile("ImagePath").PathUrlEncoded + focalPointParameters; 3374 int imagesCount = gallery.Count; 3375 string text = item.GetString("Text"); 3376 3377 <img class="swiper-slide" src="/Admin/Public/GetImage.ashx?width=450&amp;height=247&amp;crop=0&amp;Compression=75&amp;DoNotUpscale=1&amp;image=@image" alt="@text" /> 3378 3379 count++; 3380 } 3381 } 3382 </div> 3383 </div> 3384 </section> 3385 } 3386 </main> 3387 3388 } 3389 3390 @helper RenderArticleItemGalleryModal() 3391 { 3392 <!-- Trigger for the gallery modal --> 3393 <input type="checkbox" id="GalleryModalTrigger" class="modal-trigger" /> 3394 3395 <!-- Gallery modal --> 3396 <div class="modal-container"> 3397 <label for="GalleryModalTrigger" id="GalleryModalOverlay" class="modal-overlay"></label> 3398 <div class="modal modal--full" id="GalleryModal"> 3399 <div class="modal__body modal__body--full"> 3400 <div class="gallery-slider"> 3401 <div class="gallery-slider__image"> 3402 <img src="#" alt="" class="modal--full__img" id="FullImage" /> 3403 </div> 3404 <div class="gallery-slider__image-counter" id="FullImage_counter"></div> 3405 <label class="gallery-slider__close-btn" for="GalleryModalTrigger"></label> 3406 <button class="gallery-slider__previous-btn" id="FullImage_prev" onclick="Gallery.prevImage('FullImage')"></button> 3407 <button class="gallery-slider__next-btn" id="FullImage_next" onclick="Gallery.nextImage('FullImage')"></button> 3408 </div> 3409 </div> 3410 </div> 3411 </div> 3412 } 3413 3414 3415 @helper RenderMobileFilters(List<Block> settings) 3416 { 3417 if (settings.Count > 0) 3418 { 3419 <div class="grid__col-12"> 3420 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" /> 3421 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters"> 3422 @RenderBlockList(settings) 3423 </div> 3424 @*<label for="CheckFilters" class="btn btn--primary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label> 3425 <label for="CheckFilters" class="btn btn--primary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label>*@ 3426 </div> 3427 } 3428 } 3429 3430 3431 3432 @using System.Reflection 3433 @using Dynamicweb.Rapido.Blocks.Components 3434 @using Dynamicweb.Rapido.Blocks.Components.General 3435 @using Dynamicweb.Rapido.Blocks 3436 3437 3438 @* Component *@ 3439 3440 @helper RenderPagination(Pagination settings) 3441 { 3442 string pagingTag = settings.PagingTag; 3443 3444 if (!string.IsNullOrWhiteSpace(GetString(pagingTag + ".Paging.Show"))) 3445 { 3446 <div class="pager u-margin-top dw-mod"> 3447 @if (settings.ShowPagingInfo) 3448 { 3449 <div class="pager__info dw-mod"> 3450 @Translate("Page") @GetString(pagingTag + ".Paging.CurrentPage") @Translate("of") @GetString(pagingTag + ".Paging.NumPages") 3451 </div> 3452 } 3453 <ul class="pager__list dw-mod"> 3454 @if (!string.IsNullOrWhiteSpace(GetString(pagingTag + ".Paging.First.URL")) && settings.ShowFirstAndLastControls) 3455 { 3456 @RenderPaginationItem(new PaginationItem { Link = GetString(pagingTag + ".Paging.First.URL"), Icon = settings.FirstIcon }) 3457 } 3458 @if (!string.IsNullOrWhiteSpace(GetString(pagingTag + ".Paging.Back.URL")) && settings.ShowNextAndPrevControls) 3459 { 3460 @RenderPaginationItem(new PaginationItem { Link = GetString(pagingTag + ".Paging.Back.URL"), Icon = settings.PrevIcon }) 3461 } 3462 @if (!string.IsNullOrWhiteSpace(GetString(pagingTag + ".Paging.HasPages"))) 3463 { 3464 foreach (LoopItem page in GetLoop(pagingTag + ".Paging.Pages")) 3465 { 3466 bool isActive = page.GetString(pagingTag + ".Paging.PageClass") == "currentPage"; 3467 @RenderPaginationItem(new PaginationItem { Link = page.GetString(pagingTag + ".Paging.PageIndexUrl"), Label = page.GetString(pagingTag + ".Paging.PageIndex"), IsActive = isActive }) 3468 } <text></text> 3469 } 3470 @if (!string.IsNullOrWhiteSpace(GetString(pagingTag + ".Paging.Forward.URL")) && settings.ShowNextAndPrevControls) 3471 { 3472 @RenderPaginationItem(new PaginationItem { Link = GetString(pagingTag + ".Paging.Forward.URL"), Icon = settings.NextIcon }) 3473 } 3474 @if (!string.IsNullOrWhiteSpace(GetString(pagingTag + ".Paging.Last.URL")) && settings.ShowFirstAndLastControls) 3475 { 3476 @RenderPaginationItem(new PaginationItem { Link = GetString(pagingTag + ".Paging.Last.URL"), Icon = settings.FirstIcon }) 3477 } 3478 </ul> 3479 </div> 3480 } 3481 } 3482 3483 @helper RenderPaginationItem(PaginationItem settings) 3484 { 3485 <li class="pager__btn dw-mod"> 3486 @if (settings.IsActive) 3487 { 3488 <span class="pager__num pager__num--current dw-mod"> 3489 @settings.Label 3490 3491 @if (settings.Icon != null) 3492 { 3493 @RenderIcon(new Icon { Prefix = settings.Icon.Prefix, Name = settings.Icon.Name }) 3494 } 3495 </span> 3496 } 3497 else 3498 { 3499 <a href="@settings.Link" class="pager__num dw-mod"> 3500 @settings.Label 3501 3502 @if (settings.Icon != null) 3503 { 3504 @RenderIcon(new Icon { Prefix = settings.Icon.Prefix, Name = settings.Icon.Name }) 3505 } 3506 </a> 3507 } 3508 </li> 3509 } 3510 @if (File.Exists(HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/Components/Custom/Custom__Components.cshtml"))) 3511 { 3512 <text>@using Dynamicweb.Rapido.Blocks.Components.General 3513 </text> 3514 } 3515 3516 @* Include the Blocks for the page *@ 3517 @if (File.Exists(HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/ItemPublisher/List/Blocks/Custom__Blocks.cshtml"))) 3518 { 3519 <text>@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3520 @using Dynamicweb.Core 3521 @using System 3522 @using System.Web 3523 @using System.Collections.Generic 3524 @using Dynamicweb.Rapido.Blocks 3525 3526 @{ 3527 3528 }</text> 3529 } 3530 3531 3532 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 3533 @RenderBlockList(articlePage.BlocksRoot.BlocksList) 3534
Error executing template "Designs/Rapido/ItemPublisher/List/SimpleList.cshtml"
System.ArgumentException: Object of type 'Dynamicweb.Rapido.Blocks.Components.Articles.ArticleListItem' cannot be converted to type 'S_DW_HD2412.CustomCode.ArticleListItemExtended'.
   at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)
   at System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
   at System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at CompiledRazorTemplates.Dynamic.RazorEngine_1975e29851d44079929a9cde2479233e.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_HD2412\Files\Templates\Designs\Rapido\ItemPublisher\List\SimpleList.cshtml:line 262
   at CompiledRazorTemplates.Dynamic.RazorEngine_1975e29851d44079929a9cde2479233e.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_HD2412\Files\Templates\Designs\Rapido\ItemPublisher\List\SimpleList.cshtml:line 99
   at CompiledRazorTemplates.Dynamic.RazorEngine_1975e29851d44079929a9cde2479233e.b__65_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_HD2412\Files\Templates\Designs\Rapido\ItemPublisher\List\SimpleList.cshtml:line 3205
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_1975e29851d44079929a9cde2479233e.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_HD2412\Files\Templates\Designs\Rapido\ItemPublisher\List\SimpleList.cshtml:line 247
   at CompiledRazorTemplates.Dynamic.RazorEngine_1975e29851d44079929a9cde2479233e.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_HD2412\Files\Templates\Designs\Rapido\ItemPublisher\List\SimpleList.cshtml:line 99
   at CompiledRazorTemplates.Dynamic.RazorEngine_1975e29851d44079929a9cde2479233e.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_HD2412\Files\Templates\Designs\Rapido\ItemPublisher\List\SimpleList.cshtml:line 272
   at CompiledRazorTemplates.Dynamic.RazorEngine_1975e29851d44079929a9cde2479233e.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_HD2412\Files\Templates\Designs\Rapido\ItemPublisher\List\SimpleList.cshtml:line 183
   at CompiledRazorTemplates.Dynamic.RazorEngine_1975e29851d44079929a9cde2479233e.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_HD2412\Files\Templates\Designs\Rapido\ItemPublisher\List\SimpleList.cshtml:line 272
   at CompiledRazorTemplates.Dynamic.RazorEngine_1975e29851d44079929a9cde2479233e.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_HD2412\Files\Templates\Designs\Rapido\ItemPublisher\List\SimpleList.cshtml:line 148
   at CompiledRazorTemplates.Dynamic.RazorEngine_1975e29851d44079929a9cde2479233e.Execute() in D:\dynamicweb.net\Solutions\S_DW_HD2412\Files\Templates\Designs\Rapido\ItemPublisher\List\SimpleList.cshtml:line 3192
   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() in E:\Agent\_work\169\s\06 - Dynamicweb Host\Dynamicweb\Dynamicweb-9.9\Dynamicweb\Rendering\Template.cs:line 902

1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using System.Web; 3 @using System.IO 4 @using Dynamicweb.Rapido.Blocks 5 @using Dynamicweb.Rapido.Blocks.Components.Articles 6 @using Dynamicweb.Rapido.Blocks.Components.General 7 8 9 @functions { 10 BlocksPage articlePage = BlocksPage.GetBlockPage("SimpleList"); 11 12 public string Truncate(string value, int maxChars) 13 { 14 return value.Length <= maxChars ? value : value.Substring(0, maxChars) + "..."; 15 } 16 } 17 18 @{ 19 if (GetLoop("ItemPublisher:Items.List").Count > 0) 20 { 21 Block listContainer = new Block 22 { 23 Id = "ArticleListContainer", 24 SortId = 10, 25 Design = new Design 26 { 27 RenderType = RenderType.Row 28 }, 29 BlocksList = new List<Block> { 30 new Block { 31 Id = "ArticleListBody", 32 SortId = 30, 33 Design = new Design { 34 RenderType = RenderType.Column, 35 Size = "12", 36 HidePadding = true 37 } 38 } 39 } 40 }; 41 articlePage.Add(listContainer); 42 43 Block articleList = new Block 44 { 45 Id = "ArticleList", 46 SortId = 10, 47 SkipRenderBlocksList = true, 48 Template = RenderPopularList() 49 }; 50 articlePage.Add("ArticleListBody", articleList); 51 52 int count = 0; 53 foreach (LoopItem listItem in GetLoop("ItemPublisher:Items.List")) 54 { 55 ArticleListItem articleListItemComponent = new ArticleListItem 56 { 57 Title = listItem.GetString("ItemPublisher:Item.Title"), 58 Link = "/Default.aspx?ID=" + listItem.GetString("ItemPublisher:Item.Field.PageId"), 59 Type = ArticleListItemType.Simple 60 }; 61 62 Block articleListItem = new Block 63 { 64 Id = "ArticleListItem" + count, 65 SortId = (count * 10), 66 Component = articleListItemComponent 67 }; 68 articlePage.Add("ArticleList", articleListItem); 69 } 70 } 71 } 72 73 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ 74 75 76 @using System.Text.RegularExpressions 77 @using System.Reflection 78 @using System.Web.UI.HtmlControls 79 @using Dynamicweb.Rapido.Blocks.Components 80 @using Dynamicweb.Rapido.Blocks.Components.Articles 81 @using Dynamicweb.Rapido.Blocks.Components.Documentation 82 @using Dynamicweb.Rapido.Blocks 83 @using System 84 @using System.Web 85 @using System.Collections.Generic 86 @using Dynamicweb.Frontend 87 @*--- START: Base block renderers ---*@ 88 89 @helper RenderBlockList(List<Block> blocks) 90 { 91 blocks = blocks.OrderBy(item => item.SortId).ToList(); 92 93 foreach (Block item in blocks) 94 { 95 <!-- START: @item.Id --> 96 97 if (item.Design == null) 98 { 99 @RenderBlock(item) 100 } 101 else if (item.Design.RenderType == RenderType.None) 102 { 103 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 104 105 <div class="@cssClass dw-mod"> 106 @RenderBlock(item) 107 </div> 108 } 109 else if (item.Design.RenderType != RenderType.Hide) 110 { 111 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 112 113 if (!item.SkipRenderBlocksList) 114 { 115 116 117 if (item.Design.RenderType == RenderType.Row) 118 { 119 120 //Custom if sentence to check if grid/container has the id "ArticleContainer" to change the Dynamic Article/Nyhedsside layout 121 122 if (item.Id == "ArticleContainer") 123 { 124 125 <div class="grid grid--align-content-start grid-custom-layout @cssClass dw-mod" id="Block__@item.Id"> 126 @RenderBlock(item) 127 </div> 128 } 129 130 else if (item.Id == "CaseContainer") 131 { 132 <div class="grid grid--align-content-start grid-custom-layout-third @cssClass dw-mod" id="Block__@item.Id"> 133 @RenderBlock(item) 134 </div> 135 } 136 137 else if (item.Id == "OrderContainerRow") 138 { 139 <div class="grid grid--align-content-start grid-custom-layout-third @cssClass mobile-order-container-row dw-mod" id="Block__@item.Id"> 140 @RenderBlock(item) 141 </div> 142 } 143 144 145 else 146 { 147 <div class="grid grid--align-content-start grid-custom-layout-third @cssClass dw-mod" id="Block__@item.Id"> 148 @RenderBlock(item) 149 </div> 150 151 } 152 153 154 } 155 156 if (item.Design.RenderType == RenderType.Column) 157 { 158 string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; 159 string size = item.Design.Size ?? "12"; 160 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; 161 162 //Custom if sentence to check if grid/container has the id "MasterFooter" to change the footer layout 163 if (item.Id.Contains("MasterFooter")) 164 { 165 <div class="@(item.Id.Contains("MasterFooterColumnOne") || item.Id.Contains("MasterFooterColumnTwo") ? "grid__col-lg-3 grid__col-6 mobile-flex-order" : "grid__col-12") @(item.Id.Contains("MasterFooterColumnThree") ? "grid__col-6 grid--align-end mobile-flex-order" : "grid__col-12") grid--align-content-space-between grid--justify-start @hidePadding @cssClass dw-mod" id="Block__@item.Id"> 166 @RenderBlock(item) 167 </div> 168 } 169 170 //Custom if sentence to check if grid/container has the id "ArticleParagraphImage" to change the Dynamic Article image to be full width on desktop 171 else if (item.Id.Contains("ArticleParagraph")) 172 { 173 174 <div class="grid__col-12 @hidePadding @cssClass dw-mod" id="Block__@item.Id "> 175 @RenderBlock(item) 176 </div> 177 } 178 179 180 else 181 { 182 <section 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"> 183 @RenderBlock(item) 184 </section> 185 } 186 187 } 188 189 190 if (item.Design.RenderType == RenderType.Table) 191 { 192 <table class="table @cssClass dw-mod" id="Block__@item.Id"> 193 @RenderBlock(item) 194 </table> 195 } 196 197 if (item.Design.RenderType == RenderType.TableRow) 198 { 199 <tr class="@cssClass dw-mod" id="Block__@item.Id"> 200 @RenderBlock(item) 201 </tr> 202 } 203 204 if (item.Design.RenderType == RenderType.TableColumn) 205 { 206 <td class="@cssClass dw-mod" id="Block__@item.Id"> 207 @RenderBlock(item) 208 </td> 209 } 210 211 if (item.Design.RenderType == RenderType.CardHeader) 212 { 213 <div class="card-header @cssClass dw-mod"> 214 @RenderBlock(item) 215 </div> 216 } 217 218 if (item.Design.RenderType == RenderType.CardBody) 219 { 220 <div class="card @cssClass dw-mod"> 221 @RenderBlock(item) 222 </div> 223 } 224 225 if (item.Design.RenderType == RenderType.CardFooter) 226 { 227 <div class="card-footer @cssClass dw-mod"> 228 @RenderBlock(item) 229 </div> 230 231 } 232 233 234 } 235 else 236 { 237 @RenderBlock(item) 238 } 239 } 240 241 <!-- END: @item.Id --> 242 } 243 } 244 245 @helper RenderBlock(Block item) 246 { 247 if (item.Template != null) 248 { 249 @BlocksPage.RenderTemplate(item.Template) 250 } 251 252 if (item.Component != null) 253 { 254 string methodName = item.Component.HelperName; 255 dynamic[] methodParameters = new dynamic[1]; 256 methodParameters[0] = item.Component; 257 Type methodType = this.GetType(); 258 MethodInfo generalMethod = methodType.GetMethod(methodName); 259 260 if (generalMethod != null) 261 { 262 @generalMethod.Invoke(this, methodParameters).ToString(); 263 } 264 else 265 { 266 throw new Exception(item.Component.GetType().Name + " method '" + methodName + "' could not be invoked"); 267 } 268 } 269 270 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList) 271 { 272 @RenderBlockList(item.BlocksList) 273 } 274 } 275 276 @*--- END: Base block renderers ---*@ 277 278 @using Dynamicweb.Rapido.Blocks.Components 279 @using Dynamicweb.Rapido.Blocks.Components.General 280 @using Dynamicweb.Rapido.Blocks 281 282 283 @* Components *@ 284 @using System.Reflection 285 @using Dynamicweb.Rapido.Blocks.Components.General 286 287 288 @* Component *@ 289 290 @helper RenderIcon(Icon settings) { 291 if (settings != null) 292 { 293 dynamic[] methodParameters = new dynamic[1]; 294 methodParameters[0] = settings; 295 MethodInfo customMethod = this.GetType().GetMethod("RenderIconCustom"); 296 297 if (customMethod != null) 298 { 299 @customMethod.Invoke(this, methodParameters).ToString(); 300 } else { 301 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 302 303 if (settings.Name != null) 304 { 305 if (String.IsNullOrEmpty(settings.Label)) { 306 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> 307 } else { 308 if (settings.LabelPosition == IconLabelPosition.Before) { 309 <span>@settings.Label <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i></span> 310 } else { 311 <span><i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> @settings.Label</span> 312 } 313 } 314 } 315 } 316 } 317 } 318 @using System.Reflection 319 @using Dynamicweb.Rapido.Blocks.Components.General 320 @using Dynamicweb.Rapido.Blocks.Components 321 @using S_DW_HD2412.CustomCode 322 323 @* Component *@ 324 325 @helper RenderButtonExtended(ButtonExtended settings) 326 { 327 dynamic[] methodParameters = new dynamic[1]; 328 methodParameters[0] = settings; 329 MethodInfo customMethod = this.GetType().GetMethod("RenderButtonCustom"); 330 331 if (customMethod != null) 332 { 333 @customMethod.Invoke(this, methodParameters).ToString(); 334 } 335 else 336 { 337 string target; 338 string disabled = settings.Disabled ? "disabled" : ""; 339 string buttonType = settings.ButtonType == ButtonType.Submit ? "submit" : "button"; 340 buttonType = settings.ButtonType == ButtonType.Reset ? "reset" : buttonType; 341 string buttonLayout = settings.ButtonLayout.ToString().ToLower(); 342 string nofollow = settings.ButtonNofollow != false ? "rel='nofollow'" : null; 343 344 switch (settings.Target) 345 { 346 case LinkTargetType.Blank: 347 target = "_blank"; 348 break; 349 case LinkTargetType.Parent: 350 target = "_parent"; 351 break; 352 case LinkTargetType.Self: 353 target = "_self"; 354 break; 355 case LinkTargetType.Top: 356 target = "_top"; 357 break; 358 default: 359 target = "_self"; 360 break; 361 } 362 363 string onClickAction = settings.OnClick != null ? settings.OnClick : ""; 364 string noOpener = target == "_blank" ? "rel=\"noopener\"" : ""; 365 366 if (!String.IsNullOrEmpty(settings.ConfirmText)) 367 { 368 string modalId = settings.Id; 369 @RenderConfirmDialog(settings); 370 onClickAction = "document.getElementById('" + modalId + "ModalTrigger').checked = true"; 371 } 372 373 if (settings.Icon != null) 374 { 375 if (settings.IconPosition == null) 376 { 377 settings.Icon.LabelPosition = IconLabelPosition.After; 378 } 379 else 380 { 381 settings.Icon.LabelPosition = settings.IconPosition == IconPosition.Before ? IconLabelPosition.After : IconLabelPosition.Before; 382 } 383 if (settings.Icon.Label == null) 384 { 385 settings.Icon.Label = settings.Title; 386 } 387 } 388 string content = settings.Icon == null ? settings.Title : Convert.ToString(RenderIcon(settings.Icon)); 389 390 if (!String.IsNullOrEmpty(settings.Link) && String.IsNullOrEmpty(settings.ConfirmText)) 391 { 392 <a href="@settings.Link" target="@target" class="btn btn--@buttonLayout @settings.CssClass @disabled dw-mod" @nofollow onclick="@onClickAction" @ComponentMethods.AddAttributes(settings.ExtraAttributes) @disabled>@content</a> } 393 else 394 { 395 <button type="@buttonType" class="btn btn--@buttonLayout @settings.CssClass @disabled dw-mod" onclick="@onClickAction" @ComponentMethods.AddAttributes(settings.ExtraAttributes) @disabled>@content</button> 396 } 397 } 398 } 399 400 @helper RenderButton(Button settings) 401 { 402 dynamic[] methodParameters = new dynamic[1]; 403 methodParameters[0] = settings; 404 MethodInfo customMethod = this.GetType().GetMethod("RenderButtonCustom"); 405 406 if (customMethod != null) 407 { 408 @customMethod.Invoke(this, methodParameters).ToString(); 409 } 410 else 411 { 412 string target; 413 string disabled = settings.Disabled ? "disabled" : ""; 414 string buttonType = settings.ButtonType == ButtonType.Submit ? "submit" : "button"; 415 buttonType = settings.ButtonType == ButtonType.Reset ? "reset" : buttonType; 416 string buttonLayout = settings.ButtonLayout.ToString().ToLower(); 417 418 switch (settings.Target) 419 { 420 case LinkTargetType.Blank: 421 target = "_blank"; 422 break; 423 case LinkTargetType.Parent: 424 target = "_parent"; 425 break; 426 case LinkTargetType.Self: 427 target = "_self"; 428 break; 429 case LinkTargetType.Top: 430 target = "_top"; 431 break; 432 default: 433 target = "_self"; 434 break; 435 } 436 437 string onClickAction = settings.OnClick != null ? settings.OnClick : ""; 438 string noOpener = target == "_blank" ? "rel=\"noopener\"" : ""; 439 440 if (!String.IsNullOrEmpty(settings.ConfirmText)) 441 { 442 string modalId = settings.Id; 443 @RenderConfirmDialog(settings); 444 onClickAction = "document.getElementById('" + modalId + "ModalTrigger').checked = true"; 445 } 446 447 if (settings.Icon != null) 448 { 449 if (settings.IconPosition == null) 450 { 451 settings.Icon.LabelPosition = IconLabelPosition.After; 452 } 453 else 454 { 455 settings.Icon.LabelPosition = settings.IconPosition == IconPosition.Before ? IconLabelPosition.After : IconLabelPosition.Before; 456 } 457 if (settings.Icon.Label == null) 458 { 459 settings.Icon.Label = settings.Title; 460 } 461 } 462 string content = settings.Icon == null ? settings.Title : Convert.ToString(RenderIcon(settings.Icon)); 463 464 if (!String.IsNullOrEmpty(settings.Link) && String.IsNullOrEmpty(settings.ConfirmText)) 465 { 466 <a href="@settings.Link" target="@target" @noOpener class="btn btn--@buttonLayout @settings.CssClass @disabled dw-mod" onclick="@onClickAction" @ComponentMethods.AddAttributes(settings.ExtraAttributes) @disabled>@content</a> } 467 else 468 { 469 <button type="@buttonType" class="btn btn--@buttonLayout @settings.CssClass @disabled dw-mod" onclick="@onClickAction" @ComponentMethods.AddAttributes(settings.ExtraAttributes) @disabled>@content</button> 470 } 471 } 472 } 473 474 475 @helper RenderConfirmDialog(Button settings) 476 { 477 dynamic[] methodParameters = new dynamic[1]; 478 methodParameters[0] = settings; 479 MethodInfo customMethod = this.GetType().GetMethod("RenderConfirmDialogCustom"); 480 481 if (customMethod != null) 482 { 483 @customMethod.Invoke(this, methodParameters).ToString(); 484 } 485 else 486 { 487 string modalTriggerId = settings.Id + "ModalTrigger"; 488 489 <!-- Trigger for the confirm modal --> 490 <input type="checkbox" id="@modalTriggerId" class="modal-trigger" /> 491 492 <!-- Login modal --> 493 <div class="modal-container"> 494 <label for="@modalTriggerId" class="modal-overlay"></label> 495 <div class="modal modal--xs"> 496 <div class="modal__header"> 497 <h2>@settings.ConfirmText</h2> 498 </div> 499 <div class="modal__body"> 500 @RenderButton(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = settings.OnClick, CssClass = "u-full-width", Link = settings.Link }) 501 </div> 502 </div> 503 </div> 504 } 505 } 506 @using System.Reflection 507 @using Dynamicweb.Rapido.Blocks.Components 508 @using Dynamicweb.Rapido.Blocks.Components.General 509 @using Dynamicweb.Rapido.Blocks 510 511 512 @* Component *@ 513 514 @helper RenderRating(Rating settings) 515 { 516 dynamic[] methodParameters = new dynamic[1]; 517 methodParameters[0] = settings; 518 MethodInfo customMethod = this.GetType().GetMethod("RenderRatingCustom"); 519 520 if (customMethod != null) 521 { 522 @customMethod.Invoke(this, methodParameters).ToString(); 523 } else { 524 if (settings.Score > 0) 525 { 526 int rating = settings.Score; 527 string iconType = "fa-star"; 528 529 switch (settings.Type.ToString()) { 530 case "Stars": 531 iconType = "fa-star"; 532 break; 533 case "Hearts": 534 iconType = "fa-heart"; 535 break; 536 case "Lemons": 537 iconType = "fa-lemon"; 538 break; 539 case "Bombs": 540 iconType = "fa-bomb"; 541 break; 542 } 543 544 <div class="u-ta-right"> 545 @for (int i = 0; i < settings.OutOf; i++) 546 { 547 <i class="@(rating > i ? "fas" : "far") @iconType"></i> 548 } 549 </div> 550 } 551 } 552 } 553 @using System.Reflection 554 @using Dynamicweb.Rapido.Blocks.Components.General 555 @using Dynamicweb.Rapido.Blocks.Components 556 557 558 @* Component *@ 559 560 @helper RenderFieldListOption(FieldListOption settings) { 561 dynamic[] methodParameters = new dynamic[1]; 562 methodParameters[0] = settings; 563 MethodInfo customMethod = this.GetType().GetMethod("RenderFieldListOptionCustom"); 564 565 if (customMethod != null) 566 { 567 @customMethod.Invoke(this, methodParameters).ToString(); 568 } else { 569 string disabled = settings.Disabled ? "disabled" : ""; 570 string selected = settings.Checked ? "checked" : ""; 571 572 if (settings.Type.ToString() == "RadioButton") 573 { 574 <input class="form__control @disabled dw-mod" onchange="@settings.OnChange" onclick="@settings.OnClick" type="radio" name="@settings.Name" id="@settings.Id" value="@settings.Value" @selected @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 575 <label for="@settings.Id" class="u-inline @disabled dw-mod">@settings.Label</label> 576 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 577 } 578 579 if (settings.Type.ToString() == "Checkbox") 580 { 581 @RenderCheckboxField(settings) 582 } 583 584 if (settings.Type.ToString() == "SelectOption") 585 { 586 <option value="@settings.Value" id="@settings.Id" onclick="@settings.OnClick" class="@disabled" @disabled @selected @ComponentMethods.AddAttributes(settings.ExtraAttributes) >@settings.Name</option> 587 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 588 } 589 } 590 } 591 592 @using System.Reflection 593 @using Dynamicweb.Rapido.Blocks.Components.General 594 @using Dynamicweb.Rapido.Blocks.Components 595 596 597 @* Component *@ 598 599 @helper RenderNavigation(Navigation settings) { 600 dynamic[] methodParameters = new dynamic[1]; 601 methodParameters[0] = settings; 602 MethodInfo customMethod = this.GetType().GetMethod("RenderNavigationCustom"); 603 604 if (customMethod != null) 605 { 606 @customMethod.Invoke(this, methodParameters).ToString(); 607 } else { 608 @RenderNavigation(new 609 { 610 id = settings.Id, 611 cssclass = settings.CssClass, 612 startLevel = settings.StartLevel, 613 endlevel = settings.EndLevel, 614 expandmode = settings.Expandmode, 615 template = settings.Template 616 }) 617 } 618 } 619 @using System.Reflection 620 @using Dynamicweb.Rapido.Blocks.Components.General 621 @using Dynamicweb.Rapido.Blocks.Components 622 623 624 @* Component *@ 625 626 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) { 627 dynamic[] methodParameters = new dynamic[1]; 628 methodParameters[0] = settings; 629 MethodInfo customMethod = this.GetType().GetMethod("RenderBreadcrumbNavigationCustom"); 630 631 if (customMethod != null) 632 { 633 @customMethod.Invoke(this, methodParameters).ToString(); 634 } else { 635 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 636 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 637 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 638 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 639 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 640 641 @RenderNavigation(settings) 642 } 643 } 644 @using System.Reflection 645 @using Dynamicweb.Rapido.Blocks.Components.General 646 647 648 @* Component *@ 649 650 @helper RenderHeading(Heading settings) { 651 dynamic[] methodParameters = new dynamic[1]; 652 methodParameters[0] = settings; 653 MethodInfo customMethod = this.GetType().GetMethod("RenderHeadingCustom"); 654 655 if (customMethod != null) 656 { 657 @customMethod.Invoke(this, methodParameters).ToString(); 658 } else { 659 string startTag = "<h" + settings.Level.ToString() + " class=\"" + settings.CssClass + "\">"; 660 string endTag = "</h" + settings.Level.ToString() + "\">"; 661 662 if (settings.Icon != null) 663 { 664 if (settings.IconPosition == null) { 665 settings.Icon.LabelPosition = IconLabelPosition.After; 666 } else { 667 settings.Icon.LabelPosition = settings.IconPosition == IconPosition.Before ? IconLabelPosition.After : IconLabelPosition.Before; 668 } 669 if (settings.Icon.Label == null) { 670 settings.Icon.Label = settings.Title; 671 } 672 673 @startTag@RenderIcon(settings.Icon)@endTag 674 } else { 675 @startTag@settings.Title@endTag 676 } 677 } 678 } 679 @using System.Reflection 680 @using Dynamicweb.Rapido.Blocks.Components 681 @using Dynamicweb.Rapido.Blocks.Components.General 682 @using Dynamicweb.Rapido.Blocks 683 684 685 @* Component *@ 686 687 @helper RenderImage(Image settings) 688 { 689 if (settings.Path != null) 690 { 691 dynamic[] methodParameters = new dynamic[1]; 692 methodParameters[0] = settings; 693 MethodInfo customMethod = this.GetType().GetMethod("RenderImageCustom"); 694 695 if (customMethod != null) 696 { 697 @customMethod.Invoke(this, methodParameters).ToString(); 698 } else { 699 <div> 700 @if (settings.Link != null) 701 { 702 <a href="@settings.Link"> 703 @RenderTheImage(settings); 704 </a> 705 } 706 else 707 { 708 @RenderTheImage(settings); 709 } 710 </div> 711 } 712 } 713 } 714 715 @functions { 716 string getImagePathFromSettings(ImageSettings settings) 717 { 718 string result = ""; 719 720 if (settings != null) 721 { 722 result += settings.Width != 0 ? "Width=" + settings.Width + "&" : ""; 723 result += settings.Height != 0 ? "Height=" + settings.Height + "&" : ""; 724 result += "Crop=" + settings.Crop + "&"; 725 result += "Compression=" + settings.Compression + "&"; 726 result += "DoNotUpscale=" + settings.DoNotUpscale.ToString() + "&"; 727 result += "FillCanvas=" + settings.FillCanvas.ToString() + "&"; 728 } 729 730 return result; 731 } 732 } 733 734 @helper RenderTheImage(Image settings) 735 { 736 if (settings != null) 737 { 738 dynamic[] methodParameters = new dynamic[1]; 739 methodParameters[0] = settings; 740 MethodInfo customMethod = this.GetType().GetMethod("RenderTheImageCustom"); 741 742 if (customMethod != null) 743 { 744 @customMethod.Invoke(this, methodParameters).ToString(); 745 } else { 746 string placeholderImage = "/Files/Images/placeholder.gif"; 747 string imageEngine = "/Admin/Public/GetImage.ashx?"; 748 749 string imageStyle = ""; 750 751 switch (settings.Style) 752 { 753 case ImageStyle.Ball: 754 imageStyle = "grid__cell-img--ball"; 755 break; 756 } 757 758 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle) 759 { 760 if (settings.ImageDefault != null) 761 { 762 settings.ImageDefault.Height = settings.ImageDefault.Width; 763 } 764 if (settings.ImageMedium != null) 765 { 766 settings.ImageMedium.Height = settings.ImageMedium.Width; 767 } 768 if (settings.ImageSmall != null) 769 { 770 settings.ImageSmall.Height = settings.ImageSmall.Width; 771 } 772 } 773 774 string defaultImage = imageEngine; 775 string imageSmall = ""; 776 string imageMedium = ""; 777 778 if (settings.DisableImageEngine) { 779 defaultImage = settings.Path; 780 } else { 781 if (settings.ImageDefault != null) 782 { 783 defaultImage += getImagePathFromSettings(settings.ImageDefault); 784 785 if (settings.Path.GetType() != typeof(string)) 786 { 787 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 788 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 789 } 790 else 791 { 792 defaultImage += settings.Path != null ? "Image=" + settings.Path : ""; 793 } 794 } 795 796 if (settings.ImageSmall != null) 797 { 798 imageSmall = "data-src-small=\"" + imageEngine; 799 imageSmall += getImagePathFromSettings(settings.ImageSmall); 800 801 if (settings.Path.GetType() != typeof(string)) 802 { 803 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 804 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 805 } 806 else 807 { 808 imageSmall += settings.Path != null ? "Image=" + settings.Path : ""; 809 } 810 811 imageSmall += "\""; 812 } 813 814 if (settings.ImageMedium != null) 815 { 816 imageMedium = "data-src-medium=\"" + imageEngine; 817 imageMedium += getImagePathFromSettings(settings.ImageMedium); 818 819 if (settings.Path.GetType() != typeof(string)) 820 { 821 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 822 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 823 } 824 else 825 { 826 imageMedium += settings.Path != null ? "Image=" + settings.Path : ""; 827 } 828 829 imageMedium += "\""; 830 } 831 } 832 833 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 834 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); } 835 if (!String.IsNullOrEmpty(settings.Title)) { optionalAttributes.Add("alt", settings.Title); } 836 837 if (settings.DisableLazyLoad) { 838 <img class="grid__cell-img @imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) alt="@settings.Path" /> 839 } else { 840 <img class="grid__cell-img b-lazy @imageStyle @settings.CssClass dw-mod" src="@placeholderImage" data-src="@defaultImage" @imageSmall @imageMedium @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) alt="@settings.Path" /> 841 } 842 843 if (settings.Caption != null) 844 { 845 <span class="image-caption dw-mod">@settings.Caption</span> 846 } 847 } 848 } 849 } 850 @using System.Reflection 851 @using Dynamicweb.Rapido.Blocks.Components.General 852 @using Dynamicweb.Rapido.Blocks.Components 853 854 855 @* Component *@ 856 857 @helper RenderTextField(TextField settings) { 858 dynamic[] methodParameters = new dynamic[1]; 859 methodParameters[0] = settings; 860 MethodInfo customMethod = this.GetType().GetMethod("RenderTextFieldCustom"); 861 862 if (customMethod != null) 863 { 864 @customMethod.Invoke(this, methodParameters).ToString(); 865 } else { 866 int maxLength = settings.MaxLength != 0 ? settings.MaxLength : 524288; 867 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 868 if (settings.Type == TextFieldType.Password) { optionalAttributes.Add("autocomplete", "off"); }; 869 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); } 870 if (!String.IsNullOrEmpty(settings.Placeholder)) { optionalAttributes.Add("placeholder", settings.Placeholder); } 871 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); } 872 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); } 873 if (settings.MaxLength != 0) { optionalAttributes.Add("maxlength", settings.MaxLength.ToString()); } 874 875 <div class="form__field-group dw-mod"> 876 @if (!String.IsNullOrEmpty(settings.Label)) 877 { 878 <label for="@settings.Id">@settings.Label</label> 879 } 880 881 <input type="@settings.Type" class="u-full-width @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 882 883 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 884 </div> 885 } 886 } 887 @using System.Reflection 888 @using Dynamicweb.Rapido.Blocks.Components.General 889 @using Dynamicweb.Rapido.Blocks.Components 890 891 892 @* Component *@ 893 894 @helper RenderNumberField(NumberField settings) { 895 dynamic[] methodParameters = new dynamic[1]; 896 methodParameters[0] = settings; 897 MethodInfo customMethod = this.GetType().GetMethod("RenderNumberFieldCustom"); 898 899 if (customMethod != null) 900 { 901 @customMethod.Invoke(this, methodParameters).ToString(); 902 } else { 903 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 904 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); } 905 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); } 906 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); } 907 if (settings.Max != 0) { optionalAttributes.Add("max", settings.Max.ToString()); } 908 if (settings.Min != 0) { optionalAttributes.Add("min", settings.Min.ToString()); } 909 if (settings.Step != 0) { optionalAttributes.Add("step", settings.Step.ToString()); } 910 911 <div class="form__field-group dw-mod"> 912 @if (!String.IsNullOrEmpty(settings.Label)) 913 { 914 <div> 915 <label for="@settings.Id">@settings.Label</label> 916 </div> 917 } 918 919 <input type="Number" class="u-w70px @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 920 921 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 922 </div> 923 } 924 } 925 @using System.Reflection 926 @using Dynamicweb.Rapido.Blocks.Components.General 927 @using Dynamicweb.Rapido.Blocks.Components 928 929 930 @* Component *@ 931 932 @helper RenderTextareaField(TextareaField settings) { 933 dynamic[] methodParameters = new dynamic[1]; 934 methodParameters[0] = settings; 935 MethodInfo customMethod = this.GetType().GetMethod("RenderTextareaFieldCustom"); 936 937 if (customMethod != null) 938 { 939 @customMethod.Invoke(this, methodParameters).ToString(); 940 } else { 941 int maxLength = settings.MaxLength != 0 ? settings.MaxLength : 524288; 942 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 943 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); } 944 if (!String.IsNullOrEmpty(settings.Placeholder)) { optionalAttributes.Add("placeholder", settings.Placeholder); } 945 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); } 946 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); } 947 if (settings.MaxLength != 0) { optionalAttributes.Add("maxlength", settings.MaxLength.ToString()); } 948 if (settings.Rows != 0) { optionalAttributes.Add("rows", settings.Rows.ToString()); } 949 950 <div class="form__field-group dw-mod"> 951 @if (!String.IsNullOrEmpty(@settings.Label)) 952 { 953 <label for="@settings.Id">@settings.Label</label> 954 } 955 956 <textarea class="u-full-width @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)></textarea> 957 958 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 959 </div> 960 } 961 } 962 @using System.Reflection 963 @using Dynamicweb.Rapido.Blocks.Components.General 964 @using Dynamicweb.Rapido.Blocks.Components 965 966 967 @* Component *@ 968 969 @helper RenderHiddenField(HiddenField settings) { 970 dynamic[] methodParameters = new dynamic[1]; 971 methodParameters[0] = settings; 972 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 973 974 if (customMethod != null) 975 { 976 @customMethod.Invoke(this, methodParameters).ToString(); 977 } else { 978 <input type="hidden" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(settings.ExtraAttributes)/> 979 } 980 } 981 @using System.Reflection 982 @using Dynamicweb.Rapido.Blocks.Components.General 983 @using Dynamicweb.Rapido.Blocks.Components 984 985 986 @* Component *@ 987 988 @helper RenderCheckboxField(dynamic settings) { 989 dynamic[] methodParameters = new dynamic[1]; 990 methodParameters[0] = settings; 991 MethodInfo customMethod = this.GetType().GetMethod("RenderCheckboxFieldCustom"); 992 993 if (customMethod != null) 994 { 995 @customMethod.Invoke(this, methodParameters).ToString(); 996 } else { 997 settings.Type = FieldListOptionType.Checkbox; 998 string disabled = settings.Disabled ? "disabled" : ""; 999 string required = settings.Required ? "required" : ""; 1000 string checkedString = settings.Checked == true ? "checked" : ""; 1001 string id = settings.Id != null ? settings.Id : settings.Label.Replace(" ", ""); 1002 1003 <div class="form__field-group dw-mod"> 1004 <input type="checkbox" class="form__control @settings.CssClass @disabled dw-mod" name="@settings.Name" id="@id" value="@settings.Value" onclick="@settings.OnClick" @disabled @required @checkedString @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 1005 1006 @if (!String.IsNullOrEmpty(settings.Label)) 1007 { 1008 <label for="@id" class="@disabled dw-mod">@settings.Label</label> 1009 } 1010 1011 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 1012 </div> 1013 } 1014 } 1015 @using System.Reflection 1016 @using Dynamicweb.Rapido.Blocks.Components.General 1017 @using Dynamicweb.Rapido.Blocks.Components 1018 1019 1020 @* Component *@ 1021 1022 @helper RenderCheckboxListField(CheckboxListField settings) { 1023 dynamic[] methodParameters = new dynamic[1]; 1024 methodParameters[0] = settings; 1025 MethodInfo customMethod = this.GetType().GetMethod("RenderCheckboxListFieldCustom"); 1026 1027 if (customMethod != null) 1028 { 1029 @customMethod.Invoke(this, methodParameters).ToString(); 1030 } else { 1031 string disabled = settings.Disabled ? "disabled" : ""; 1032 1033 <div class="form__field-group @settings.CssClass u-margin-bottom @disabled dw-mod" @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1034 @if (!String.IsNullOrEmpty(settings.Label)) 1035 { 1036 <div class="u-bold u-margin-bottom">@settings.Label</div> 1037 } 1038 1039 @foreach (var item in settings.Options) 1040 { 1041 item.Type = FieldListOptionType.Checkbox; 1042 @RenderFieldListOption(item) 1043 } 1044 1045 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 1046 </div> 1047 } 1048 } 1049 1050 @using System.Reflection 1051 @using Dynamicweb.Rapido.Blocks.Components.General 1052 @using Dynamicweb.Rapido.Blocks.Components 1053 1054 1055 @* Component *@ 1056 1057 @helper RenderSelectField(SelectField settings) { 1058 dynamic[] methodParameters = new dynamic[1]; 1059 methodParameters[0] = settings; 1060 MethodInfo customMethod = this.GetType().GetMethod("RenderSelectFieldCustom"); 1061 1062 if (customMethod != null) 1063 { 1064 @customMethod.Invoke(this, methodParameters).ToString(); 1065 } else { 1066 string disabled = settings.Disabled ? "disabled" : ""; 1067 string required = settings.Required ? "required" : ""; 1068 1069 if (settings.Default != null) 1070 { 1071 settings.Default.Type = FieldListOptionType.SelectOption; 1072 } 1073 1074 <div class="form__field-group u-full-width dw-mod"> 1075 @if (!String.IsNullOrEmpty(settings.Label)) 1076 { 1077 <label for="@settings.Id">@settings.Label</label> 1078 } 1079 1080 <div class="form__field-combi u-no-margin dw-mod"> 1081 <select id="@settings.Id" class="u-full-width @settings.CssClass dw-mod" onchange="@settings.OnChange" @ComponentMethods.AddAttributes(settings.ExtraAttributes) > 1082 @if (settings.Default.Value != null) 1083 { 1084 @RenderFieldListOption(settings.Default) 1085 } 1086 1087 @foreach (var item in settings.Options) 1088 { 1089 item.Type = FieldListOptionType.SelectOption; 1090 @RenderFieldListOption(item) 1091 } 1092 </select> 1093 @if (settings.ActionButton.Link != null || settings.ActionButton.OnClick != null) { 1094 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1095 @RenderButton(settings.ActionButton); 1096 } 1097 </div> 1098 1099 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 1100 </div> 1101 } 1102 } 1103 @using System.Reflection 1104 @using Dynamicweb.Rapido.Blocks.Components.General 1105 @using Dynamicweb.Rapido.Blocks.Components 1106 1107 1108 @* Component *@ 1109 1110 @helper RenderRadioButtonField(RadioButtonField settings) { 1111 dynamic[] methodParameters = new dynamic[1]; 1112 methodParameters[0] = settings; 1113 MethodInfo customMethod = this.GetType().GetMethod("RenderRadioButtonFieldCustom"); 1114 1115 if (customMethod != null) 1116 { 1117 @customMethod.Invoke(this, methodParameters).ToString(); 1118 } else { 1119 string disabled = settings.Disabled ? "disabled" : ""; 1120 1121 <div class="form__field-group @settings.CssClass u-margin-bottom @disabled" @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1122 @if (!String.IsNullOrEmpty(settings.Label)) 1123 { 1124 <div class="u-bold u-margin-bottom">@settings.Label</div> 1125 } 1126 1127 @foreach (var item in settings.Options) 1128 { 1129 item.Type = FieldListOptionType.RadioButton; 1130 1131 if (settings.Name != null) 1132 { 1133 item.Name = settings.Name; 1134 } 1135 1136 if (settings.RenderOptionsInline) 1137 { 1138 @RenderFieldListOption(item) 1139 } 1140 else 1141 { 1142 <div> 1143 @RenderFieldListOption(item) 1144 </div> 1145 } 1146 } 1147 1148 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 1149 </div> 1150 } 1151 } 1152 @using System.Reflection 1153 @using Dynamicweb.Rapido.Blocks.Components.General 1154 @using Dynamicweb.Rapido.Blocks.Components 1155 1156 1157 @* Component *@ 1158 1159 @helper RenderNotificationMessage(NotificationMessage settings) { 1160 dynamic[] methodParameters = new dynamic[1]; 1161 methodParameters[0] = settings; 1162 MethodInfo customMethod = this.GetType().GetMethod("RenderNotificationMessageCustom"); 1163 1164 if (customMethod != null) 1165 { 1166 @customMethod.Invoke(this, methodParameters).ToString(); 1167 } else { 1168 if (!String.IsNullOrEmpty(settings.Message)) 1169 { 1170 string messageTypeClass = settings.MessageType.ToString().ToLower(); 1171 <div class="field-@messageTypeClass @settings.CssClass u-full-width dw-mod">@settings.Message</div> 1172 } 1173 } 1174 } 1175 @using System.Reflection 1176 @using Dynamicweb.Rapido.Blocks.Components.General 1177 1178 1179 @* Component *@ 1180 1181 @helper RenderHandlebarsRoot(HandlebarsRoot settings) { 1182 dynamic[] methodParameters = new dynamic[1]; 1183 methodParameters[0] = settings; 1184 MethodInfo customMethod = this.GetType().GetMethod("RenderHandlebarsRootCustom"); 1185 1186 if (customMethod != null) 1187 { 1188 @customMethod.Invoke(this, methodParameters).ToString(); 1189 } else { 1190 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : ""; 1191 1192 <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> 1193 @if (settings.SubBlocks != null) { 1194 @RenderBlockList(settings.SubBlocks) 1195 } 1196 </div> 1197 } 1198 } 1199 @using System.Reflection 1200 @using Dynamicweb.Rapido.Blocks.Components.General 1201 @using Dynamicweb.Rapido.Blocks.Components 1202 @using System.Text.RegularExpressions 1203 1204 1205 @* Component *@ 1206 1207 @helper RenderSticker(Sticker settings) { 1208 dynamic[] methodParameters = new dynamic[1]; 1209 methodParameters[0] = settings; 1210 MethodInfo customMethod = this.GetType().GetMethod("RenderStickerCustom"); 1211 1212 if (customMethod != null) 1213 { 1214 @customMethod.Invoke(this, methodParameters).ToString(); 1215 } 1216 else 1217 { 1218 if (!String.IsNullOrEmpty(settings.Title)) { 1219 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : ""; 1220 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : ""; 1221 1222 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 1223 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) { 1224 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : ""; 1225 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : ""; 1226 optionalAttributes.Add("style", styleTag); 1227 } 1228 1229 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div> 1230 } 1231 } 1232 } 1233 1234 @using System.Reflection 1235 @using Dynamicweb.Rapido.Blocks.Components.General 1236 @using Dynamicweb.Rapido.Blocks.Components 1237 1238 1239 @* Component *@ 1240 1241 @helper RenderStickersCollection(StickersCollection settings) { 1242 dynamic[] methodParameters = new dynamic[1]; 1243 methodParameters[0] = settings; 1244 MethodInfo customMethod = this.GetType().GetMethod("RenderStickersCollectionCustom"); 1245 1246 if (customMethod != null) 1247 { 1248 @customMethod.Invoke(this, methodParameters).ToString(); 1249 } 1250 else 1251 { 1252 if (settings.Stickers.Count > 0) { 1253 string position = settings.Position != null ? "" + "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower() : ""; 1254 1255 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1256 @foreach (Sticker sticker in settings.Stickers) 1257 { 1258 @RenderSticker(sticker) 1259 } 1260 </div> 1261 } 1262 } 1263 } 1264 1265 @using System.Reflection 1266 @using Dynamicweb.Rapido.Blocks.Components.General 1267 @using Dynamicweb.Rapido.Blocks.Components 1268 1269 1270 1271 @* Component *@ 1272 1273 @helper RenderField(Field settings) { 1274 dynamic[] methodParameters = new dynamic[1]; 1275 methodParameters[0] = settings; 1276 MethodInfo customMethod = this.GetType().GetMethod("RenderFieldCustom"); 1277 1278 if (customMethod != null) 1279 { 1280 @customMethod.Invoke(this, methodParameters).ToString(); 1281 } else { 1282 switch (settings.FieldType) 1283 { 1284 case FieldType.Checkbox: 1285 CheckboxField checkbox = new CheckboxField 1286 { 1287 Label = settings.Label, 1288 Id = settings.Id, 1289 Name = settings.Label.Replace(" ", ""), 1290 Value = settings.Value, 1291 Checked = Convert.ToBoolean(settings.Placeholder), 1292 OnClick = settings.OnClick, 1293 Disabled = settings.Disabled, 1294 Required = settings.Required, 1295 CssClass = settings.CssClass, 1296 ExtraAttributes = settings.ExtraAttributes, 1297 ErrorMessage = settings.ErrorMessage 1298 }; 1299 1300 @RenderCheckboxField(checkbox) 1301 break; 1302 case FieldType.Email: 1303 TextField emailField = new TextField 1304 { 1305 Label = settings.Label != null ? settings.Label : Translate("Email"), 1306 Id = settings.Id, 1307 Value = settings.Value, 1308 OnClick = settings.OnClick, 1309 Disabled = settings.Disabled, 1310 Required = settings.Required, 1311 CssClass = settings.CssClass, 1312 ExtraAttributes = settings.ExtraAttributes, 1313 ErrorMessage = settings.ErrorMessage, 1314 Placeholder = settings.Placeholder, 1315 Type = TextFieldType.Email 1316 }; 1317 1318 @RenderTextField(emailField) 1319 break; 1320 case FieldType.Hidden: 1321 HiddenField hiddenField = new HiddenField 1322 { 1323 Label = settings.Label, 1324 Id = settings.Id, 1325 Value = settings.Value, 1326 Disabled = settings.Disabled, 1327 Required = settings.Required, 1328 CssClass = settings.CssClass, 1329 ExtraAttributes = settings.ExtraAttributes, 1330 ErrorMessage = settings.ErrorMessage 1331 }; 1332 1333 @RenderHiddenField(hiddenField) 1334 break; 1335 case FieldType.Integer: 1336 NumberField numberField = new NumberField 1337 { 1338 Label = settings.Label, 1339 Id = settings.Id, 1340 Value = settings.Value.GetType() == typeof(int) ? Convert.ToInt32(settings.Value) : 1, 1341 OnClick = settings.OnClick, 1342 Disabled = settings.Disabled, 1343 Required = settings.Required, 1344 CssClass = settings.CssClass, 1345 ExtraAttributes = settings.ExtraAttributes, 1346 ErrorMessage = settings.ErrorMessage, 1347 Step = 1 1348 }; 1349 1350 @RenderNumberField(numberField) 1351 break; 1352 case FieldType.Password: 1353 TextField passwordField = new TextField 1354 { 1355 Label = settings.Label != null ? settings.Label : Translate("Password"), 1356 Id = settings.Id, 1357 Value = settings.Value, 1358 OnClick = settings.OnClick, 1359 Disabled = settings.Disabled, 1360 Required = settings.Required, 1361 CssClass = settings.CssClass, 1362 ExtraAttributes = settings.ExtraAttributes, 1363 ErrorMessage = settings.ErrorMessage, 1364 Placeholder = settings.Placeholder, 1365 Type = TextFieldType.Password 1366 }; 1367 1368 @RenderTextField(passwordField) 1369 break; 1370 case FieldType.Reset: 1371 Button resetField = new Button 1372 { 1373 Title = settings.Label != null ? settings.Label : Translate("Reset"), 1374 Id = settings.Id, 1375 OnClick = settings.OnClick, 1376 Disabled = settings.Disabled, 1377 CssClass = settings.CssClass, 1378 ExtraAttributes = settings.ExtraAttributes, 1379 ButtonLayout = ButtonLayout.Secondary, 1380 ButtonType = ButtonType.Reset 1381 }; 1382 1383 @RenderButton(resetField) 1384 break; 1385 case FieldType.Submit: 1386 Button submitField = new Button 1387 { 1388 Title = settings.Label != null ? settings.Label : Translate("Submit"), 1389 Id = settings.Id, 1390 OnClick = settings.OnClick, 1391 Disabled = settings.Disabled, 1392 CssClass = settings.CssClass, 1393 ExtraAttributes = settings.ExtraAttributes, 1394 ButtonLayout = ButtonLayout.Primary, 1395 ButtonType = ButtonType.Submit 1396 }; 1397 1398 @RenderButton(submitField) 1399 break; 1400 case FieldType.Tel: 1401 TextField telField = new TextField 1402 { 1403 Label = settings.Label != null ? settings.Label : Translate("Phone"), 1404 Id = settings.Id, 1405 Value = settings.Value, 1406 OnClick = settings.OnClick, 1407 Disabled = settings.Disabled, 1408 Required = settings.Required, 1409 CssClass = settings.CssClass, 1410 ExtraAttributes = settings.ExtraAttributes, 1411 ErrorMessage = settings.ErrorMessage, 1412 Placeholder = settings.Placeholder, 1413 Type = TextFieldType.Tel 1414 }; 1415 1416 @RenderTextField(telField) 1417 break; 1418 case FieldType.Text: 1419 TextField textField = new TextField 1420 { 1421 Label = settings.Label, 1422 Id = settings.Id, 1423 Value = settings.Value, 1424 OnClick = settings.OnClick, 1425 Disabled = settings.Disabled, 1426 Required = settings.Required, 1427 CssClass = settings.CssClass, 1428 ExtraAttributes = settings.ExtraAttributes, 1429 ErrorMessage = settings.ErrorMessage, 1430 Placeholder = settings.Placeholder, 1431 Type = TextFieldType.Text 1432 }; 1433 1434 @RenderTextField(textField) 1435 break; 1436 case FieldType.Textarea: 1437 TextareaField textareaField = new TextareaField 1438 { 1439 Label = settings.Label, 1440 Id = settings.Id, 1441 Value = settings.Value, 1442 OnClick = settings.OnClick, 1443 Disabled = settings.Disabled, 1444 Required = settings.Required, 1445 CssClass = settings.CssClass, 1446 ExtraAttributes = settings.ExtraAttributes, 1447 ErrorMessage = settings.ErrorMessage, 1448 Placeholder = settings.Placeholder 1449 }; 1450 1451 @RenderTextareaField(textareaField) 1452 break; 1453 default: 1454 TextField defaultField = new TextField 1455 { 1456 Label = settings.Label, 1457 Id = settings.Id, 1458 Value = settings.Value, 1459 OnClick = settings.OnClick, 1460 Disabled = settings.Disabled, 1461 Required = settings.Required, 1462 CssClass = settings.CssClass, 1463 ExtraAttributes = settings.ExtraAttributes, 1464 ErrorMessage = settings.ErrorMessage, 1465 Placeholder = settings.Placeholder, 1466 Type = TextFieldType.Text 1467 }; 1468 1469 @RenderTextField(defaultField) 1470 break; 1471 } 1472 } 1473 } 1474 1475 1476 @using Dynamicweb.Frontend 1477 @using System.Reflection 1478 @using Dynamicweb.Content.Items 1479 @using System.Web.UI.HtmlControls 1480 @using Dynamicweb.Rapido.Blocks.Components 1481 @using Dynamicweb.Rapido.Blocks 1482 1483 1484 @* Components for the articles - Remeber to make a NZ copy of this template - and change line NZheader.cshtml to [Include file 'NZHeader.cshtml' not found in 'Templates/Designs/Rapido/Components/ArticleComponents.cshtml'] *@ 1485 @using System.Reflection 1486 @using Dynamicweb.Rapido.Blocks.Components.Articles 1487 @using System.Text.RegularExpressions 1488 1489 1490 @* Component for the articles *@ 1491 1492 @helper RenderArticleBanner(dynamic settings) 1493 { 1494 string headline = settings.Heading; 1495 //Video 1496 //getting video ID from youtube URL 1497 string videoCode = ""; 1498 var userAgent = HttpContext.Current.Request.UserAgent.ToString(); 1499 1500 bool ie9String = userAgent.Contains("Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"); 1501 bool ie10String = userAgent.Contains("Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)"); 1502 bool ie11String = userAgent.Contains("Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko"); 1503 Regex regex = new Regex(@".be\/(.[^?]*)"); 1504 Match match = regex.Match(videoCode); 1505 1506 string videoId = ""; 1507 if (match.Success) 1508 { 1509 videoId = match.Groups[1].Value; 1510 } 1511 else 1512 { 1513 regex = new Regex(@"v=([^&]+)"); 1514 match = regex.Match(videoCode); 1515 if (match.Success) 1516 { 1517 videoId = match.Groups[1].Value; 1518 } 1519 } 1520 1521 string heroHeight = string.IsNullOrEmpty(videoCode) ? "heroheight" : ""; 1522 1523 string placeHolderImage = "/Files/Images/placeholder.gif"; 1524 string backgroundImage = ""; 1525 string backgroundImageLarge = ""; 1526 string backgroundImageMedium = ""; 1527 string backgroundImageSmall = ""; 1528 int backgroundImageWidth = 2500; 1529 int backgroundImageLargeWidth = 1440; 1530 int backgroundImageMediumWidth = 1300; 1531 int backgroundImageSmallWidth = 1024; 1532 1533 if (settings.Image != null) 1534 { 1535 string focalPointParameters = settings.Image.Path != null ? "&" + settings.Image.Path.GetFocalPointParameters() : ""; 1536 backgroundImage = "/Admin/Public/GetImage.ashx?width=" + backgroundImageWidth + "&amp;height=1100&amp;crop=7" + "&amp;Compression=85&amp;DoNotUpscale=true&amp;image=" + settings.Image.Path + focalPointParameters; 1537 backgroundImageLarge = "/Admin/Public/GetImage.ashx?width=" + backgroundImageLargeWidth + "&amp;height=370&amp;crop=7" + "&amp;Compression=85&amp;DoNotUpscale=true&amp;image=" + settings.Image.Path + focalPointParameters; 1538 backgroundImageMedium = "/Admin/Public/GetImage.ashx?width=" + backgroundImageMediumWidth + "&amp;height=572&amp;crop=7" + "&amp;Compression=85&amp;DoNotUpscale=true&amp;image=" + settings.Image.Path + focalPointParameters; 1539 backgroundImageSmall = "/Admin/Public/GetImage.ashx?width=" + backgroundImageSmallWidth + "&amp;height=450&amp;crop=7" + "&amp;Compression=85&amp;DoNotUpscale=true&amp;image=" + settings.Image.Path + focalPointParameters; 1540 } 1541 1542 string imageAlt = ""; 1543 imageAlt = settings.Image.Path.ToString(); 1544 1545 dynamic[] methodParameters = new dynamic[1]; 1546 methodParameters[0] = settings; 1547 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerCustom"); 1548 1549 var ieClass = ie10String || ie9String || ie11String ? "ie-hero" : ""; 1550 1551 if (customMethod != null) 1552 { 1553 @customMethod.Invoke(this, methodParameters).ToString(); 1554 } 1555 else 1556 { 1557 settings.Layout = ArticleHeaderLayout.Banner; 1558 1559 if (settings.Image != null) 1560 { 1561 if (settings.Image.Path != null) 1562 { 1563 <div class="grid__col-md-12 grid__col--bleed u-padding-bottom--lg"> 1564 <section class="@ieClass hero multiple-paragraphs-container paragraph-container grid--justify-center"> 1565 <div class="background-image image-filter"> 1566 <div class="background-image__wrapper image-filter"> 1567 <img class="background-image__cover dw-mod b-lazy" src="@placeHolderImage" data-src="@backgroundImage" data-src-small="@backgroundImageSmall" data-src-medium="@backgroundImageMedium" data-src-large="@backgroundImageLarge" alt="@imageAlt"> 1568 @if (!string.IsNullOrEmpty(videoCode)) 1569 { 1570 1571 <div class="video-background"> 1572 <div class="video-background__container"> 1573 <div class="js-youtube-video" data-video="@videoCode" id="ytPlayer"></div> 1574 </div> 1575 </div> 1576 } 1577 </div> 1578 </div> 1579 <div class="grid paragraph-container--height-xl @heroHeight grid--justify-center dw-mod"> 1580 <div class="grid__col-sm-12 grid__col-xs-12 paragraph-container dw-mod grid--justify-center "> 1581 </div> 1582 </div> 1583 @if (ie10String || ie9String || ie11String) 1584 { 1585 <svg class="ie-svg-header-without-text" width="1440px" height="203px" viewBox="0 0 1440 203" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> 1586 <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> 1587 <g id="shop_forside_1" transform="translate(0.000000, -376.000000)" fill="#FFFFFF"> 1588 <path d="M0,578.015878 L1440,578.015878 C1885.14583,319.758548 1885.14583,252.418132 1440,375.994629 C994.854167,499.571126 514.854167,566.911543 0,578.015878 Z" id="Path"></path> 1589 </g> 1590 </g> 1591 </svg> 1592 } 1593 1594 else 1595 { 1596 <svg width="1440px" height="203px" viewBox="0 0 1440 203" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> 1597 <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> 1598 <g id="shop_forside_1" transform="translate(0.000000, -376.000000)" fill="#FFFFFF"> 1599 <path d="M0,578.015878 L1440,578.015878 C1885.14583,319.758548 1885.14583,252.418132 1440,375.994629 C994.854167,499.571126 514.854167,566.911543 0,578.015878 Z" id="Path"></path> 1600 </g> 1601 </g> 1602 </svg> 1603 } 1604 </section> 1605 </div> 1606 } 1607 else 1608 { 1609 settings.Layout = ArticleHeaderLayout.Clean; 1610 @RenderArticleCleanHeader(settings); 1611 } 1612 } 1613 else 1614 { 1615 settings.Layout = ArticleHeaderLayout.Clean; 1616 @RenderArticleCleanHeader(settings); 1617 } 1618 1619 if (!String.IsNullOrEmpty(headline)) 1620 { 1621 <h1 class="article__leadtext dw-mod grid-custom-layout-third">@headline</h1> 1622 1623 } 1624 } 1625 } 1626 @using System.Reflection 1627 @using Dynamicweb.Frontend 1628 @using Dynamicweb.Rapido.Blocks.Components 1629 @using Dynamicweb.Rapido.Blocks.Components.General 1630 @using Dynamicweb.Rapido.Blocks.Components.Articles 1631 @using Dynamicweb.Rapido.Blocks 1632 @using S_DW_HD2412.CustomCode 1633 1634 1635 1636 @* Component for the articles *@ 1637 1638 @helper RenderArticleHeaderExtended(ArticleHeaderExtended settings) 1639 { 1640 dynamic[] methodParameters = new dynamic[1]; 1641 methodParameters[0] = settings; 1642 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleHeaderCustom"); 1643 1644 if (customMethod != null) 1645 { 1646 @customMethod.Invoke(this, methodParameters).ToString(); 1647 } 1648 else 1649 { 1650 switch (settings.Layout) 1651 { 1652 case ArticleHeaderLayout.Clean: 1653 @RenderArticleCleanHeader(settings); 1654 break; 1655 case ArticleHeaderLayout.Split: 1656 @RenderArticleSplitHeader(settings); 1657 break; 1658 case ArticleHeaderLayout.Banner: 1659 @RenderArticleBannerHeader(settings); 1660 break; 1661 case ArticleHeaderLayout.Overlay: 1662 @RenderArticleOverlayHeader(settings); 1663 break; 1664 default: 1665 @RenderArticleCleanHeader(settings); 1666 break; 1667 } 1668 } 1669 } 1670 1671 @helper RenderArticleCleanHeader(ArticleHeader settings) 1672 { 1673 dynamic[] methodParameters = new dynamic[1]; 1674 methodParameters[0] = settings; 1675 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom"); 1676 1677 if (customMethod != null) 1678 { 1679 @customMethod.Invoke(this, methodParameters).ToString(); 1680 } 1681 else 1682 { 1683 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 1684 1685 <div class="grid grid--align-content-start grid--justify-start"> 1686 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod"> 1687 1688 1689 <div class="grid__cell"> 1690 @if (settings.Image != null) 1691 { 1692 if (settings.Image.Path != null) 1693 { 1694 <div class="u-padding-bottom--lg"> 1695 @RenderImage(settings.Image) 1696 </div> 1697 1698 } 1699 } 1700 1701 @if (!String.IsNullOrEmpty(settings.Heading)) 1702 { 1703 1704 //Check to hide heading if the item is not a Dynamic Article 1705 var ItemName = PageView.Current().Item.SystemName; 1706 1707 if (ItemName == "DynamicArticle") 1708 { 1709 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 1710 } 1711 1712 else 1713 { 1714 } 1715 1716 } 1717 1718 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0) 1719 { 1720 <div class="u-padding-bottom"> 1721 @*@if (!String.IsNullOrEmpty(settings.Category)) 1722 { 1723 <div class="u-pull--left"> 1724 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 1725 </div> 1726 }*@ 1727 <div class=""> 1728 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1729 { 1730 <small class="article__post-info dw-mod">@Translate("Author"): @settings.Author, @settings.Date</small> 1731 } 1732 @*@if (settings.RatingOutOf != 0) 1733 { 1734 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 1735 }*@ 1736 </div> 1737 </div> 1738 1739 } 1740 1741 @if (!String.IsNullOrEmpty(settings.Subheading)) 1742 { 1743 <div class="article__leadtext news-article-leadtext dw-mod">@settings.Subheading</div> 1744 } 1745 @if (!String.IsNullOrEmpty(settings.Link)) 1746 { 1747 <div class="grid__cell"> 1748 @RenderButton(new Button { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 1749 </div> 1750 } 1751 </div> 1752 </div> 1753 @if (settings.ExternalParagraphId != 0) 1754 { 1755 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod"> 1756 @RenderParagraphContent(settings.ExternalParagraphId) 1757 </div> 1758 } 1759 </div> 1760 } 1761 } 1762 1763 @helper RenderArticleSplitHeader(ArticleHeader settings) 1764 { 1765 dynamic[] methodParameters = new dynamic[1]; 1766 methodParameters[0] = settings; 1767 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSplitHeaderCustom"); 1768 1769 if (customMethod != null) 1770 { 1771 @customMethod.Invoke(this, methodParameters).ToString(); 1772 } 1773 else 1774 { 1775 string headerColumnWidth = settings.ExternalParagraphId != 0 ? "4" : "6"; 1776 1777 if (settings.Image != null) 1778 { 1779 if (settings.Image.Path != null) 1780 { 1781 <section class="multiple-paragraphs-container paragraph-container--full-width"> 1782 <div class="grid"> 1783 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod"> 1784 <div class="u-left-middle u-padding--lg"> 1785 <div> 1786 @if (!String.IsNullOrEmpty(settings.Category)) 1787 { 1788 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 1789 } 1790 @if (!String.IsNullOrEmpty(settings.Heading)) 1791 { 1792 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 1793 } 1794 @if (!String.IsNullOrEmpty(settings.Subheading)) 1795 { 1796 <div class="article__leadtext dw-mod">@settings.Subheading</div> 1797 } 1798 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1799 { 1800 <small class="article__post-info u-pull--left dw-mod">@settings.Author @settings.Date</small> 1801 } 1802 @if (settings.RatingOutOf != 0) 1803 { 1804 <div class="u-pull--right"> 1805 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 1806 </div> 1807 } 1808 @if (!String.IsNullOrEmpty(settings.Link)) 1809 { 1810 @RenderButton(new Button { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 1811 } 1812 </div> 1813 </div> 1814 </div> 1815 <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> 1816 @if (settings.ExternalParagraphId != 0) 1817 { 1818 <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"> 1819 @RenderParagraphContent(settings.ExternalParagraphId) 1820 </div> 1821 } 1822 </div> 1823 </section> 1824 } 1825 } 1826 else 1827 { 1828 @RenderArticleCleanHeader(settings); 1829 } 1830 } 1831 } 1832 1833 @helper RenderArticleOverlayHeader(ArticleHeader settings) 1834 { 1835 dynamic[] methodParameters = new dynamic[1]; 1836 methodParameters[0] = settings; 1837 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleOverlayHeaderCustom"); 1838 1839 if (customMethod != null) 1840 { 1841 @customMethod.Invoke(this, methodParameters).ToString(); 1842 } 1843 else 1844 { 1845 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 1846 string contentAlignment = settings.TextLayout == ArticleHeaderTextLayout.Center ? "grid--justify-center" : ""; 1847 1848 if (settings.Image != null) 1849 { 1850 if (settings.Image.Path != null) 1851 { 1852 if (settings.ExternalParagraphId == 0) 1853 { 1854 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> 1855 <div class="background-image image-filter image-filter--darken dw-mod"> 1856 <div class="background-image__wrapper image-filter image-filter--darken dw-mod"> 1857 @{ 1858 settings.Image.CssClass += "background-image__cover dw-mod"; 1859 } 1860 @RenderImage(settings.Image) 1861 </div> 1862 </div> 1863 <div class="center-container dw-mod"> 1864 <div class="grid @contentAlignment"> 1865 <div class="grid__col-md-@contentColumns grid__col-xs-12 paragraph-container paragraph-container--height-xl u-no-padding dw-mod"> 1866 @if (!String.IsNullOrEmpty(settings.Heading)) 1867 { 1868 <h1 class="article__header article__header--giant u-padding-top--lg dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> 1869 } 1870 @if (!String.IsNullOrEmpty(settings.Subheading)) 1871 { 1872 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> 1873 } 1874 <div class="u-margin-top"> 1875 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1876 { 1877 <small class="article__post-info u-pull--left dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> 1878 } 1879 @if (settings.RatingOutOf != 0) 1880 { 1881 <div class="u-pull--right"> 1882 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 1883 </div> 1884 } 1885 </div> 1886 @if (!String.IsNullOrEmpty(settings.Link)) 1887 { 1888 <div class="grid__cell"> 1889 @RenderButtonExtended(new ButtonExtended { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 1890 </div> 1891 } 1892 </div> 1893 </div> 1894 </div> 1895 </section> 1896 } 1897 else 1898 { 1899 @RenderArticleBanner(settings); 1900 } 1901 } 1902 } 1903 else 1904 { 1905 @RenderArticleCleanHeader(settings); 1906 } 1907 } 1908 } 1909 1910 @helper RenderArticleBannerHeader(dynamic settings) 1911 { 1912 dynamic[] methodParameters = new dynamic[1]; 1913 methodParameters[0] = settings; 1914 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerHeaderCustom"); 1915 1916 if (customMethod != null) 1917 { 1918 @customMethod.Invoke(this, methodParameters).ToString(); 1919 } 1920 else 1921 { 1922 @RenderArticleBanner(settings); 1923 } 1924 } 1925 1926 1927 @using System.Reflection 1928 @using System.Text.RegularExpressions; 1929 @using Dynamicweb.Frontend 1930 @using Dynamicweb.Content.Items 1931 @using Dynamicweb.Rapido.Blocks.Components 1932 @using Dynamicweb.Rapido.Blocks.Components.Articles 1933 @using Dynamicweb.Rapido.Blocks 1934 1935 @* Component for the articles *@ 1936 1937 @helper RenderArticleBodyRow(ArticleBodyRow settings) 1938 { 1939 dynamic[] methodParameters = new dynamic[1]; 1940 methodParameters[0] = settings; 1941 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBodyRowCustom"); 1942 1943 if (customMethod != null) 1944 { 1945 @customMethod.Invoke(this, methodParameters).ToString(); 1946 } else { 1947 string position = settings.TopLayout == "overlay" ? "article__overlay-offset" : ""; 1948 string contentAlignment = settings.TextLayout == "center" ? "grid--justify-center" : ""; 1949 1950 <div class="grid grid--align-content-start @contentAlignment @position dw-mod"> 1951 @RenderBlockList(settings.SubBlocks) 1952 </div> 1953 } 1954 } 1955 @using System.Reflection 1956 @using Dynamicweb.Rapido.Blocks.Components 1957 @using Dynamicweb.Rapido.Blocks.Components.General 1958 @using Dynamicweb.Rapido.Blocks.Components.Articles 1959 @using Dynamicweb.Rapido.Blocks 1960 1961 @* Component for the articles *@ 1962 1963 @helper RenderArticleImage(ArticleImage settings) 1964 { 1965 dynamic[] methodParameters = new dynamic[1]; 1966 methodParameters[0] = settings; 1967 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleImageCustom"); 1968 1969 if (customMethod != null) 1970 { 1971 @customMethod.Invoke(this, methodParameters).ToString(); 1972 } 1973 else 1974 { 1975 if (settings.Image != null) 1976 { 1977 if (settings.Image.Path != null) 1978 { 1979 <div class="u-margin-bottom--lg"> 1980 @RenderImage(settings.Image) 1981 </div> 1982 } 1983 } 1984 } 1985 } 1986 @using System.Reflection 1987 @using Dynamicweb.Rapido.Blocks.Components 1988 @using Dynamicweb.Rapido.Blocks.Components.Articles 1989 1990 1991 @* Component for the articles *@ 1992 1993 @helper RenderArticleSubHeader(ArticleSubHeader settings) 1994 { 1995 dynamic[] methodParameters = new dynamic[1]; 1996 methodParameters[0] = settings; 1997 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSubHeaderCustom"); 1998 1999 if (customMethod != null) 2000 { 2001 @customMethod.Invoke(this, methodParameters).ToString(); 2002 } else { 2003 if (!String.IsNullOrEmpty(settings.Title)) 2004 { 2005 <h2 class="article__header">@settings.Title</h2> 2006 } 2007 } 2008 } 2009 @using System.Reflection 2010 @using Dynamicweb.Rapido.Blocks.Components 2011 @using Dynamicweb.Rapido.Blocks.Components.Articles 2012 @using Dynamicweb.Rapido.Blocks 2013 2014 2015 @* Component for the articles *@ 2016 2017 @helper RenderArticleText(ArticleText settings) 2018 { 2019 dynamic[] methodParameters = new dynamic[1]; 2020 methodParameters[0] = settings; 2021 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleTextCustom"); 2022 2023 if (customMethod != null) 2024 { 2025 @customMethod.Invoke(this, methodParameters).ToString(); 2026 } else { 2027 if (!String.IsNullOrEmpty(settings.Text)) 2028 { 2029 string greatTextClass = settings.EnableLargeText == true ? "article__paragraph--great-text" : ""; 2030 2031 <div class="article__paragraph @greatTextClass"> 2032 @settings.Text 2033 </div> 2034 } 2035 } 2036 } 2037 @using System.Reflection 2038 @using Dynamicweb.Rapido.Blocks.Components 2039 @using Dynamicweb.Rapido.Blocks.Components.Articles 2040 @using Dynamicweb.Rapido.Blocks 2041 2042 2043 @* Component for the articles - REMEMBER TO MAKE NZ COPY OF THIS AND REFERENCE IT IN DYNAMICLISTPAGE.CSHTML *@ 2044 2045 @helper RenderArticleQuote(ArticleQuote settings) 2046 { 2047 dynamic[] methodParameters = new dynamic[1]; 2048 methodParameters[0] = settings; 2049 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleQuoteCustom"); 2050 2051 if (customMethod != null) 2052 { 2053 @customMethod.Invoke(this, methodParameters).ToString(); 2054 } else { 2055 string text = Regex.Replace(settings.Text, "<.*?>", String.Empty); 2056 2057 <div class="grid u-padding-bottom--lg"> 2058 @if (settings.Image != null) 2059 { 2060 if (settings.Image.Path != null) { 2061 <div class="grid__col-md-3 grid__col-12"> 2062 <div class="grid__cell-img"> 2063 @{ 2064 settings.Image.Title = !String.IsNullOrEmpty(settings.Image.Title) ? settings.Image.Title : settings.Author; 2065 settings.Image.CssClass += " article__image article__image--square"; 2066 settings.Image.ImageDefault.Width = 200; 2067 settings.Image.ImageDefault.Height = 200; 2068 } 2069 @RenderImage(settings.Image) 2070 </div> 2071 </div> 2072 } 2073 } 2074 <div class="grid__col-auto"> 2075 <div class="custombackground"> 2076 @if (!String.IsNullOrEmpty(settings.Text)) 2077 { 2078 <div class="article__quote dw-mod"> 2079 @settings.Text 2080 </div> 2081 } 2082 @if (!String.IsNullOrEmpty(settings.Author)) 2083 { 2084 <div class="article__quote-author dw-mod"> 2085 - @settings.Author 2086 </div> 2087 } 2088 </div> 2089 </div> 2090 </div> 2091 } 2092 } 2093 @using System.Reflection 2094 @using Dynamicweb.Rapido.Blocks.Components 2095 @using Dynamicweb.Rapido.Blocks.Components.Articles 2096 @using Dynamicweb.Rapido.Blocks 2097 2098 @* Component for the articles *@ 2099 2100 @helper RenderArticleInfoTable(ArticleInfoTable settings) 2101 { 2102 dynamic[] methodParameters = new dynamic[1]; 2103 methodParameters[0] = settings; 2104 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleInfoTableCustom"); 2105 2106 if (customMethod != null) 2107 { 2108 @customMethod.Invoke(this, methodParameters).ToString(); 2109 } else { 2110 <h3>@Translate("Facts")</h3> 2111 <table class="table table--clean"> 2112 @foreach (var row in settings.Rows) 2113 { 2114 string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two"; 2115 2116 <tr> 2117 @if (!String.IsNullOrEmpty(row.Icon)) 2118 { 2119 <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td> 2120 } 2121 <td class="u-no-margin-on-p-elements"> 2122 <div class="u-bold">@row.Title</div> 2123 @if (!String.IsNullOrEmpty(row.SubTitle)) 2124 { 2125 if (row.Link == null) 2126 { 2127 <div>@row.SubTitle</div> 2128 } 2129 else 2130 { 2131 <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a> 2132 } 2133 } 2134 </td> 2135 </tr> 2136 } 2137 </table> 2138 } 2139 } 2140 @using System.Reflection 2141 @using Dynamicweb.Rapido.Blocks.Components 2142 @using Dynamicweb.Rapido.Blocks.Components.Articles 2143 @using Dynamicweb.Rapido.Blocks 2144 2145 @* Component for the articles *@ 2146 2147 @helper RenderArticleGalleryModal(ArticleGalleryModal settings) 2148 { 2149 dynamic[] methodParameters = new dynamic[1]; 2150 methodParameters[0] = settings; 2151 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 2152 2153 if (customMethod != null) 2154 { 2155 @customMethod.Invoke(this, methodParameters).ToString(); 2156 } 2157 else 2158 { 2159 <input type="checkbox" id="ParagraphGalleryTrigger" class="modal-trigger" /> 2160 <div class="modal-container"> 2161 <label for="ParagraphGalleryTrigger" id="ParagraphGalleryOverlay" class="modal-overlay"></label> 2162 <div class="modal modal--full" id="ParagraphGallery"> 2163 <div class="modal__body modal__body--full"> 2164 <img src="/Files/Images/placeholder.gif" alt="" id="ParagraphGalleryModalImage" style="margin: 0 auto;" /> 2165 <div class="u-padding u-ta-center" id="ParagraphGalleryModalCaption"></div> 2166 <label class="modal__close-btn dw-mod" for="ParagraphGalleryTrigger"></label> 2167 </div> 2168 </div> 2169 </div> 2170 <script> 2171 function showImageInModal(image) { 2172 let imageNode = document.getElementById('ParagraphGalleryModalImage'); 2173 let captionNode = document.getElementById('ParagraphGalleryModalCaption'); 2174 let trigger = document.getElementById('ParagraphGalleryTrigger'); 2175 imageNode.src = image.src; 2176 if (image.alt != "") { 2177 captionNode.innerText = image.alt; 2178 imageNode.alt = image.alt; 2179 captionNode.style.display = "block"; 2180 } else { 2181 captionNode.style.display = "none"; 2182 } 2183 trigger.checked = true; 2184 } 2185 </script> 2186 } 2187 } 2188 @using System.Reflection 2189 @using Dynamicweb.Rapido.Blocks.Components 2190 @using Dynamicweb.Rapido.Blocks.Components.Articles 2191 @using Dynamicweb.Rapido.Blocks 2192 2193 2194 @* Component for the articles *@ 2195 2196 @helper RenderArticleRelated(ArticleRelated settings) 2197 { 2198 string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : ""; 2199 string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : ""; 2200 2201 <section class="multiple-paragraphs-container related-articles-container paragraph-container--full-width"> 2202 <div class="center-container dw-mod"> 2203 <div class="grid u-padding u-margin-bottom--lg"> 2204 <div class="grid__col-md-12 grid__col-xs-12 u-margin-bottom--lg"> 2205 <h2 class="article__header related-header u-no-margin u-margin-top dw-mod">@Translate("Andre relevante nyheder")</h2> 2206 </div> 2207 </div> 2208 2209 <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> 2210 2211 <script id="RelatedSimpleTemplate" type="text/x-template"> 2212 {{#.}} 2213 <div class="grid u-padding-bottom--lg"> 2214 {{#Cases}} 2215 <div class="grid__col-md-3 grid__col-12 image-hover--zoom dw-mod"> 2216 <a href="{{link}}" class="u-full-height related-articles-container"> 2217 {{#if image}} 2218 <div class="u-color-light--bg u-no-padding dw-mod"> 2219 <div class="flex-img image-hover__wrapper"> 2220 <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}}" /> 2221 </div> 2222 </div> 2223 {{/if}} 2224 2225 <div class="card related-articles-container article-content-container dw-mod"> 2226 <p class="article__post-info dw-mod">{{date}}</p> 2227 <h3 class="article-list__item-header u-color-dark dw-mod">{{title}}</h3> 2228 @*<p class="article__short-summary dw-mod">{{summary}}</p>*@ 2229 </div> 2230 </a> 2231 </div> 2232 {{/Cases}} 2233 </div> 2234 {{/.}} 2235 </script> 2236 </div> 2237 </section> 2238 } 2239 @using System.Reflection 2240 @using Dynamicweb.Rapido.Blocks.Components 2241 @using Dynamicweb.Rapido.Blocks.Components.Articles 2242 @using Dynamicweb.Rapido.Blocks 2243 2244 2245 @* Component for the articles *@ 2246 2247 @helper RenderArticleMenu(ArticleMenu settings) 2248 { 2249 dynamic[] methodParameters = new dynamic[1]; 2250 methodParameters[0] = settings; 2251 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleMenuCustom"); 2252 2253 if (customMethod != null) 2254 { 2255 @customMethod.Invoke(this, methodParameters).ToString(); 2256 } else { 2257 if (!String.IsNullOrEmpty(settings.Title)) { 2258 <div class="u-margin u-border-bottom"> 2259 <h3 class="u-no-margin">@settings.Title</h3> 2260 </div> 2261 } 2262 2263 <ul class="menu-left u-margin-bottom dw-mod"> 2264 @foreach (var item in settings.Items) 2265 { 2266 @RenderArticleMenuItem(item) 2267 } 2268 </ul> 2269 } 2270 } 2271 2272 @helper RenderArticleMenuItem(ArticleMenuItem settings) 2273 { 2274 dynamic[] methodParameters = new dynamic[1]; 2275 methodParameters[0] = settings; 2276 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleMenuItemCustom"); 2277 2278 if (customMethod != null) 2279 { 2280 @customMethod.Invoke(this, methodParameters).ToString(); 2281 } else { 2282 string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#"; 2283 2284 if (!String.IsNullOrEmpty(settings.Title)) { 2285 <li class="menu-left__item dw-mod"> 2286 <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a> 2287 </li> 2288 } 2289 } 2290 } 2291 @using System.Reflection 2292 @using Dynamicweb.Rapido.Blocks.Components 2293 @using Dynamicweb.Rapido.Blocks.Components.Articles 2294 @using Dynamicweb.Rapido.Blocks 2295 2296 @* Component for the articles *@ 2297 2298 @helper RenderArticleList(ArticleList settings) 2299 { 2300 dynamic[] methodParameters = new dynamic[1]; 2301 methodParameters[0] = settings; 2302 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListCustom"); 2303 2304 if (customMethod != null) 2305 { 2306 @customMethod.Invoke(this, methodParameters).ToString(); 2307 } else { 2308 if (Pageview != null) 2309 { 2310 bool isParagraph = Pageview.CurrentParagraph != null ? true : false; 2311 string[] sortArticlesListBy = new string[2]; 2312 2313 if (isParagraph) { 2314 sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2315 } 2316 else { 2317 sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2318 } 2319 2320 string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString(); 2321 2322 @RenderItemList(new 2323 { 2324 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle", 2325 ListSourceType = settings.SourceType, 2326 ListSourcePage = sourcePage, 2327 ItemFieldsList = "*", 2328 Filter = settings.Filter, 2329 ListOrderBy = sortArticlesListBy[0], 2330 ListOrderByDirection = sortArticlesListBy[1], 2331 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date", 2332 ListSecondOrderByDirection = "ASC", 2333 IncludeAllChildItems = true, 2334 ListTemplate = settings.Template, 2335 ListPageSize = settings.PageSize.ToString() 2336 }); 2337 } 2338 } 2339 } 2340 @using System.Reflection 2341 @using Dynamicweb.Rapido.Blocks.Components.Articles 2342 2343 2344 @* Component for the articles *@ 2345 2346 @helper RenderArticleSummary(ArticleSummary settings) 2347 { 2348 dynamic[] methodParameters = new dynamic[1]; 2349 methodParameters[0] = settings; 2350 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSummaryCustom"); 2351 2352 if (customMethod != null) 2353 { 2354 @customMethod.Invoke(this, methodParameters).ToString(); 2355 } else { 2356 if (!String.IsNullOrEmpty(settings.Text)) 2357 { 2358 <div class="article__summary dw-mod">@settings.Text</div> 2359 } 2360 } 2361 } 2362 @using System.Reflection 2363 @using Dynamicweb.Rapido.Blocks.Components 2364 @using Dynamicweb.Rapido.Blocks.Components.Articles 2365 @using Dynamicweb.Rapido.Blocks 2366 2367 @* Component for the articles *@ 2368 2369 @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings) 2370 { 2371 dynamic[] methodParameters = new dynamic[1]; 2372 methodParameters[0] = settings; 2373 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListCategoryFilterCustom"); 2374 2375 if (customMethod != null) 2376 { 2377 @customMethod.Invoke(this, methodParameters).ToString(); 2378 } else { 2379 string pageId = Pageview.ID.ToString(); 2380 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All"); 2381 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2382 2383 foreach (var option in settings.Categories) 2384 { 2385 selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter; 2386 } 2387 2388 if (selectedFilter == pageId) 2389 { 2390 selectedFilter = Translate("All"); 2391 } 2392 2393 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2394 { 2395 <div class="u-pull--right u-margin-left"> 2396 <div class="collection u-no-margin"> 2397 <h5>@Translate("Category")</h5> 2398 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2399 <div class="dropdown u-w180px dw-mod"> 2400 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 2401 <div class="dropdown__content dw-mod"> 2402 @foreach (var option in settings.Categories) 2403 { 2404 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 2405 } 2406 </div> 2407 <label class="dropdown-trigger-off" for="CategorySelector"></label> 2408 </div> 2409 </div> 2410 </div> 2411 } 2412 else 2413 { 2414 <div class="u-full-width u-margin-bottom"> 2415 <h5 class="u-no-margin">@Translate("Category")</h5> 2416 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2417 <div class="dropdown u-full-width dw-mod"> 2418 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 2419 <div class="dropdown__content dw-mod"> 2420 @foreach (var option in settings.Categories) 2421 { 2422 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 2423 } 2424 </div> 2425 <label class="dropdown-trigger-off" for="CategorySelector"></label> 2426 </div> 2427 </div> 2428 } 2429 } 2430 } 2431 @using System.Reflection 2432 @using System.Web.Mvc 2433 @using Dynamicweb.Environment 2434 @using Dynamicweb.Rapido.Blocks.Components 2435 @using Dynamicweb.Rapido.Blocks.Components.Articles 2436 @using Dynamicweb.Rapido.Blocks 2437 2438 @* Component for the articles *@ 2439 2440 @helper RenderArticleListFilter(ArticleListFilter settings) 2441 { 2442 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All"); 2443 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2444 2445 if (settings.Options != null) 2446 { 2447 foreach (var option in settings.Options) 2448 { 2449 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter; 2450 } 2451 2452 @*DESKTOP*@ 2453 2454 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2455 { 2456 <div class="grid"> 2457 <div class="grid__col-12 paragraph-container customlist"> 2458 2459 <section class="grid__col-12" id="custom-facets-overall-container"> 2460 2461 <input type="checkbox" id="CheckFacetGroups" class="js-remember-state u-hidden" data-expand="CheckFacetGroups" /> 2462 <div class="grid grid--external-bleed-x facets-container facets-container--top expandable--collapsed grid--justify-center dw-mod" id="mobile-custom-facets-container" data-trigger="CheckFacetGroups"> 2463 <div class="grid__col-12"> 2464 2465 <input type="checkbox" id="OptionsGroup_{{name}}" class="expand-trigger js-remember-state mobile-facet-input" {{defaultState}} /> 2466 2467 <div class="grid__col-12 expand-container facets-container__box custom-expand-container dw-mod js-filter"> 2468 <label class="grid--justify-center expand-container__btn facets-container__header custom-btn-expand-container dw-mod" id="custom-btn-expand-container" for="OptionsGroup_{{name}}">@Translate("Filters")</label> 2469 <div class="expand-container__content custom-expand-content-container dw-mod"> 2470 <div class="facets-container__list dw-mod"> 2471 <div class="grid__col-12 grid--direction-row u-no-padding grid--wrap"> 2472 @foreach (var option in settings.Options) 2473 { 2474 2475 var currentUrl = HttpContext.Current.Request.QueryString.ToString(); 2476 2477 <div class="grid__col-lg-3 grid__col-sm-3 grid__col-xs-12 u-no-padding-y"> 2478 @if (currentUrl.Contains(settings.SystemName + "=" + option.Value)) 2479 { 2480 <input type="checkbox" class="checked checkbox-facet__checkbox form__control dw-mod" checked id="@(settings.SystemName + option.Value)" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')" name="@(settings.SystemName + option.Value)"> 2481 2482 } 2483 2484 else 2485 { 2486 <input type="checkbox" class="checkbox-facet__checkbox form__control dw-mod" id="@(settings.SystemName + option.Value)" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')" name="@(settings.SystemName + option.Value)"> 2487 2488 } 2489 <label class="u-border-bottom u-padding u-no-padding-x checkbox-facet custom-checkbox-facet dw-mod" for="@(settings.SystemName + option.Value)"><span class="checkbox-facet__label custom-checkbox-facet-label dw-mod">@Translate(option.Name)</span></label> 2490 </div> 2491 2492 } 2493 </div> 2494 </div> 2495 </div> 2496 </div> 2497 </div> 2498 </div> 2499 <label for="@(settings.SystemName)Selector" class="btn btn--primary btn--full dw-mod js-expand-hide facets-container-trigger" data-trigger="CheckFacetGroups">@Translate("Select filters")</label> 2500 <label for="@(settings.SystemName)Selector" class="btn btn--primary btn--full dw-mod expandable--collapsed facets-container-trigger" data-trigger="CheckFacetGroups">@Translate("Close filters")</label> 2501 </section> 2502 </div> 2503 </div> 2504 2505 } 2506 2507 @*MOBILE*@ 2508 2509 else 2510 { 2511 <div class="grid"> 2512 <div class="grid__col-12 customlist u-no-padding"> 2513 2514 <section class="grid__col-12 u-no-padding" id="custom-facets-overall-container"> 2515 2516 @* REMEMBER TO MATCH HTML ATTRIBUTES DATA-EXPAND AND DATA-TRIGGER WITH THE GIVEN BUTTON (IN THIS SCENARIO CHECKFILTERS BUTTON FROM ARTICLECOMPONENTS.CSHTML) *@ 2517 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" /> 2518 <div class="grid grid--external-bleed-x facets-container facets-container--top expandable--collapsed grid--justify-center dw-mod" id="mobile-custom-facets-container" data-trigger="CheckFilters"> 2519 <div class="grid__col-12"> 2520 2521 <input type="checkbox" id="OptionsGroup_{{name}}" class="expand-trigger js-remember-state mobile-facet-input" /> 2522 2523 <div class="grid__col-12 expand-container facets-container__box custom-expand-container dw-mod js-filter"> 2524 <label class="grid--justify-center expand-container__btn facets-container__header custom-btn-expand-container dw-mod" id="custom-btn-expand-container" for="OptionsGroup_{{name}}">@Translate("Filters")</label> 2525 <div class="expand-container__content custom-expand-content-container dw-mod"> 2526 <div class="facets-container__list dw-mod"> 2527 <div class="grid__col-12 grid--direction-row u-no-padding grid--wrap"> 2528 @foreach (var option in settings.Options) 2529 { 2530 2531 var currentUrl = HttpContext.Current.Request.QueryString.ToString(); 2532 2533 <div class="grid__col-lg-3 grid__col-sm-4 grid__col-xs-12 u-no-padding-y"> 2534 @if (currentUrl.Contains(settings.SystemName + "=" + option.Value)) 2535 { 2536 <input type="checkbox" class="checked checkbox-facet__checkbox form__control dw-mod" checked id="@(settings.SystemName + option.Value)" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')" name="@(settings.SystemName + option.Value)"> 2537 2538 } 2539 2540 else 2541 { 2542 <input type="checkbox" class="checkbox-facet__checkbox form__control dw-mod" id="@(settings.SystemName + option.Value)" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')" name="@(settings.SystemName + option.Value)"> 2543 2544 } 2545 <label class="u-border-bottom u-padding u-no-padding-x checkbox-facet custom-checkbox-facet dw-mod" for="@(settings.SystemName + option.Value)"><span class="checkbox-facet__label custom-checkbox-facet-label dw-mod">@Translate(option.Name)</span></label> 2546 </div> 2547 2548 } 2549 </div> 2550 </div> 2551 </div> 2552 </div> 2553 </div> 2554 </div> 2555 2556 </section> 2557 </div> 2558 </div> 2559 2560 } 2561 } 2562 } 2563 @using System.Reflection 2564 @using Dynamicweb.Rapido.Blocks.Components 2565 @using Dynamicweb.Rapido.Blocks.Components.Articles 2566 @using Dynamicweb.Rapido.Blocks 2567 2568 @* Component for the articles *@ 2569 2570 @helper RenderArticleListSearch(ArticleListSearch settings) 2571 { 2572 dynamic[] methodParameters = new dynamic[1]; 2573 methodParameters[0] = settings; 2574 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListSearchCustom"); 2575 2576 if (customMethod != null) 2577 { 2578 @customMethod.Invoke(this, methodParameters).ToString(); 2579 } else { 2580 string searchString = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("Title")) ? HttpContext.Current.Request.QueryString.Get("Title").Trim('*') : ""; 2581 string className = "u-w340px u-pull--right u-margin-left"; 2582 2583 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 2584 { 2585 className = "u-full-width"; 2586 } 2587 2588 <div class="typeahead u-color-inherit u-margin-bottom dw-mod @className"> 2589 <input type="text" class="typeahead-search-field u-no-margin dw-mod" placeholder="@Translate("Search in list")" value="@searchString" id="ArticleListSearchInput" onchange="QueryArray.setParameterInCurrentURL('Title', '*' + document.getElementById('ArticleListSearchInput').value + '*')"> 2590 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button> 2591 </div> 2592 } 2593 } 2594 @using System.Reflection 2595 @using Dynamicweb.Rapido.Blocks.Components 2596 @using Dynamicweb.Rapido.Blocks.Components.Articles 2597 @using Dynamicweb.Rapido.Blocks 2598 2599 @* Component for the articles *@ 2600 2601 @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings) 2602 { 2603 dynamic[] methodParameters = new dynamic[1]; 2604 methodParameters[0] = settings; 2605 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListNoResultsInfoCustom"); 2606 2607 if (customMethod != null) 2608 { 2609 @customMethod.Invoke(this, methodParameters).ToString(); 2610 } else { 2611 <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div> 2612 } 2613 } 2614 2615 @using System.Reflection 2616 @using Dynamicweb.Rapido.Blocks.Components 2617 @using Dynamicweb.Rapido.Blocks.Components.General 2618 @using Dynamicweb.Rapido.Blocks.Components.Articles 2619 @using Dynamicweb.Rapido.Blocks 2620 @using System.Text.RegularExpressions 2621 @using S_DW_HD2412.CustomCode 2622 2623 @* Component for the articles *@ 2624 2625 @helper RenderArticleListItem(ArticleListItemExtended settings) 2626 { 2627 switch (settings.Type) { 2628 case ArticleListItemType.Card: 2629 @RenderArticleListItemCard(settings); 2630 break; 2631 case ArticleListItemType.List: 2632 @RenderArticleListItemList(settings); 2633 break; 2634 case ArticleListItemType.Simple: 2635 @RenderArticleListItemSimple(settings); 2636 break; 2637 default: 2638 @RenderArticleListItemCard(settings); 2639 break; 2640 } 2641 } 2642 2643 @helper RenderArticleListItemExtended(ArticleListItemExtended settings) 2644 { 2645 switch (settings.Type) { 2646 case ArticleListItemType.Card: 2647 @RenderArticleListItemCard(settings); 2648 break; 2649 case ArticleListItemType.List: 2650 @RenderArticleListItemList(settings); 2651 break; 2652 case ArticleListItemType.Simple: 2653 @RenderArticleListItemSimple(settings); 2654 break; 2655 default: 2656 @RenderArticleListItemCard(settings); 2657 break; 2658 } 2659 } 2660 2661 @helper RenderArticleListItemCard(ArticleListItemExtended settings) { 2662 <a href="@settings.Link" class="u-full-height u-color-light--bg"> 2663 <div class="u-color-light--bg u-no-padding dw-mod"> 2664 @if (settings.Logo != null) 2665 { 2666 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;" : ""; 2667 settings.Logo.ImageDefault.Crop = 5; 2668 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 2669 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 2670 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 2671 @if (settings.Stickers != null) 2672 { 2673 if (settings.Stickers.Position != StickersListPosition.Custom) 2674 { 2675 @RenderStickersCollection(settings.Stickers); 2676 } 2677 } 2678 @RenderImage(settings.Logo) 2679 </div> 2680 } 2681 else if (settings.Image != null) 2682 { 2683 <div class="flex-img image-hover__wrapper u-position-relative dw-mod"> 2684 @if (settings.Stickers != null) 2685 { 2686 if (settings.Stickers.Position != StickersListPosition.Custom) 2687 { 2688 @RenderStickersCollection(settings.Stickers); 2689 } 2690 } 2691 @RenderImage(settings.Image) 2692 </div> 2693 } 2694 </div> 2695 2696 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 2697 { 2698 2699 <div class="paragraph-card u-color-light--bg dw-mod"> 2700 2701 2702 @if (settings.Stickers != null) 2703 { 2704 if (settings.Stickers.Position == StickersListPosition.Custom) 2705 { 2706 @RenderStickersCollection(settings.Stickers) 2707 ; 2708 } 2709 } 2710 @if (!String.IsNullOrEmpty(settings.Title)) 2711 { 2712 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 2713 } 2714 @if (!String.IsNullOrEmpty(settings.Date)) 2715 { 2716 <div class="article__post-info dw-mod">@DateTime.Parse(settings.Date).ToString("dd-MM-yyyy")</div> 2717 } 2718 @if (!String.IsNullOrEmpty(settings.SubTitle)) 2719 { 2720 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 2721 } 2722 @if (!String.IsNullOrEmpty(settings.Summary)) 2723 { 2724 <p class="article__short-summary dw-mod">@settings.Summary</p> 2725 } 2726 <a href="@settings.Link" class="search-result__name search"> 2727 @Translate("Read more") 2728 </a> 2729 </div> 2730 } 2731 </a> 2732 } 2733 2734 @helper RenderArticleListItemList(ArticleListItemExtended settings) { 2735 <a href="@settings.Link"> 2736 <div class="grid u-color-light--bg u-no-padding dw-mod"> 2737 <div class="grid__col-md-3"> 2738 <div class="u-color-light--bg u-no-padding dw-mod"> 2739 @if (settings.Logo != null) 2740 { 2741 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;" : ""; 2742 settings.Logo.ImageDefault.Crop = 5; 2743 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 2744 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 2745 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 2746 @if (settings.Stickers != null) 2747 { 2748 if (settings.Stickers.Position != StickersListPosition.Custom) 2749 { 2750 @RenderStickersCollection(settings.Stickers); 2751 } 2752 } 2753 @RenderImage(settings.Logo) 2754 </div> 2755 } else if (settings.Image != null) 2756 { 2757 <div class="flex-img image-hover__wrapper dw-mod"> 2758 @if (settings.Stickers != null) 2759 { 2760 if (settings.Stickers.Position != StickersListPosition.Custom) 2761 { 2762 @RenderStickersCollection(settings.Stickers); 2763 } 2764 } 2765 @RenderImage(settings.Image) 2766 </div> 2767 } 2768 </div> 2769 </div> 2770 2771 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 2772 { 2773 <div class="grid__col-md-9"> 2774 @if (!String.IsNullOrEmpty(settings.Title)) 2775 { 2776 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 2777 } 2778 @if (settings.Stickers != null) 2779 { 2780 if (settings.Stickers.Position == StickersListPosition.Custom) 2781 { 2782 @RenderStickersCollection(settings.Stickers); 2783 } 2784 } 2785 @if (!String.IsNullOrEmpty(settings.SubTitle)) 2786 { 2787 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 2788 } 2789 @if (!String.IsNullOrEmpty(settings.Summary)) 2790 { 2791 <p class="article__short-summary dw-mod">@settings.Summary</p> 2792 } 2793 </div> 2794 } 2795 </div> 2796 </a> 2797 } 2798 2799 @helper RenderArticleListItemSimple(ArticleListItemExtended settings) { 2800 <a href="@settings.Link" class="u-color-inherit"> 2801 <div class="grid u-color-light--bg u-no-padding dw-mod"> 2802 <div class="grid__col-md-12"> 2803 @if (!String.IsNullOrEmpty(settings.Title)) 2804 { 2805 <section class="grid__col-12 grid--justify-center"> 2806 @*<h2 class="search-headline-the-one"> 2807 @settings.Title 2808 </h2>*@ 2809 </section> 2810 2811 } 2812 @if (!String.IsNullOrEmpty(settings.SubTitle)) 2813 { 2814 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 2815 } 2816 </div> 2817 </div> 2818 </a> 2819 } 2820 @using System.Reflection 2821 @using Dynamicweb.Rapido.Blocks.Components.Articles 2822 2823 2824 @* Component for the articles *@ 2825 2826 @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings) 2827 { 2828 dynamic[] methodParameters = new dynamic[1]; 2829 methodParameters[0] = settings; 2830 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleAuthorAndDateCustom"); 2831 2832 if (customMethod != null) 2833 { 2834 @customMethod.Invoke(this, methodParameters).ToString(); 2835 } else { 2836 <small class="article__subscription"> 2837 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 2838 { 2839 <text>@Translate("Written")</text> 2840 } 2841 @if (!string.IsNullOrWhiteSpace(settings.Author)) 2842 { 2843 <text>@Translate("by") @settings.Author</text> 2844 } 2845 @if (!string.IsNullOrWhiteSpace(settings.Date)) 2846 { 2847 <text>@Translate("on") @settings.Date</text> 2848 } 2849 </small> 2850 } 2851 } 2852 @using System.Reflection 2853 @using Dynamicweb.Rapido.Blocks.Components.Articles 2854 2855 2856 @* Component for the articles *@ 2857 2858 @helper RenderArticleLink(ArticleLink settings) 2859 { 2860 dynamic[] methodParameters = new dynamic[1]; 2861 methodParameters[0] = settings; 2862 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleLinkCustom"); 2863 2864 if (customMethod != null) 2865 { 2866 @customMethod.Invoke(this, methodParameters).ToString(); 2867 } else { 2868 if (!String.IsNullOrEmpty(settings.Title)) 2869 { 2870 <div class="grid__cell"> 2871 @RenderButton(settings) 2872 </div> 2873 } 2874 } 2875 } 2876 @using System.Reflection 2877 @using Dynamicweb.Rapido.Blocks 2878 @using Dynamicweb.Rapido.Blocks.Components.Articles 2879 @using Dynamicweb.Rapido.Blocks.Components.General 2880 2881 2882 @* Component for the articles *@ 2883 2884 @helper RenderArticleCarousel(ArticleCarousel settings) 2885 { 2886 dynamic[] methodParameters = new dynamic[1]; 2887 methodParameters[0] = settings; 2888 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 2889 2890 if (customMethod != null) 2891 { 2892 @customMethod.Invoke(this, methodParameters).ToString(); 2893 } else { 2894 <div class="grid"> 2895 <div class="grid__col-12"> 2896 <div class="carousel" id="carousel_@settings.Id"> 2897 <div class="carousel__container js-carousel-slides dw-mod"> 2898 @RenderBlockList(settings.SubBlocks) 2899 </div> 2900 </div> 2901 </div> 2902 </div> 2903 2904 <script> 2905 document.addEventListener("DOMContentLoaded", function () { 2906 new CarouselModule("#carousel_@settings.Id", { 2907 slideTime: 0, 2908 dots: true 2909 }); 2910 }); 2911 </script> 2912 } 2913 } 2914 2915 @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings) 2916 { 2917 dynamic[] methodParameters = new dynamic[1]; 2918 methodParameters[0] = settings; 2919 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 2920 2921 if (customMethod != null) 2922 { 2923 @customMethod.Invoke(this, methodParameters).ToString(); 2924 } 2925 else 2926 { 2927 string imageEngine = "/Admin/Public/GetImage.ashx?"; 2928 2929 string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image; 2930 if (settings.ImageSettings != null) 2931 { 2932 defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : ""; 2933 defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : ""; 2934 defaultImage += "Crop=" + settings.ImageSettings.Crop + "&"; 2935 defaultImage += "Compression=" + settings.ImageSettings.Compression + "&"; 2936 defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&"; 2937 defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&"; 2938 } 2939 defaultImage += "&Image=" + settings.Image; 2940 2941 <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')"> 2942 <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title"> 2943 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2> 2944 <div class="article-list__item-info"> 2945 @if (settings.Stickers != null) 2946 { 2947 settings.Stickers.Position = StickersListPosition.Custom; 2948 @RenderStickersCollection(settings.Stickers); 2949 } 2950 2951 <small class="u-margin-top--lg u-color-light"> 2952 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 2953 { 2954 <text>@Translate("Written")</text> 2955 } 2956 @if (!string.IsNullOrWhiteSpace(settings.Author)) 2957 { 2958 <text>@Translate("by") @settings.Author</text> 2959 } 2960 @if (!string.IsNullOrWhiteSpace(settings.Date)) 2961 { 2962 <text>@Translate("on") @settings.Date</text> 2963 } 2964 </small> 2965 </div> 2966 2967 <h3 class="article__short-summary u-color-light">@settings.Summary</h3> 2968 </a> 2969 @if (settings.UseFilters == true) 2970 { 2971 <div class="background-image image-filter image-filter--darken dw-mod"></div> 2972 } 2973 </div> 2974 } 2975 } 2976 @using System.Text.RegularExpressions 2977 @using Dynamicweb.Rapido.Blocks.Components 2978 @using Dynamicweb.Rapido.Blocks.Components.General 2979 @using Dynamicweb.Rapido.Blocks.Components.Articles 2980 @using Dynamicweb.Rapido.Blocks 2981 2982 @* Component for the articles *@ 2983 2984 @helper RenderArticleVideo(ArticleVideo settings) 2985 { 2986 dynamic[] methodParameters = new dynamic[1]; 2987 methodParameters[0] = settings; 2988 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleTextCustom"); 2989 2990 if (customMethod != null) 2991 { 2992 @customMethod.Invoke(this, methodParameters).ToString(); 2993 } else { 2994 if (settings.Url != null) 2995 { 2996 //getting video ID from youtube URL 2997 string videoCode = settings.Url; 2998 Regex regex = new Regex(@".be\/(.[^?]*)"); 2999 Match match = regex.Match(videoCode); 3000 string videoId = ""; 3001 if (match.Success) 3002 { 3003 videoId = match.Groups[1].Value; 3004 } 3005 else 3006 { 3007 regex = new Regex(@"v=([^&]+)"); 3008 match = regex.Match(videoCode); 3009 if (match.Success) 3010 { 3011 videoId = match.Groups[1].Value; 3012 } 3013 } 3014 3015 int autoPlay = settings.AutoPlay == "true" ? 1 : 0; 3016 3017 <div class="video-wrapper"> 3018 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div> 3019 </div> 3020 } 3021 } 3022 } 3023 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3024 @using System.Reflection 3025 @using Dynamicweb.Rapido.Blocks.Components 3026 @using Dynamicweb.Rapido.Blocks.Components.General 3027 @using Dynamicweb.Rapido.Blocks.Components.Articles 3028 @using Dynamicweb.Rapido.Blocks 3029 @using S_DW_HD2412.CustomCode 3030 3031 3032 3033 @helper RenderSocialShare() 3034 { 3035 string siteURL = Pageview.SearchFriendlyUrl.ToString(); 3036 3037 <section class="socialshare grid__col-md-12 grid__col--bleed grid-custom-layout grid--justify-center u-padding--lg dw-mod"> 3038 <div class="socialheader grid__col-md-12 u-no-padding u-border-bottom"> 3039 <h3>@Translate("ShareThis")</h3> 3040 </div> 3041 <div class="sociallinks grid__col-md-12 u-no-padding"> 3042 <div class="social-container"> 3043 <div class="links"> 3044 <div class="icon-nz-nz-facebook links-share" data-sharer="facebook" data-url="@siteURL"></div> 3045 <div class="linkedin icon-nz-nz-linkedin links-share" data-sharer="linkedin" data-url="@siteURL"></div> 3046 <div data-icon-nz="nz-link" class="js-geturl icon-nz-nz-link links-share" aria-label="Copy link"> 3047 <div class="links-input js-show-hide"> 3048 <input class="js-urlCopied"> 3049 </div> 3050 </div> 3051 </div> 3052 </div> 3053 </div> 3054 </section> 3055 } 3056 3057 3058 @* Simple helpers *@ 3059 3060 @*Requires the Gallery ItemType that comes with Rapido*@ 3061 @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) 3062 { 3063 string placeHolderImage = "/Files/Images/placeholder.gif"; 3064 3065 <main class="wrapper grid grid--direction-row"> 3066 <section class="gallery grid__col-lg-9 grid__col-sm-12"> 3067 <div class="swiper-container gallery-top"> 3068 <div class="swiper-wrapper"> 3069 @if (gallery != null && gallery.Count > 0) 3070 { 3071 int count = 1; 3072 3073 foreach (var item in gallery) 3074 { 3075 if (item.GetFile("ImagePath") != null) 3076 { 3077 string focalPointParameters = item.GetFile("ImagePath") != null ? "&" + item.GetFile("ImagePath").GetFocalPointParameters() : ""; 3078 3079 string image = item.GetFile("ImagePath").PathUrlEncoded + focalPointParameters; 3080 int imagesCount = gallery.Count; 3081 string text = item.GetString("Text"); 3082 3083 <div class="swiper-slide b-lazy" src="@placeHolderImage" data-src="/Admin/Public/GetImage.ashx?width=1024&amp;height=583&amp;crop=0&amp;Compression=75&amp;DoNotUpscale=1&amp;image=@image" alt="@text"> 3084 <div class="swiper-text">@text</div> 3085 </div> 3086 3087 count++; 3088 } 3089 } 3090 } 3091 </div> 3092 <div class="swiper-button-next swiper-button-white"></div> 3093 <div class="swiper-button-prev swiper-button-white"></div> 3094 </div> 3095 </section> 3096 @if (gallery != null && gallery.Count > 0) 3097 { 3098 <section class="thumbs grid__col-lg-3 grid__col-sm-12"> 3099 <div class="swiper-container gallery-thumbs"> 3100 <div class="swiper-wrapper"> 3101 @{ 3102 int count = 1; 3103 } 3104 3105 @foreach (var item in gallery) 3106 { 3107 if (item.GetFile("ImagePath") != null) 3108 { 3109 string focalPointParameters = item.GetFile("ImagePath") != null ? "&" + item.GetFile("ImagePath").GetFocalPointParameters() : ""; 3110 3111 string image = item.GetFile("ImagePath").PathUrlEncoded + focalPointParameters; 3112 int imagesCount = gallery.Count; 3113 string text = item.GetString("Text"); 3114 3115 <img class="swiper-slide" src="/Admin/Public/GetImage.ashx?width=450&amp;height=247&amp;crop=0&amp;Compression=75&amp;DoNotUpscale=1&amp;image=@image" alt="@text" /> 3116 3117 count++; 3118 } 3119 } 3120 </div> 3121 </div> 3122 </section> 3123 } 3124 </main> 3125 3126 } 3127 3128 @helper RenderArticleItemGalleryModal() 3129 { 3130 <!-- Trigger for the gallery modal --> 3131 <input type="checkbox" id="GalleryModalTrigger" class="modal-trigger" /> 3132 3133 <!-- Gallery modal --> 3134 <div class="modal-container"> 3135 <label for="GalleryModalTrigger" id="GalleryModalOverlay" class="modal-overlay"></label> 3136 <div class="modal modal--full" id="GalleryModal"> 3137 <div class="modal__body modal__body--full"> 3138 <div class="gallery-slider"> 3139 <div class="gallery-slider__image"> 3140 <img src="#" alt="" class="modal--full__img" id="FullImage" /> 3141 </div> 3142 <div class="gallery-slider__image-counter" id="FullImage_counter"></div> 3143 <label class="gallery-slider__close-btn" for="GalleryModalTrigger"></label> 3144 <button class="gallery-slider__previous-btn" id="FullImage_prev" onclick="Gallery.prevImage('FullImage')"></button> 3145 <button class="gallery-slider__next-btn" id="FullImage_next" onclick="Gallery.nextImage('FullImage')"></button> 3146 </div> 3147 </div> 3148 </div> 3149 </div> 3150 } 3151 3152 3153 @helper RenderMobileFilters(List<Block> settings) 3154 { 3155 if (settings.Count > 0) 3156 { 3157 <div class="grid__col-12"> 3158 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" /> 3159 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters"> 3160 @RenderBlockList(settings) 3161 </div> 3162 @*<label for="CheckFilters" class="btn btn--primary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label> 3163 <label for="CheckFilters" class="btn btn--primary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label>*@ 3164 </div> 3165 } 3166 } 3167 3168 3169 @if (File.Exists(HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/Components/Custom/Custom__Components.cshtml"))) 3170 { 3171 <text>@using Dynamicweb.Rapido.Blocks.Components.General 3172 </text> 3173 } 3174 3175 @* Include the Blocks for the page *@ 3176 @if (File.Exists(HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/ItemPublisher/List/Blocks/Custom__Blocks.cshtml"))) 3177 { 3178 <text>@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3179 @using Dynamicweb.Core 3180 @using System 3181 @using System.Web 3182 @using System.Collections.Generic 3183 @using Dynamicweb.Rapido.Blocks 3184 3185 @{ 3186 3187 }</text> 3188 } 3189 3190 3191 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 3192 @RenderBlockList(articlePage.BlocksRoot.BlocksList) 3193 3194 3195 @helper RenderPopularList() { 3196 List<Block> subBlocks = this.articlePage.GetBlockListById("ArticleList").OrderBy(item => item.SortId).ToList(); 3197 string title = Pageview.Item["PopularArticlesHeader"] != null ? Pageview.Item["PopularArticlesHeader"].ToString() : null; 3198 title = title == null && Pageview.Item["Title"] != null ? Pageview.Item["Title"].ToString() : title; 3199 3200 <div class="card-header u-color-light--bg dw-mod"> 3201 <h3>@title</h3> 3202 </div> 3203 3204 <div class="card u-color-light--bg article-simple-list dw-mod"> 3205 @RenderBlockList(subBlocks) 3206 </div> 3207 } 3208