News

Kategorie
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_9e009a891e1543cf87c6d0662b9b334b.<>c__DisplayClass5_0.<RenderBlock>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_9e009a891e1543cf87c6d0662b9b334b.<>c__DisplayClass4_0.<RenderBlockList>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_9e009a891e1543cf87c6d0662b9b334b.<>c__DisplayClass5_0.<RenderBlock>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_9e009a891e1543cf87c6d0662b9b334b.<>c__DisplayClass4_0.<RenderBlockList>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_9e009a891e1543cf87c6d0662b9b334b.<>c__DisplayClass5_0.<RenderBlock>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_9e009a891e1543cf87c6d0662b9b334b.<>c__DisplayClass4_0.<RenderBlockList>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_9e009a891e1543cf87c6d0662b9b334b.<>c__DisplayClass5_0.<RenderBlock>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_9e009a891e1543cf87c6d0662b9b334b.<>c__DisplayClass4_0.<RenderBlockList>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_9e009a891e1543cf87c6d0662b9b334b.Execute() in D:\dynamicweb.net\Solutions\S_DW_HD2412\Files\Templates\Designs\Rapido\ItemPublisher\List\DynamicList.cshtml:line 3530
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.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 dynamic[] methodParameters = new dynamic[1]; 1805 methodParameters[0] = settings; 1806 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerCustom"); 1807 1808 var ieClass = ie10String || ie9String || ie11String ? "ie-hero" : ""; 1809 1810 if (customMethod != null) 1811 { 1812 @customMethod.Invoke(this, methodParameters).ToString(); 1813 } 1814 else 1815 { 1816 settings.Layout = ArticleHeaderLayout.Banner; 1817 1818 if (settings.Image != null) 1819 { 1820 if (settings.Image.Path != null) 1821 { 1822 <div class="grid__col-md-12 grid__col--bleed u-padding-bottom--lg"> 1823 <section class="@ieClass hero multiple-paragraphs-container paragraph-container grid--justify-center"> 1824 <div class="background-image image-filter"> 1825 <div class="background-image__wrapper image-filter"> 1826 <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="@settings.Image.Path"> 1827 @if (!string.IsNullOrEmpty(videoCode)) 1828 { 1829 1830 <div class="video-background"> 1831 <div class="video-background__container"> 1832 <div class="js-youtube-video" data-video="@videoCode" id="ytPlayer"></div> 1833 </div> 1834 </div> 1835 } 1836 </div> 1837 </div> 1838 <div class="grid paragraph-container--height-xl @heroHeight grid--justify-center dw-mod"> 1839 <div class="grid__col-sm-12 grid__col-xs-12 paragraph-container dw-mod grid--justify-center "> 1840 </div> 1841 </div> 1842 @if (ie10String || ie9String || ie11String) 1843 { 1844 <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"> 1845 <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> 1846 <g id="shop_forside_1" transform="translate(0.000000, -376.000000)" fill="#FFFFFF"> 1847 <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> 1848 </g> 1849 </g> 1850 </svg> 1851 } 1852 1853 else 1854 { 1855 <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"> 1856 <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> 1857 <g id="shop_forside_1" transform="translate(0.000000, -376.000000)" fill="#FFFFFF"> 1858 <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> 1859 </g> 1860 </g> 1861 </svg> 1862 } 1863 </section> 1864 </div> 1865 } 1866 else 1867 { 1868 settings.Layout = ArticleHeaderLayout.Clean; 1869 @RenderArticleCleanHeader(settings); 1870 } 1871 } 1872 else 1873 { 1874 settings.Layout = ArticleHeaderLayout.Clean; 1875 @RenderArticleCleanHeader(settings); 1876 } 1877 1878 if (!String.IsNullOrEmpty(headline)) 1879 { 1880 <h1 class="article__leadtext dw-mod grid-custom-layout-third">@headline</h1> 1881 1882 } 1883 } 1884 } 1885 @using System.Reflection 1886 @using Dynamicweb.Frontend 1887 @using Dynamicweb.Rapido.Blocks.Components 1888 @using Dynamicweb.Rapido.Blocks.Components.General 1889 @using Dynamicweb.Rapido.Blocks.Components.Articles 1890 @using Dynamicweb.Rapido.Blocks 1891 @using S_DW_HD2412.CustomCode 1892 1893 1894 1895 @* Component for the articles *@ 1896 1897 @helper RenderArticleHeaderExtended(ArticleHeaderExtended settings) 1898 { 1899 dynamic[] methodParameters = new dynamic[1]; 1900 methodParameters[0] = settings; 1901 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleHeaderCustom"); 1902 1903 if (customMethod != null) 1904 { 1905 @customMethod.Invoke(this, methodParameters).ToString(); 1906 } 1907 else 1908 { 1909 switch (settings.Layout) 1910 { 1911 case ArticleHeaderLayout.Clean: 1912 @RenderArticleCleanHeader(settings); 1913 break; 1914 case ArticleHeaderLayout.Split: 1915 @RenderArticleSplitHeader(settings); 1916 break; 1917 case ArticleHeaderLayout.Banner: 1918 @RenderArticleBannerHeader(settings); 1919 break; 1920 case ArticleHeaderLayout.Overlay: 1921 @RenderArticleOverlayHeader(settings); 1922 break; 1923 default: 1924 @RenderArticleCleanHeader(settings); 1925 break; 1926 } 1927 } 1928 } 1929 1930 @helper RenderArticleCleanHeader(ArticleHeader settings) 1931 { 1932 dynamic[] methodParameters = new dynamic[1]; 1933 methodParameters[0] = settings; 1934 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom"); 1935 1936 if (customMethod != null) 1937 { 1938 @customMethod.Invoke(this, methodParameters).ToString(); 1939 } 1940 else 1941 { 1942 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 1943 1944 <div class="grid grid--align-content-start grid--justify-start"> 1945 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod"> 1946 1947 1948 <div class="grid__cell"> 1949 @if (settings.Image != null) 1950 { 1951 if (settings.Image.Path != null) 1952 { 1953 <div class="u-padding-bottom--lg"> 1954 @RenderImage(settings.Image) 1955 </div> 1956 1957 } 1958 } 1959 1960 @if (!String.IsNullOrEmpty(settings.Heading)) 1961 { 1962 1963 //Check to hide heading if the item is not a Dynamic Article 1964 var ItemName = PageView.Current().Item.SystemName; 1965 1966 if (ItemName == "DynamicArticle") 1967 { 1968 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 1969 } 1970 1971 else 1972 { 1973 } 1974 1975 } 1976 1977 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0) 1978 { 1979 <div class="u-padding-bottom"> 1980 @*@if (!String.IsNullOrEmpty(settings.Category)) 1981 { 1982 <div class="u-pull--left"> 1983 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 1984 </div> 1985 }*@ 1986 <div class=""> 1987 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1988 { 1989 <small class="article__post-info dw-mod">@Translate("Author"): @settings.Author, @settings.Date</small> 1990 } 1991 @*@if (settings.RatingOutOf != 0) 1992 { 1993 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 1994 }*@ 1995 </div> 1996 </div> 1997 1998 } 1999 2000 @if (!String.IsNullOrEmpty(settings.Subheading)) 2001 { 2002 <div class="article__leadtext news-article-leadtext dw-mod">@settings.Subheading</div> 2003 } 2004 @if (!String.IsNullOrEmpty(settings.Link)) 2005 { 2006 <div class="grid__cell"> 2007 @RenderButton(new Button { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2008 </div> 2009 } 2010 </div> 2011 </div> 2012 @if (settings.ExternalParagraphId != 0) 2013 { 2014 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod"> 2015 @RenderParagraphContent(settings.ExternalParagraphId) 2016 </div> 2017 } 2018 </div> 2019 } 2020 } 2021 2022 @helper RenderArticleSplitHeader(ArticleHeader settings) 2023 { 2024 dynamic[] methodParameters = new dynamic[1]; 2025 methodParameters[0] = settings; 2026 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSplitHeaderCustom"); 2027 2028 if (customMethod != null) 2029 { 2030 @customMethod.Invoke(this, methodParameters).ToString(); 2031 } 2032 else 2033 { 2034 string headerColumnWidth = settings.ExternalParagraphId != 0 ? "4" : "6"; 2035 2036 if (settings.Image != null) 2037 { 2038 if (settings.Image.Path != null) 2039 { 2040 <section class="multiple-paragraphs-container paragraph-container--full-width"> 2041 <div class="grid"> 2042 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod"> 2043 <div class="u-left-middle u-padding--lg"> 2044 <div> 2045 @if (!String.IsNullOrEmpty(settings.Category)) 2046 { 2047 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 2048 } 2049 @if (!String.IsNullOrEmpty(settings.Heading)) 2050 { 2051 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 2052 } 2053 @if (!String.IsNullOrEmpty(settings.Subheading)) 2054 { 2055 <div class="article__leadtext dw-mod">@settings.Subheading</div> 2056 } 2057 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2058 { 2059 <small class="article__post-info u-pull--left dw-mod">@settings.Author @settings.Date</small> 2060 } 2061 @if (settings.RatingOutOf != 0) 2062 { 2063 <div class="u-pull--right"> 2064 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 2065 </div> 2066 } 2067 @if (!String.IsNullOrEmpty(settings.Link)) 2068 { 2069 @RenderButton(new Button { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2070 } 2071 </div> 2072 </div> 2073 </div> 2074 <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> 2075 @if (settings.ExternalParagraphId != 0) 2076 { 2077 <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"> 2078 @RenderParagraphContent(settings.ExternalParagraphId) 2079 </div> 2080 } 2081 </div> 2082 </section> 2083 } 2084 } 2085 else 2086 { 2087 @RenderArticleCleanHeader(settings); 2088 } 2089 } 2090 } 2091 2092 @helper RenderArticleOverlayHeader(ArticleHeader settings) 2093 { 2094 dynamic[] methodParameters = new dynamic[1]; 2095 methodParameters[0] = settings; 2096 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleOverlayHeaderCustom"); 2097 2098 if (customMethod != null) 2099 { 2100 @customMethod.Invoke(this, methodParameters).ToString(); 2101 } 2102 else 2103 { 2104 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 2105 string contentAlignment = settings.TextLayout == ArticleHeaderTextLayout.Center ? "grid--justify-center" : ""; 2106 2107 if (settings.Image != null) 2108 { 2109 if (settings.Image.Path != null) 2110 { 2111 if (settings.ExternalParagraphId == 0) 2112 { 2113 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> 2114 <div class="background-image image-filter image-filter--darken dw-mod"> 2115 <div class="background-image__wrapper image-filter image-filter--darken dw-mod"> 2116 @{ 2117 settings.Image.CssClass += "background-image__cover dw-mod"; 2118 } 2119 @RenderImage(settings.Image) 2120 </div> 2121 </div> 2122 <div class="center-container dw-mod"> 2123 <div class="grid @contentAlignment"> 2124 <div class="grid__col-md-@contentColumns grid__col-xs-12 paragraph-container paragraph-container--height-xl u-no-padding dw-mod"> 2125 @if (!String.IsNullOrEmpty(settings.Heading)) 2126 { 2127 <h1 class="article__header article__header--giant u-padding-top--lg dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> 2128 } 2129 @if (!String.IsNullOrEmpty(settings.Subheading)) 2130 { 2131 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> 2132 } 2133 <div class="u-margin-top"> 2134 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2135 { 2136 <small class="article__post-info u-pull--left dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> 2137 } 2138 @if (settings.RatingOutOf != 0) 2139 { 2140 <div class="u-pull--right"> 2141 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 2142 </div> 2143 } 2144 </div> 2145 @if (!String.IsNullOrEmpty(settings.Link)) 2146 { 2147 <div class="grid__cell"> 2148 @RenderButtonExtended(new ButtonExtended { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2149 </div> 2150 } 2151 </div> 2152 </div> 2153 </div> 2154 </section> 2155 } 2156 else 2157 { 2158 @RenderArticleBanner(settings); 2159 } 2160 } 2161 } 2162 else 2163 { 2164 @RenderArticleCleanHeader(settings); 2165 } 2166 } 2167 } 2168 2169 @helper RenderArticleBannerHeader(dynamic settings) 2170 { 2171 dynamic[] methodParameters = new dynamic[1]; 2172 methodParameters[0] = settings; 2173 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerHeaderCustom"); 2174 2175 if (customMethod != null) 2176 { 2177 @customMethod.Invoke(this, methodParameters).ToString(); 2178 } 2179 else 2180 { 2181 @RenderArticleBanner(settings); 2182 } 2183 } 2184 2185 2186 @using System.Reflection 2187 @using System.Text.RegularExpressions; 2188 @using Dynamicweb.Frontend 2189 @using Dynamicweb.Content.Items 2190 @using Dynamicweb.Rapido.Blocks.Components 2191 @using Dynamicweb.Rapido.Blocks.Components.Articles 2192 @using Dynamicweb.Rapido.Blocks 2193 2194 @* Component for the articles *@ 2195 2196 @helper RenderArticleBodyRow(ArticleBodyRow settings) 2197 { 2198 dynamic[] methodParameters = new dynamic[1]; 2199 methodParameters[0] = settings; 2200 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBodyRowCustom"); 2201 2202 if (customMethod != null) 2203 { 2204 @customMethod.Invoke(this, methodParameters).ToString(); 2205 } else { 2206 string position = settings.TopLayout == "overlay" ? "article__overlay-offset" : ""; 2207 string contentAlignment = settings.TextLayout == "center" ? "grid--justify-center" : ""; 2208 2209 <div class="grid grid--align-content-start @contentAlignment @position dw-mod"> 2210 @RenderBlockList(settings.SubBlocks) 2211 </div> 2212 } 2213 } 2214 @using System.Reflection 2215 @using Dynamicweb.Rapido.Blocks.Components 2216 @using Dynamicweb.Rapido.Blocks.Components.General 2217 @using Dynamicweb.Rapido.Blocks.Components.Articles 2218 @using Dynamicweb.Rapido.Blocks 2219 2220 @* Component for the articles *@ 2221 2222 @helper RenderArticleImage(ArticleImage settings) 2223 { 2224 dynamic[] methodParameters = new dynamic[1]; 2225 methodParameters[0] = settings; 2226 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleImageCustom"); 2227 2228 if (customMethod != null) 2229 { 2230 @customMethod.Invoke(this, methodParameters).ToString(); 2231 } 2232 else 2233 { 2234 if (settings.Image != null) 2235 { 2236 if (settings.Image.Path != null) 2237 { 2238 <div class="u-margin-bottom--lg"> 2239 @RenderImage(settings.Image) 2240 </div> 2241 } 2242 } 2243 } 2244 } 2245 @using System.Reflection 2246 @using Dynamicweb.Rapido.Blocks.Components 2247 @using Dynamicweb.Rapido.Blocks.Components.Articles 2248 2249 2250 @* Component for the articles *@ 2251 2252 @helper RenderArticleSubHeader(ArticleSubHeader settings) 2253 { 2254 dynamic[] methodParameters = new dynamic[1]; 2255 methodParameters[0] = settings; 2256 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSubHeaderCustom"); 2257 2258 if (customMethod != null) 2259 { 2260 @customMethod.Invoke(this, methodParameters).ToString(); 2261 } else { 2262 if (!String.IsNullOrEmpty(settings.Title)) 2263 { 2264 <h2 class="article__header">@settings.Title</h2> 2265 } 2266 } 2267 } 2268 @using System.Reflection 2269 @using Dynamicweb.Rapido.Blocks.Components 2270 @using Dynamicweb.Rapido.Blocks.Components.Articles 2271 @using Dynamicweb.Rapido.Blocks 2272 2273 2274 @* Component for the articles *@ 2275 2276 @helper RenderArticleText(ArticleText settings) 2277 { 2278 dynamic[] methodParameters = new dynamic[1]; 2279 methodParameters[0] = settings; 2280 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleTextCustom"); 2281 2282 if (customMethod != null) 2283 { 2284 @customMethod.Invoke(this, methodParameters).ToString(); 2285 } else { 2286 if (!String.IsNullOrEmpty(settings.Text)) 2287 { 2288 string greatTextClass = settings.EnableLargeText == true ? "article__paragraph--great-text" : ""; 2289 2290 <div class="article__paragraph @greatTextClass"> 2291 @settings.Text 2292 </div> 2293 } 2294 } 2295 } 2296 @using System.Reflection 2297 @using Dynamicweb.Rapido.Blocks.Components 2298 @using Dynamicweb.Rapido.Blocks.Components.Articles 2299 @using Dynamicweb.Rapido.Blocks 2300 2301 2302 @* Component for the articles - REMEMBER TO MAKE NZ COPY OF THIS AND REFERENCE IT IN DYNAMICLISTPAGE.CSHTML *@ 2303 2304 @helper RenderArticleQuote(ArticleQuote settings) 2305 { 2306 dynamic[] methodParameters = new dynamic[1]; 2307 methodParameters[0] = settings; 2308 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleQuoteCustom"); 2309 2310 if (customMethod != null) 2311 { 2312 @customMethod.Invoke(this, methodParameters).ToString(); 2313 } else { 2314 string text = Regex.Replace(settings.Text, "<.*?>", String.Empty); 2315 2316 <div class="grid u-padding-bottom--lg"> 2317 @if (settings.Image != null) 2318 { 2319 if (settings.Image.Path != null) { 2320 <div class="grid__col-md-3 grid__col-12"> 2321 <div class="grid__cell-img"> 2322 @{ 2323 settings.Image.Title = !String.IsNullOrEmpty(settings.Image.Title) ? settings.Image.Title : settings.Author; 2324 settings.Image.CssClass += " article__image article__image--square"; 2325 settings.Image.ImageDefault.Width = 200; 2326 settings.Image.ImageDefault.Height = 200; 2327 } 2328 @RenderImage(settings.Image) 2329 </div> 2330 </div> 2331 } 2332 } 2333 <div class="grid__col-auto"> 2334 <div class="custombackground"> 2335 @if (!String.IsNullOrEmpty(settings.Text)) 2336 { 2337 <div class="article__quote dw-mod"> 2338 @settings.Text 2339 </div> 2340 } 2341 @if (!String.IsNullOrEmpty(settings.Author)) 2342 { 2343 <div class="article__quote-author dw-mod"> 2344 - @settings.Author 2345 </div> 2346 } 2347 </div> 2348 </div> 2349 </div> 2350 } 2351 } 2352 @using System.Reflection 2353 @using Dynamicweb.Rapido.Blocks.Components 2354 @using Dynamicweb.Rapido.Blocks.Components.Articles 2355 @using Dynamicweb.Rapido.Blocks 2356 2357 @* Component for the articles *@ 2358 2359 @helper RenderArticleInfoTable(ArticleInfoTable settings) 2360 { 2361 dynamic[] methodParameters = new dynamic[1]; 2362 methodParameters[0] = settings; 2363 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleInfoTableCustom"); 2364 2365 if (customMethod != null) 2366 { 2367 @customMethod.Invoke(this, methodParameters).ToString(); 2368 } else { 2369 <h3>@Translate("Facts")</h3> 2370 <table class="table table--clean"> 2371 @foreach (var row in settings.Rows) 2372 { 2373 string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two"; 2374 2375 <tr> 2376 @if (!String.IsNullOrEmpty(row.Icon)) 2377 { 2378 <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td> 2379 } 2380 <td class="u-no-margin-on-p-elements"> 2381 <div class="u-bold">@row.Title</div> 2382 @if (!String.IsNullOrEmpty(row.SubTitle)) 2383 { 2384 if (row.Link == null) 2385 { 2386 <div>@row.SubTitle</div> 2387 } 2388 else 2389 { 2390 <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a> 2391 } 2392 } 2393 </td> 2394 </tr> 2395 } 2396 </table> 2397 } 2398 } 2399 @using System.Reflection 2400 @using Dynamicweb.Rapido.Blocks.Components 2401 @using Dynamicweb.Rapido.Blocks.Components.Articles 2402 @using Dynamicweb.Rapido.Blocks 2403 2404 @* Component for the articles *@ 2405 2406 @helper RenderArticleGalleryModal(ArticleGalleryModal settings) 2407 { 2408 dynamic[] methodParameters = new dynamic[1]; 2409 methodParameters[0] = settings; 2410 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 2411 2412 if (customMethod != null) 2413 { 2414 @customMethod.Invoke(this, methodParameters).ToString(); 2415 } 2416 else 2417 { 2418 <input type="checkbox" id="ParagraphGalleryTrigger" class="modal-trigger" /> 2419 <div class="modal-container"> 2420 <label for="ParagraphGalleryTrigger" id="ParagraphGalleryOverlay" class="modal-overlay"></label> 2421 <div class="modal modal--full" id="ParagraphGallery"> 2422 <div class="modal__body modal__body--full"> 2423 <img src="/Files/Images/placeholder.gif" alt="" id="ParagraphGalleryModalImage" style="margin: 0 auto;" /> 2424 <div class="u-padding u-ta-center" id="ParagraphGalleryModalCaption"></div> 2425 <label class="modal__close-btn dw-mod" for="ParagraphGalleryTrigger"></label> 2426 </div> 2427 </div> 2428 </div> 2429 <script> 2430 function showImageInModal(image) { 2431 let imageNode = document.getElementById('ParagraphGalleryModalImage'); 2432 let captionNode = document.getElementById('ParagraphGalleryModalCaption'); 2433 let trigger = document.getElementById('ParagraphGalleryTrigger'); 2434 imageNode.src = image.src; 2435 if (image.alt != "") { 2436 captionNode.innerText = image.alt; 2437 imageNode.alt = image.alt; 2438 captionNode.style.display = "block"; 2439 } else { 2440 captionNode.style.display = "none"; 2441 } 2442 trigger.checked = true; 2443 } 2444 </script> 2445 } 2446 } 2447 @using System.Reflection 2448 @using Dynamicweb.Rapido.Blocks.Components 2449 @using Dynamicweb.Rapido.Blocks.Components.Articles 2450 @using Dynamicweb.Rapido.Blocks 2451 2452 2453 @* Component for the articles *@ 2454 2455 @helper RenderArticleRelated(ArticleRelated settings) 2456 { 2457 string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : ""; 2458 string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : ""; 2459 2460 <section class="multiple-paragraphs-container related-articles-container paragraph-container--full-width"> 2461 <div class="center-container dw-mod"> 2462 <div class="grid u-padding u-margin-bottom--lg"> 2463 <div class="grid__col-md-12 grid__col-xs-12 u-margin-bottom--lg"> 2464 <h2 class="article__header related-header u-no-margin u-margin-top dw-mod">@Translate("Andre relevante nyheder")</h2> 2465 </div> 2466 </div> 2467 2468 <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> 2469 2470 <script id="RelatedSimpleTemplate" type="text/x-template"> 2471 {{#.}} 2472 <div class="grid u-padding-bottom--lg"> 2473 {{#Cases}} 2474 <div class="grid__col-md-3 grid__col-12 image-hover--zoom dw-mod"> 2475 <a href="{{link}}" class="u-full-height related-articles-container"> 2476 {{#if image}} 2477 <div class="u-color-light--bg u-no-padding dw-mod"> 2478 <div class="flex-img image-hover__wrapper"> 2479 <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}}" /> 2480 </div> 2481 </div> 2482 {{/if}} 2483 2484 <div class="card related-articles-container article-content-container dw-mod"> 2485 <p class="article__post-info dw-mod">{{date}}</p> 2486 <h3 class="article-list__item-header u-color-dark dw-mod">{{title}}</h3> 2487 @*<p class="article__short-summary dw-mod">{{summary}}</p>*@ 2488 </div> 2489 </a> 2490 </div> 2491 {{/Cases}} 2492 </div> 2493 {{/.}} 2494 </script> 2495 </div> 2496 </section> 2497 } 2498 @using System.Reflection 2499 @using Dynamicweb.Rapido.Blocks.Components 2500 @using Dynamicweb.Rapido.Blocks.Components.Articles 2501 @using Dynamicweb.Rapido.Blocks 2502 2503 2504 @* Component for the articles *@ 2505 2506 @helper RenderArticleMenu(ArticleMenu settings) 2507 { 2508 dynamic[] methodParameters = new dynamic[1]; 2509 methodParameters[0] = settings; 2510 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleMenuCustom"); 2511 2512 if (customMethod != null) 2513 { 2514 @customMethod.Invoke(this, methodParameters).ToString(); 2515 } else { 2516 if (!String.IsNullOrEmpty(settings.Title)) { 2517 <div class="u-margin u-border-bottom"> 2518 <h3 class="u-no-margin">@settings.Title</h3> 2519 </div> 2520 } 2521 2522 <ul class="menu-left u-margin-bottom dw-mod"> 2523 @foreach (var item in settings.Items) 2524 { 2525 @RenderArticleMenuItem(item) 2526 } 2527 </ul> 2528 } 2529 } 2530 2531 @helper RenderArticleMenuItem(ArticleMenuItem settings) 2532 { 2533 dynamic[] methodParameters = new dynamic[1]; 2534 methodParameters[0] = settings; 2535 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleMenuItemCustom"); 2536 2537 if (customMethod != null) 2538 { 2539 @customMethod.Invoke(this, methodParameters).ToString(); 2540 } else { 2541 string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#"; 2542 2543 if (!String.IsNullOrEmpty(settings.Title)) { 2544 <li class="menu-left__item dw-mod"> 2545 <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a> 2546 </li> 2547 } 2548 } 2549 } 2550 @using System.Reflection 2551 @using Dynamicweb.Rapido.Blocks.Components 2552 @using Dynamicweb.Rapido.Blocks.Components.Articles 2553 @using Dynamicweb.Rapido.Blocks 2554 2555 @* Component for the articles *@ 2556 2557 @helper RenderArticleList(ArticleList settings) 2558 { 2559 dynamic[] methodParameters = new dynamic[1]; 2560 methodParameters[0] = settings; 2561 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListCustom"); 2562 2563 if (customMethod != null) 2564 { 2565 @customMethod.Invoke(this, methodParameters).ToString(); 2566 } else { 2567 if (Pageview != null) 2568 { 2569 bool isParagraph = Pageview.CurrentParagraph != null ? true : false; 2570 string[] sortArticlesListBy = new string[2]; 2571 2572 if (isParagraph) { 2573 sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2574 } 2575 else { 2576 sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2577 } 2578 2579 string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString(); 2580 2581 @RenderItemList(new 2582 { 2583 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle", 2584 ListSourceType = settings.SourceType, 2585 ListSourcePage = sourcePage, 2586 ItemFieldsList = "*", 2587 Filter = settings.Filter, 2588 ListOrderBy = sortArticlesListBy[0], 2589 ListOrderByDirection = sortArticlesListBy[1], 2590 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date", 2591 ListSecondOrderByDirection = "ASC", 2592 IncludeAllChildItems = true, 2593 ListTemplate = settings.Template, 2594 ListPageSize = settings.PageSize.ToString() 2595 }); 2596 } 2597 } 2598 } 2599 @using System.Reflection 2600 @using Dynamicweb.Rapido.Blocks.Components.Articles 2601 2602 2603 @* Component for the articles *@ 2604 2605 @helper RenderArticleSummary(ArticleSummary settings) 2606 { 2607 dynamic[] methodParameters = new dynamic[1]; 2608 methodParameters[0] = settings; 2609 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSummaryCustom"); 2610 2611 if (customMethod != null) 2612 { 2613 @customMethod.Invoke(this, methodParameters).ToString(); 2614 } else { 2615 if (!String.IsNullOrEmpty(settings.Text)) 2616 { 2617 <div class="article__summary dw-mod">@settings.Text</div> 2618 } 2619 } 2620 } 2621 @using System.Reflection 2622 @using Dynamicweb.Rapido.Blocks.Components 2623 @using Dynamicweb.Rapido.Blocks.Components.Articles 2624 @using Dynamicweb.Rapido.Blocks 2625 2626 @* Component for the articles *@ 2627 2628 @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings) 2629 { 2630 dynamic[] methodParameters = new dynamic[1]; 2631 methodParameters[0] = settings; 2632 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListCategoryFilterCustom"); 2633 2634 if (customMethod != null) 2635 { 2636 @customMethod.Invoke(this, methodParameters).ToString(); 2637 } else { 2638 string pageId = Pageview.ID.ToString(); 2639 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All"); 2640 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2641 2642 foreach (var option in settings.Categories) 2643 { 2644 selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter; 2645 } 2646 2647 if (selectedFilter == pageId) 2648 { 2649 selectedFilter = Translate("All"); 2650 } 2651 2652 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2653 { 2654 <div class="u-pull--right u-margin-left"> 2655 <div class="collection u-no-margin"> 2656 <h5>@Translate("Category")</h5> 2657 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2658 <div class="dropdown u-w180px dw-mod"> 2659 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 2660 <div class="dropdown__content dw-mod"> 2661 @foreach (var option in settings.Categories) 2662 { 2663 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 2664 } 2665 </div> 2666 <label class="dropdown-trigger-off" for="CategorySelector"></label> 2667 </div> 2668 </div> 2669 </div> 2670 } 2671 else 2672 { 2673 <div class="u-full-width u-margin-bottom"> 2674 <h5 class="u-no-margin">@Translate("Category")</h5> 2675 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2676 <div class="dropdown u-full-width dw-mod"> 2677 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 2678 <div class="dropdown__content dw-mod"> 2679 @foreach (var option in settings.Categories) 2680 { 2681 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 2682 } 2683 </div> 2684 <label class="dropdown-trigger-off" for="CategorySelector"></label> 2685 </div> 2686 </div> 2687 } 2688 } 2689 } 2690 @using System.Reflection 2691 @using System.Web.Mvc 2692 @using Dynamicweb.Environment 2693 @using Dynamicweb.Rapido.Blocks.Components 2694 @using Dynamicweb.Rapido.Blocks.Components.Articles 2695 @using Dynamicweb.Rapido.Blocks 2696 2697 @* Component for the articles *@ 2698 2699 @helper RenderArticleListFilter(ArticleListFilter settings) 2700 { 2701 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All"); 2702 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2703 2704 if (settings.Options != null) 2705 { 2706 foreach (var option in settings.Options) 2707 { 2708 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter; 2709 } 2710 2711 @*DESKTOP*@ 2712 2713 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2714 { 2715 <div class="grid"> 2716 <div class="grid__col-12 paragraph-container customlist"> 2717 2718 <section class="grid__col-12" id="custom-facets-overall-container"> 2719 2720 <input type="checkbox" id="CheckFacetGroups" class="js-remember-state u-hidden" data-expand="CheckFacetGroups" /> 2721 <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"> 2722 <div class="grid__col-12"> 2723 2724 <input type="checkbox" id="OptionsGroup_{{name}}" class="expand-trigger js-remember-state mobile-facet-input" {{defaultState}} /> 2725 2726 <div class="grid__col-12 expand-container facets-container__box custom-expand-container dw-mod js-filter"> 2727 <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> 2728 <div class="expand-container__content custom-expand-content-container dw-mod"> 2729 <div class="facets-container__list dw-mod"> 2730 <div class="grid__col-12 grid--direction-row u-no-padding grid--wrap"> 2731 @foreach (var option in settings.Options) 2732 { 2733 2734 var currentUrl = HttpContext.Current.Request.QueryString.ToString(); 2735 2736 <div class="grid__col-lg-3 grid__col-sm-3 grid__col-xs-12 u-no-padding-y"> 2737 @if (currentUrl.Contains(settings.SystemName + "=" + option.Value)) 2738 { 2739 <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)"> 2740 2741 } 2742 2743 else 2744 { 2745 <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)"> 2746 2747 } 2748 <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> 2749 </div> 2750 2751 } 2752 </div> 2753 </div> 2754 </div> 2755 </div> 2756 </div> 2757 </div> 2758 <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> 2759 <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> 2760 </section> 2761 </div> 2762 </div> 2763 2764 } 2765 2766 @*MOBILE*@ 2767 2768 else 2769 { 2770 <div class="grid"> 2771 <div class="grid__col-12 customlist u-no-padding"> 2772 2773 <section class="grid__col-12 u-no-padding" id="custom-facets-overall-container"> 2774 2775 @* REMEMBER TO MATCH HTML ATTRIBUTES DATA-EXPAND AND DATA-TRIGGER WITH THE GIVEN BUTTON (IN THIS SCENARIO CHECKFILTERS BUTTON FROM ARTICLECOMPONENTS.CSHTML) *@ 2776 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" /> 2777 <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"> 2778 <div class="grid__col-12"> 2779 2780 <input type="checkbox" id="OptionsGroup_{{name}}" class="expand-trigger js-remember-state mobile-facet-input" /> 2781 2782 <div class="grid__col-12 expand-container facets-container__box custom-expand-container dw-mod js-filter"> 2783 <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> 2784 <div class="expand-container__content custom-expand-content-container dw-mod"> 2785 <div class="facets-container__list dw-mod"> 2786 <div class="grid__col-12 grid--direction-row u-no-padding grid--wrap"> 2787 @foreach (var option in settings.Options) 2788 { 2789 2790 var currentUrl = HttpContext.Current.Request.QueryString.ToString(); 2791 2792 <div class="grid__col-lg-3 grid__col-sm-4 grid__col-xs-12 u-no-padding-y"> 2793 @if (currentUrl.Contains(settings.SystemName + "=" + option.Value)) 2794 { 2795 <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)"> 2796 2797 } 2798 2799 else 2800 { 2801 <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)"> 2802 2803 } 2804 <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> 2805 </div> 2806 2807 } 2808 </div> 2809 </div> 2810 </div> 2811 </div> 2812 </div> 2813 </div> 2814 2815 </section> 2816 </div> 2817 </div> 2818 2819 } 2820 } 2821 } 2822 @using System.Reflection 2823 @using Dynamicweb.Rapido.Blocks.Components 2824 @using Dynamicweb.Rapido.Blocks.Components.Articles 2825 @using Dynamicweb.Rapido.Blocks 2826 2827 @* Component for the articles *@ 2828 2829 @helper RenderArticleListSearch(ArticleListSearch settings) 2830 { 2831 dynamic[] methodParameters = new dynamic[1]; 2832 methodParameters[0] = settings; 2833 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListSearchCustom"); 2834 2835 if (customMethod != null) 2836 { 2837 @customMethod.Invoke(this, methodParameters).ToString(); 2838 } else { 2839 string searchString = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("Title")) ? HttpContext.Current.Request.QueryString.Get("Title").Trim('*') : ""; 2840 string className = "u-w340px u-pull--right u-margin-left"; 2841 2842 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 2843 { 2844 className = "u-full-width"; 2845 } 2846 2847 <div class="typeahead u-color-inherit u-margin-bottom dw-mod @className"> 2848 <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 + '*')"> 2849 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button> 2850 </div> 2851 } 2852 } 2853 @using System.Reflection 2854 @using Dynamicweb.Rapido.Blocks.Components 2855 @using Dynamicweb.Rapido.Blocks.Components.Articles 2856 @using Dynamicweb.Rapido.Blocks 2857 2858 @* Component for the articles *@ 2859 2860 @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings) 2861 { 2862 dynamic[] methodParameters = new dynamic[1]; 2863 methodParameters[0] = settings; 2864 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListNoResultsInfoCustom"); 2865 2866 if (customMethod != null) 2867 { 2868 @customMethod.Invoke(this, methodParameters).ToString(); 2869 } else { 2870 <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div> 2871 } 2872 } 2873 2874 @using System.Reflection 2875 @using Dynamicweb.Rapido.Blocks.Components 2876 @using Dynamicweb.Rapido.Blocks.Components.General 2877 @using Dynamicweb.Rapido.Blocks.Components.Articles 2878 @using Dynamicweb.Rapido.Blocks 2879 @using System.Text.RegularExpressions 2880 @using S_DW_HD2412.CustomCode 2881 2882 @* Component for the articles *@ 2883 2884 @helper RenderArticleListItem(ArticleListItemExtended settings) 2885 { 2886 switch (settings.Type) { 2887 case ArticleListItemType.Card: 2888 @RenderArticleListItemCard(settings); 2889 break; 2890 case ArticleListItemType.List: 2891 @RenderArticleListItemList(settings); 2892 break; 2893 case ArticleListItemType.Simple: 2894 @RenderArticleListItemSimple(settings); 2895 break; 2896 default: 2897 @RenderArticleListItemCard(settings); 2898 break; 2899 } 2900 } 2901 2902 @helper RenderArticleListItemExtended(ArticleListItemExtended settings) 2903 { 2904 switch (settings.Type) { 2905 case ArticleListItemType.Card: 2906 @RenderArticleListItemCard(settings); 2907 break; 2908 case ArticleListItemType.List: 2909 @RenderArticleListItemList(settings); 2910 break; 2911 case ArticleListItemType.Simple: 2912 @RenderArticleListItemSimple(settings); 2913 break; 2914 default: 2915 @RenderArticleListItemCard(settings); 2916 break; 2917 } 2918 } 2919 2920 @helper RenderArticleListItemCard(ArticleListItemExtended settings) { 2921 <a href="@settings.Link" class="u-full-height u-color-light--bg"> 2922 <div class="u-color-light--bg u-no-padding dw-mod"> 2923 @if (settings.Logo != null) 2924 { 2925 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;" : ""; 2926 settings.Logo.ImageDefault.Crop = 5; 2927 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 2928 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 2929 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 2930 @if (settings.Stickers != null) 2931 { 2932 if (settings.Stickers.Position != StickersListPosition.Custom) 2933 { 2934 @RenderStickersCollection(settings.Stickers); 2935 } 2936 } 2937 @RenderImage(settings.Logo) 2938 </div> 2939 } 2940 else if (settings.Image != null) 2941 { 2942 <div class="flex-img image-hover__wrapper u-position-relative dw-mod"> 2943 @if (settings.Stickers != null) 2944 { 2945 if (settings.Stickers.Position != StickersListPosition.Custom) 2946 { 2947 @RenderStickersCollection(settings.Stickers); 2948 } 2949 } 2950 @RenderImage(settings.Image) 2951 </div> 2952 } 2953 </div> 2954 2955 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 2956 { 2957 2958 <div class="paragraph-card u-color-light--bg dw-mod"> 2959 2960 2961 @if (settings.Stickers != null) 2962 { 2963 if (settings.Stickers.Position == StickersListPosition.Custom) 2964 { 2965 @RenderStickersCollection(settings.Stickers) 2966 ; 2967 } 2968 } 2969 @if (!String.IsNullOrEmpty(settings.Title)) 2970 { 2971 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 2972 } 2973 @if (!String.IsNullOrEmpty(settings.Date)) 2974 { 2975 <div class="article__post-info dw-mod">@DateTime.Parse(settings.Date).ToString("dd-MM-yyyy")</div> 2976 } 2977 @if (!String.IsNullOrEmpty(settings.SubTitle)) 2978 { 2979 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 2980 } 2981 @if (!String.IsNullOrEmpty(settings.Summary)) 2982 { 2983 <p class="article__short-summary dw-mod">@settings.Summary</p> 2984 } 2985 <a href="@settings.Link" class="search-result__name search"> 2986 @Translate("Read more") 2987 </a> 2988 </div> 2989 } 2990 </a> 2991 } 2992 2993 @helper RenderArticleListItemList(ArticleListItemExtended settings) { 2994 <a href="@settings.Link"> 2995 <div class="grid u-color-light--bg u-no-padding dw-mod"> 2996 <div class="grid__col-md-3"> 2997 <div class="u-color-light--bg u-no-padding dw-mod"> 2998 @if (settings.Logo != null) 2999 { 3000 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;" : ""; 3001 settings.Logo.ImageDefault.Crop = 5; 3002 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 3003 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 3004 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 3005 @if (settings.Stickers != null) 3006 { 3007 if (settings.Stickers.Position != StickersListPosition.Custom) 3008 { 3009 @RenderStickersCollection(settings.Stickers); 3010 } 3011 } 3012 @RenderImage(settings.Logo) 3013 </div> 3014 } else if (settings.Image != null) 3015 { 3016 <div class="flex-img image-hover__wrapper dw-mod"> 3017 @if (settings.Stickers != null) 3018 { 3019 if (settings.Stickers.Position != StickersListPosition.Custom) 3020 { 3021 @RenderStickersCollection(settings.Stickers); 3022 } 3023 } 3024 @RenderImage(settings.Image) 3025 </div> 3026 } 3027 </div> 3028 </div> 3029 3030 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 3031 { 3032 <div class="grid__col-md-9"> 3033 @if (!String.IsNullOrEmpty(settings.Title)) 3034 { 3035 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 3036 } 3037 @if (settings.Stickers != null) 3038 { 3039 if (settings.Stickers.Position == StickersListPosition.Custom) 3040 { 3041 @RenderStickersCollection(settings.Stickers); 3042 } 3043 } 3044 @if (!String.IsNullOrEmpty(settings.SubTitle)) 3045 { 3046 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 3047 } 3048 @if (!String.IsNullOrEmpty(settings.Summary)) 3049 { 3050 <p class="article__short-summary dw-mod">@settings.Summary</p> 3051 } 3052 </div> 3053 } 3054 </div> 3055 </a> 3056 } 3057 3058 @helper RenderArticleListItemSimple(ArticleListItemExtended settings) { 3059 <a href="@settings.Link" class="u-color-inherit"> 3060 <div class="grid u-color-light--bg u-no-padding dw-mod"> 3061 <div class="grid__col-md-12"> 3062 @if (!String.IsNullOrEmpty(settings.Title)) 3063 { 3064 <section class="grid__col-12 grid--justify-center"> 3065 @*<h2 class="search-headline-the-one"> 3066 @settings.Title 3067 </h2>*@ 3068 </section> 3069 3070 } 3071 @if (!String.IsNullOrEmpty(settings.SubTitle)) 3072 { 3073 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 3074 } 3075 </div> 3076 </div> 3077 </a> 3078 } 3079 @using System.Reflection 3080 @using Dynamicweb.Rapido.Blocks.Components.Articles 3081 3082 3083 @* Component for the articles *@ 3084 3085 @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings) 3086 { 3087 dynamic[] methodParameters = new dynamic[1]; 3088 methodParameters[0] = settings; 3089 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleAuthorAndDateCustom"); 3090 3091 if (customMethod != null) 3092 { 3093 @customMethod.Invoke(this, methodParameters).ToString(); 3094 } else { 3095 <small class="article__subscription"> 3096 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 3097 { 3098 <text>@Translate("Written")</text> 3099 } 3100 @if (!string.IsNullOrWhiteSpace(settings.Author)) 3101 { 3102 <text>@Translate("by") @settings.Author</text> 3103 } 3104 @if (!string.IsNullOrWhiteSpace(settings.Date)) 3105 { 3106 <text>@Translate("on") @settings.Date</text> 3107 } 3108 </small> 3109 } 3110 } 3111 @using System.Reflection 3112 @using Dynamicweb.Rapido.Blocks.Components.Articles 3113 3114 3115 @* Component for the articles *@ 3116 3117 @helper RenderArticleLink(ArticleLink settings) 3118 { 3119 dynamic[] methodParameters = new dynamic[1]; 3120 methodParameters[0] = settings; 3121 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleLinkCustom"); 3122 3123 if (customMethod != null) 3124 { 3125 @customMethod.Invoke(this, methodParameters).ToString(); 3126 } else { 3127 if (!String.IsNullOrEmpty(settings.Title)) 3128 { 3129 <div class="grid__cell"> 3130 @RenderButton(settings) 3131 </div> 3132 } 3133 } 3134 } 3135 @using System.Reflection 3136 @using Dynamicweb.Rapido.Blocks 3137 @using Dynamicweb.Rapido.Blocks.Components.Articles 3138 @using Dynamicweb.Rapido.Blocks.Components.General 3139 3140 3141 @* Component for the articles *@ 3142 3143 @helper RenderArticleCarousel(ArticleCarousel settings) 3144 { 3145 dynamic[] methodParameters = new dynamic[1]; 3146 methodParameters[0] = settings; 3147 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 3148 3149 if (customMethod != null) 3150 { 3151 @customMethod.Invoke(this, methodParameters).ToString(); 3152 } else { 3153 <div class="grid"> 3154 <div class="grid__col-12"> 3155 <div class="carousel" id="carousel_@settings.Id"> 3156 <div class="carousel__container js-carousel-slides dw-mod"> 3157 @RenderBlockList(settings.SubBlocks) 3158 </div> 3159 </div> 3160 </div> 3161 </div> 3162 3163 <script> 3164 document.addEventListener("DOMContentLoaded", function () { 3165 new CarouselModule("#carousel_@settings.Id", { 3166 slideTime: 0, 3167 dots: true 3168 }); 3169 }); 3170 </script> 3171 } 3172 } 3173 3174 @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings) 3175 { 3176 dynamic[] methodParameters = new dynamic[1]; 3177 methodParameters[0] = settings; 3178 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 3179 3180 if (customMethod != null) 3181 { 3182 @customMethod.Invoke(this, methodParameters).ToString(); 3183 } 3184 else 3185 { 3186 string imageEngine = "/Admin/Public/GetImage.ashx?"; 3187 3188 string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image; 3189 if (settings.ImageSettings != null) 3190 { 3191 defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : ""; 3192 defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : ""; 3193 defaultImage += "Crop=" + settings.ImageSettings.Crop + "&"; 3194 defaultImage += "Compression=" + settings.ImageSettings.Compression + "&"; 3195 defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&"; 3196 defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&"; 3197 } 3198 defaultImage += "&Image=" + settings.Image; 3199 3200 <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')"> 3201 <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title"> 3202 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2> 3203 <div class="article-list__item-info"> 3204 @if (settings.Stickers != null) 3205 { 3206 settings.Stickers.Position = StickersListPosition.Custom; 3207 @RenderStickersCollection(settings.Stickers); 3208 } 3209 3210 <small class="u-margin-top--lg u-color-light"> 3211 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 3212 { 3213 <text>@Translate("Written")</text> 3214 } 3215 @if (!string.IsNullOrWhiteSpace(settings.Author)) 3216 { 3217 <text>@Translate("by") @settings.Author</text> 3218 } 3219 @if (!string.IsNullOrWhiteSpace(settings.Date)) 3220 { 3221 <text>@Translate("on") @settings.Date</text> 3222 } 3223 </small> 3224 </div> 3225 3226 <h3 class="article__short-summary u-color-light">@settings.Summary</h3> 3227 </a> 3228 @if (settings.UseFilters == true) 3229 { 3230 <div class="background-image image-filter image-filter--darken dw-mod"></div> 3231 } 3232 </div> 3233 } 3234 } 3235 @using System.Text.RegularExpressions 3236 @using Dynamicweb.Rapido.Blocks.Components 3237 @using Dynamicweb.Rapido.Blocks.Components.General 3238 @using Dynamicweb.Rapido.Blocks.Components.Articles 3239 @using Dynamicweb.Rapido.Blocks 3240 3241 @* Component for the articles *@ 3242 3243 @helper RenderArticleVideo(ArticleVideo settings) 3244 { 3245 dynamic[] methodParameters = new dynamic[1]; 3246 methodParameters[0] = settings; 3247 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleTextCustom"); 3248 3249 if (customMethod != null) 3250 { 3251 @customMethod.Invoke(this, methodParameters).ToString(); 3252 } else { 3253 if (settings.Url != null) 3254 { 3255 //getting video ID from youtube URL 3256 string videoCode = settings.Url; 3257 Regex regex = new Regex(@".be\/(.[^?]*)"); 3258 Match match = regex.Match(videoCode); 3259 string videoId = ""; 3260 if (match.Success) 3261 { 3262 videoId = match.Groups[1].Value; 3263 } 3264 else 3265 { 3266 regex = new Regex(@"v=([^&]+)"); 3267 match = regex.Match(videoCode); 3268 if (match.Success) 3269 { 3270 videoId = match.Groups[1].Value; 3271 } 3272 } 3273 3274 int autoPlay = settings.AutoPlay == "true" ? 1 : 0; 3275 3276 <div class="video-wrapper"> 3277 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div> 3278 </div> 3279 } 3280 } 3281 } 3282 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3283 @using System.Reflection 3284 @using Dynamicweb.Rapido.Blocks.Components 3285 @using Dynamicweb.Rapido.Blocks.Components.General 3286 @using Dynamicweb.Rapido.Blocks.Components.Articles 3287 @using Dynamicweb.Rapido.Blocks 3288 @using S_DW_HD2412.CustomCode 3289 3290 3291 3292 @helper RenderSocialShare() 3293 { 3294 string siteURL = Pageview.SearchFriendlyUrl.ToString(); 3295 3296 <section class="socialshare grid__col-md-12 grid__col--bleed grid-custom-layout grid--justify-center u-padding--lg dw-mod"> 3297 <div class="socialheader grid__col-md-12 u-no-padding u-border-bottom"> 3298 <h3>@Translate("ShareThis")</h3> 3299 </div> 3300 <div class="sociallinks grid__col-md-12 u-no-padding"> 3301 <div class="social-container"> 3302 <div class="links"> 3303 <div class="icon-nz-nz-facebook links-share" data-sharer="facebook" data-url="@siteURL"></div> 3304 <div class="linkedin icon-nz-nz-linkedin links-share" data-sharer="linkedin" data-url="@siteURL"></div> 3305 <div data-icon-nz="nz-link" class="js-geturl icon-nz-nz-link links-share" aria-label="Copy link"> 3306 <div class="links-input js-show-hide"> 3307 <input class="js-urlCopied"> 3308 </div> 3309 </div> 3310 </div> 3311 </div> 3312 </div> 3313 </section> 3314 } 3315 3316 3317 @* Simple helpers *@ 3318 3319 @*Requires the Gallery ItemType that comes with Rapido*@ 3320 @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) 3321 { 3322 string placeHolderImage = "/Files/Images/placeholder.gif"; 3323 3324 <main class="wrapper grid grid--direction-row"> 3325 <section class="gallery grid__col-lg-9 grid__col-sm-12"> 3326 <div class="swiper-container gallery-top"> 3327 <div class="swiper-wrapper"> 3328 @if (gallery != null && gallery.Count > 0) 3329 { 3330 int count = 1; 3331 3332 foreach (var item in gallery) 3333 { 3334 if (item.GetFile("ImagePath") != null) 3335 { 3336 string focalPointParameters = item.GetFile("ImagePath") != null ? "&" + item.GetFile("ImagePath").GetFocalPointParameters() : ""; 3337 3338 string image = item.GetFile("ImagePath").PathUrlEncoded + focalPointParameters; 3339 int imagesCount = gallery.Count; 3340 string text = item.GetString("Text"); 3341 3342 <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"> 3343 <div class="swiper-text">@text</div> 3344 </div> 3345 3346 count++; 3347 } 3348 } 3349 } 3350 </div> 3351 <div class="swiper-button-next swiper-button-white"></div> 3352 <div class="swiper-button-prev swiper-button-white"></div> 3353 </div> 3354 </section> 3355 @if (gallery != null && gallery.Count > 0) 3356 { 3357 <section class="thumbs grid__col-lg-3 grid__col-sm-12"> 3358 <div class="swiper-container gallery-thumbs"> 3359 <div class="swiper-wrapper"> 3360 @{ 3361 int count = 1; 3362 } 3363 3364 @foreach (var item in gallery) 3365 { 3366 if (item.GetFile("ImagePath") != null) 3367 { 3368 string focalPointParameters = item.GetFile("ImagePath") != null ? "&" + item.GetFile("ImagePath").GetFocalPointParameters() : ""; 3369 3370 string image = item.GetFile("ImagePath").PathUrlEncoded + focalPointParameters; 3371 int imagesCount = gallery.Count; 3372 string text = item.GetString("Text"); 3373 3374 <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" /> 3375 3376 count++; 3377 } 3378 } 3379 </div> 3380 </div> 3381 </section> 3382 } 3383 </main> 3384 3385 } 3386 3387 @helper RenderArticleItemGalleryModal() 3388 { 3389 <!-- Trigger for the gallery modal --> 3390 <input type="checkbox" id="GalleryModalTrigger" class="modal-trigger" /> 3391 3392 <!-- Gallery modal --> 3393 <div class="modal-container"> 3394 <label for="GalleryModalTrigger" id="GalleryModalOverlay" class="modal-overlay"></label> 3395 <div class="modal modal--full" id="GalleryModal"> 3396 <div class="modal__body modal__body--full"> 3397 <div class="gallery-slider"> 3398 <div class="gallery-slider__image"> 3399 <img src="#" alt="" class="modal--full__img" id="FullImage" /> 3400 </div> 3401 <div class="gallery-slider__image-counter" id="FullImage_counter"></div> 3402 <label class="gallery-slider__close-btn" for="GalleryModalTrigger"></label> 3403 <button class="gallery-slider__previous-btn" id="FullImage_prev" onclick="Gallery.prevImage('FullImage')"></button> 3404 <button class="gallery-slider__next-btn" id="FullImage_next" onclick="Gallery.nextImage('FullImage')"></button> 3405 </div> 3406 </div> 3407 </div> 3408 </div> 3409 } 3410 3411 3412 @helper RenderMobileFilters(List<Block> settings) 3413 { 3414 if (settings.Count > 0) 3415 { 3416 <div class="grid__col-12"> 3417 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" /> 3418 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters"> 3419 @RenderBlockList(settings) 3420 </div> 3421 @*<label for="CheckFilters" class="btn btn--primary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label> 3422 <label for="CheckFilters" class="btn btn--primary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label>*@ 3423 </div> 3424 } 3425 } 3426 3427 3428 3429 @using System.Reflection 3430 @using Dynamicweb.Rapido.Blocks.Components 3431 @using Dynamicweb.Rapido.Blocks.Components.General 3432 @using Dynamicweb.Rapido.Blocks 3433 3434 3435 @* Component *@ 3436 3437 @helper RenderPagination(Pagination settings) 3438 { 3439 string pagingTag = settings.PagingTag; 3440 3441 if (!string.IsNullOrWhiteSpace(GetString(pagingTag + ".Paging.Show"))) 3442 { 3443 <div class="pager u-margin-top dw-mod"> 3444 @if (settings.ShowPagingInfo) 3445 { 3446 <div class="pager__info dw-mod"> 3447 @Translate("Page") @GetString(pagingTag + ".Paging.CurrentPage") @Translate("of") @GetString(pagingTag + ".Paging.NumPages") 3448 </div> 3449 } 3450 <ul class="pager__list dw-mod"> 3451 @if (!string.IsNullOrWhiteSpace(GetString(pagingTag + ".Paging.First.URL")) && settings.ShowFirstAndLastControls) 3452 { 3453 @RenderPaginationItem(new PaginationItem { Link = GetString(pagingTag + ".Paging.First.URL"), Icon = settings.FirstIcon }) 3454 } 3455 @if (!string.IsNullOrWhiteSpace(GetString(pagingTag + ".Paging.Back.URL")) && settings.ShowNextAndPrevControls) 3456 { 3457 @RenderPaginationItem(new PaginationItem { Link = GetString(pagingTag + ".Paging.Back.URL"), Icon = settings.PrevIcon }) 3458 } 3459 @if (!string.IsNullOrWhiteSpace(GetString(pagingTag + ".Paging.HasPages"))) 3460 { 3461 foreach (LoopItem page in GetLoop(pagingTag + ".Paging.Pages")) 3462 { 3463 bool isActive = page.GetString(pagingTag + ".Paging.PageClass") == "currentPage"; 3464 @RenderPaginationItem(new PaginationItem { Link = page.GetString(pagingTag + ".Paging.PageIndexUrl"), Label = page.GetString(pagingTag + ".Paging.PageIndex"), IsActive = isActive }) 3465 } <text></text> 3466 } 3467 @if (!string.IsNullOrWhiteSpace(GetString(pagingTag + ".Paging.Forward.URL")) && settings.ShowNextAndPrevControls) 3468 { 3469 @RenderPaginationItem(new PaginationItem { Link = GetString(pagingTag + ".Paging.Forward.URL"), Icon = settings.NextIcon }) 3470 } 3471 @if (!string.IsNullOrWhiteSpace(GetString(pagingTag + ".Paging.Last.URL")) && settings.ShowFirstAndLastControls) 3472 { 3473 @RenderPaginationItem(new PaginationItem { Link = GetString(pagingTag + ".Paging.Last.URL"), Icon = settings.FirstIcon }) 3474 } 3475 </ul> 3476 </div> 3477 } 3478 } 3479 3480 @helper RenderPaginationItem(PaginationItem settings) 3481 { 3482 <li class="pager__btn dw-mod"> 3483 @if (settings.IsActive) 3484 { 3485 <span class="pager__num pager__num--current dw-mod"> 3486 @settings.Label 3487 3488 @if (settings.Icon != null) 3489 { 3490 @RenderIcon(new Icon { Prefix = settings.Icon.Prefix, Name = settings.Icon.Name }) 3491 } 3492 </span> 3493 } 3494 else 3495 { 3496 <a href="@settings.Link" class="pager__num dw-mod"> 3497 @settings.Label 3498 3499 @if (settings.Icon != null) 3500 { 3501 @RenderIcon(new Icon { Prefix = settings.Icon.Prefix, Name = settings.Icon.Name }) 3502 } 3503 </a> 3504 } 3505 </li> 3506 } 3507 @if (File.Exists(HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/Components/Custom/Custom__Components.cshtml"))) 3508 { 3509 <text>@using Dynamicweb.Rapido.Blocks.Components.General 3510 </text> 3511 } 3512 3513 @* Include the Blocks for the page *@ 3514 @if (File.Exists(HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/ItemPublisher/List/Blocks/Custom__Blocks.cshtml"))) 3515 { 3516 <text>@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3517 @using Dynamicweb.Core 3518 @using System 3519 @using System.Web 3520 @using System.Collections.Generic 3521 @using Dynamicweb.Rapido.Blocks 3522 3523 @{ 3524 3525 }</text> 3526 } 3527 3528 3529 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 3530 @RenderBlockList(articlePage.BlocksRoot.BlocksList) 3531
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_820ba736cb5043b9b036167802f33c56.<>c__DisplayClass3_0.<RenderBlock>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_820ba736cb5043b9b036167802f33c56.<>c__DisplayClass2_0.<RenderBlockList>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_820ba736cb5043b9b036167802f33c56.<RenderPopularList>b__65_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_HD2412\Files\Templates\Designs\Rapido\ItemPublisher\List\SimpleList.cshtml:line 3202
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_820ba736cb5043b9b036167802f33c56.<>c__DisplayClass3_0.<RenderBlock>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_820ba736cb5043b9b036167802f33c56.<>c__DisplayClass2_0.<RenderBlockList>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_820ba736cb5043b9b036167802f33c56.<>c__DisplayClass3_0.<RenderBlock>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_820ba736cb5043b9b036167802f33c56.<>c__DisplayClass2_0.<RenderBlockList>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_820ba736cb5043b9b036167802f33c56.<>c__DisplayClass3_0.<RenderBlock>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_820ba736cb5043b9b036167802f33c56.<>c__DisplayClass2_0.<RenderBlockList>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_820ba736cb5043b9b036167802f33c56.Execute() in D:\dynamicweb.net\Solutions\S_DW_HD2412\Files\Templates\Designs\Rapido\ItemPublisher\List\SimpleList.cshtml:line 3189
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.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 dynamic[] methodParameters = new dynamic[1]; 1543 methodParameters[0] = settings; 1544 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerCustom"); 1545 1546 var ieClass = ie10String || ie9String || ie11String ? "ie-hero" : ""; 1547 1548 if (customMethod != null) 1549 { 1550 @customMethod.Invoke(this, methodParameters).ToString(); 1551 } 1552 else 1553 { 1554 settings.Layout = ArticleHeaderLayout.Banner; 1555 1556 if (settings.Image != null) 1557 { 1558 if (settings.Image.Path != null) 1559 { 1560 <div class="grid__col-md-12 grid__col--bleed u-padding-bottom--lg"> 1561 <section class="@ieClass hero multiple-paragraphs-container paragraph-container grid--justify-center"> 1562 <div class="background-image image-filter"> 1563 <div class="background-image__wrapper image-filter"> 1564 <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="@settings.Image.Path"> 1565 @if (!string.IsNullOrEmpty(videoCode)) 1566 { 1567 1568 <div class="video-background"> 1569 <div class="video-background__container"> 1570 <div class="js-youtube-video" data-video="@videoCode" id="ytPlayer"></div> 1571 </div> 1572 </div> 1573 } 1574 </div> 1575 </div> 1576 <div class="grid paragraph-container--height-xl @heroHeight grid--justify-center dw-mod"> 1577 <div class="grid__col-sm-12 grid__col-xs-12 paragraph-container dw-mod grid--justify-center "> 1578 </div> 1579 </div> 1580 @if (ie10String || ie9String || ie11String) 1581 { 1582 <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"> 1583 <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> 1584 <g id="shop_forside_1" transform="translate(0.000000, -376.000000)" fill="#FFFFFF"> 1585 <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> 1586 </g> 1587 </g> 1588 </svg> 1589 } 1590 1591 else 1592 { 1593 <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"> 1594 <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> 1595 <g id="shop_forside_1" transform="translate(0.000000, -376.000000)" fill="#FFFFFF"> 1596 <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> 1597 </g> 1598 </g> 1599 </svg> 1600 } 1601 </section> 1602 </div> 1603 } 1604 else 1605 { 1606 settings.Layout = ArticleHeaderLayout.Clean; 1607 @RenderArticleCleanHeader(settings); 1608 } 1609 } 1610 else 1611 { 1612 settings.Layout = ArticleHeaderLayout.Clean; 1613 @RenderArticleCleanHeader(settings); 1614 } 1615 1616 if (!String.IsNullOrEmpty(headline)) 1617 { 1618 <h1 class="article__leadtext dw-mod grid-custom-layout-third">@headline</h1> 1619 1620 } 1621 } 1622 } 1623 @using System.Reflection 1624 @using Dynamicweb.Frontend 1625 @using Dynamicweb.Rapido.Blocks.Components 1626 @using Dynamicweb.Rapido.Blocks.Components.General 1627 @using Dynamicweb.Rapido.Blocks.Components.Articles 1628 @using Dynamicweb.Rapido.Blocks 1629 @using S_DW_HD2412.CustomCode 1630 1631 1632 1633 @* Component for the articles *@ 1634 1635 @helper RenderArticleHeaderExtended(ArticleHeaderExtended settings) 1636 { 1637 dynamic[] methodParameters = new dynamic[1]; 1638 methodParameters[0] = settings; 1639 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleHeaderCustom"); 1640 1641 if (customMethod != null) 1642 { 1643 @customMethod.Invoke(this, methodParameters).ToString(); 1644 } 1645 else 1646 { 1647 switch (settings.Layout) 1648 { 1649 case ArticleHeaderLayout.Clean: 1650 @RenderArticleCleanHeader(settings); 1651 break; 1652 case ArticleHeaderLayout.Split: 1653 @RenderArticleSplitHeader(settings); 1654 break; 1655 case ArticleHeaderLayout.Banner: 1656 @RenderArticleBannerHeader(settings); 1657 break; 1658 case ArticleHeaderLayout.Overlay: 1659 @RenderArticleOverlayHeader(settings); 1660 break; 1661 default: 1662 @RenderArticleCleanHeader(settings); 1663 break; 1664 } 1665 } 1666 } 1667 1668 @helper RenderArticleCleanHeader(ArticleHeader settings) 1669 { 1670 dynamic[] methodParameters = new dynamic[1]; 1671 methodParameters[0] = settings; 1672 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom"); 1673 1674 if (customMethod != null) 1675 { 1676 @customMethod.Invoke(this, methodParameters).ToString(); 1677 } 1678 else 1679 { 1680 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 1681 1682 <div class="grid grid--align-content-start grid--justify-start"> 1683 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod"> 1684 1685 1686 <div class="grid__cell"> 1687 @if (settings.Image != null) 1688 { 1689 if (settings.Image.Path != null) 1690 { 1691 <div class="u-padding-bottom--lg"> 1692 @RenderImage(settings.Image) 1693 </div> 1694 1695 } 1696 } 1697 1698 @if (!String.IsNullOrEmpty(settings.Heading)) 1699 { 1700 1701 //Check to hide heading if the item is not a Dynamic Article 1702 var ItemName = PageView.Current().Item.SystemName; 1703 1704 if (ItemName == "DynamicArticle") 1705 { 1706 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 1707 } 1708 1709 else 1710 { 1711 } 1712 1713 } 1714 1715 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0) 1716 { 1717 <div class="u-padding-bottom"> 1718 @*@if (!String.IsNullOrEmpty(settings.Category)) 1719 { 1720 <div class="u-pull--left"> 1721 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 1722 </div> 1723 }*@ 1724 <div class=""> 1725 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1726 { 1727 <small class="article__post-info dw-mod">@Translate("Author"): @settings.Author, @settings.Date</small> 1728 } 1729 @*@if (settings.RatingOutOf != 0) 1730 { 1731 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 1732 }*@ 1733 </div> 1734 </div> 1735 1736 } 1737 1738 @if (!String.IsNullOrEmpty(settings.Subheading)) 1739 { 1740 <div class="article__leadtext news-article-leadtext dw-mod">@settings.Subheading</div> 1741 } 1742 @if (!String.IsNullOrEmpty(settings.Link)) 1743 { 1744 <div class="grid__cell"> 1745 @RenderButton(new Button { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 1746 </div> 1747 } 1748 </div> 1749 </div> 1750 @if (settings.ExternalParagraphId != 0) 1751 { 1752 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod"> 1753 @RenderParagraphContent(settings.ExternalParagraphId) 1754 </div> 1755 } 1756 </div> 1757 } 1758 } 1759 1760 @helper RenderArticleSplitHeader(ArticleHeader settings) 1761 { 1762 dynamic[] methodParameters = new dynamic[1]; 1763 methodParameters[0] = settings; 1764 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSplitHeaderCustom"); 1765 1766 if (customMethod != null) 1767 { 1768 @customMethod.Invoke(this, methodParameters).ToString(); 1769 } 1770 else 1771 { 1772 string headerColumnWidth = settings.ExternalParagraphId != 0 ? "4" : "6"; 1773 1774 if (settings.Image != null) 1775 { 1776 if (settings.Image.Path != null) 1777 { 1778 <section class="multiple-paragraphs-container paragraph-container--full-width"> 1779 <div class="grid"> 1780 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod"> 1781 <div class="u-left-middle u-padding--lg"> 1782 <div> 1783 @if (!String.IsNullOrEmpty(settings.Category)) 1784 { 1785 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 1786 } 1787 @if (!String.IsNullOrEmpty(settings.Heading)) 1788 { 1789 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 1790 } 1791 @if (!String.IsNullOrEmpty(settings.Subheading)) 1792 { 1793 <div class="article__leadtext dw-mod">@settings.Subheading</div> 1794 } 1795 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1796 { 1797 <small class="article__post-info u-pull--left dw-mod">@settings.Author @settings.Date</small> 1798 } 1799 @if (settings.RatingOutOf != 0) 1800 { 1801 <div class="u-pull--right"> 1802 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 1803 </div> 1804 } 1805 @if (!String.IsNullOrEmpty(settings.Link)) 1806 { 1807 @RenderButton(new Button { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 1808 } 1809 </div> 1810 </div> 1811 </div> 1812 <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> 1813 @if (settings.ExternalParagraphId != 0) 1814 { 1815 <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"> 1816 @RenderParagraphContent(settings.ExternalParagraphId) 1817 </div> 1818 } 1819 </div> 1820 </section> 1821 } 1822 } 1823 else 1824 { 1825 @RenderArticleCleanHeader(settings); 1826 } 1827 } 1828 } 1829 1830 @helper RenderArticleOverlayHeader(ArticleHeader settings) 1831 { 1832 dynamic[] methodParameters = new dynamic[1]; 1833 methodParameters[0] = settings; 1834 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleOverlayHeaderCustom"); 1835 1836 if (customMethod != null) 1837 { 1838 @customMethod.Invoke(this, methodParameters).ToString(); 1839 } 1840 else 1841 { 1842 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 1843 string contentAlignment = settings.TextLayout == ArticleHeaderTextLayout.Center ? "grid--justify-center" : ""; 1844 1845 if (settings.Image != null) 1846 { 1847 if (settings.Image.Path != null) 1848 { 1849 if (settings.ExternalParagraphId == 0) 1850 { 1851 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> 1852 <div class="background-image image-filter image-filter--darken dw-mod"> 1853 <div class="background-image__wrapper image-filter image-filter--darken dw-mod"> 1854 @{ 1855 settings.Image.CssClass += "background-image__cover dw-mod"; 1856 } 1857 @RenderImage(settings.Image) 1858 </div> 1859 </div> 1860 <div class="center-container dw-mod"> 1861 <div class="grid @contentAlignment"> 1862 <div class="grid__col-md-@contentColumns grid__col-xs-12 paragraph-container paragraph-container--height-xl u-no-padding dw-mod"> 1863 @if (!String.IsNullOrEmpty(settings.Heading)) 1864 { 1865 <h1 class="article__header article__header--giant u-padding-top--lg dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> 1866 } 1867 @if (!String.IsNullOrEmpty(settings.Subheading)) 1868 { 1869 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> 1870 } 1871 <div class="u-margin-top"> 1872 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1873 { 1874 <small class="article__post-info u-pull--left dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> 1875 } 1876 @if (settings.RatingOutOf != 0) 1877 { 1878 <div class="u-pull--right"> 1879 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 1880 </div> 1881 } 1882 </div> 1883 @if (!String.IsNullOrEmpty(settings.Link)) 1884 { 1885 <div class="grid__cell"> 1886 @RenderButtonExtended(new ButtonExtended { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 1887 </div> 1888 } 1889 </div> 1890 </div> 1891 </div> 1892 </section> 1893 } 1894 else 1895 { 1896 @RenderArticleBanner(settings); 1897 } 1898 } 1899 } 1900 else 1901 { 1902 @RenderArticleCleanHeader(settings); 1903 } 1904 } 1905 } 1906 1907 @helper RenderArticleBannerHeader(dynamic settings) 1908 { 1909 dynamic[] methodParameters = new dynamic[1]; 1910 methodParameters[0] = settings; 1911 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerHeaderCustom"); 1912 1913 if (customMethod != null) 1914 { 1915 @customMethod.Invoke(this, methodParameters).ToString(); 1916 } 1917 else 1918 { 1919 @RenderArticleBanner(settings); 1920 } 1921 } 1922 1923 1924 @using System.Reflection 1925 @using System.Text.RegularExpressions; 1926 @using Dynamicweb.Frontend 1927 @using Dynamicweb.Content.Items 1928 @using Dynamicweb.Rapido.Blocks.Components 1929 @using Dynamicweb.Rapido.Blocks.Components.Articles 1930 @using Dynamicweb.Rapido.Blocks 1931 1932 @* Component for the articles *@ 1933 1934 @helper RenderArticleBodyRow(ArticleBodyRow settings) 1935 { 1936 dynamic[] methodParameters = new dynamic[1]; 1937 methodParameters[0] = settings; 1938 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBodyRowCustom"); 1939 1940 if (customMethod != null) 1941 { 1942 @customMethod.Invoke(this, methodParameters).ToString(); 1943 } else { 1944 string position = settings.TopLayout == "overlay" ? "article__overlay-offset" : ""; 1945 string contentAlignment = settings.TextLayout == "center" ? "grid--justify-center" : ""; 1946 1947 <div class="grid grid--align-content-start @contentAlignment @position dw-mod"> 1948 @RenderBlockList(settings.SubBlocks) 1949 </div> 1950 } 1951 } 1952 @using System.Reflection 1953 @using Dynamicweb.Rapido.Blocks.Components 1954 @using Dynamicweb.Rapido.Blocks.Components.General 1955 @using Dynamicweb.Rapido.Blocks.Components.Articles 1956 @using Dynamicweb.Rapido.Blocks 1957 1958 @* Component for the articles *@ 1959 1960 @helper RenderArticleImage(ArticleImage settings) 1961 { 1962 dynamic[] methodParameters = new dynamic[1]; 1963 methodParameters[0] = settings; 1964 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleImageCustom"); 1965 1966 if (customMethod != null) 1967 { 1968 @customMethod.Invoke(this, methodParameters).ToString(); 1969 } 1970 else 1971 { 1972 if (settings.Image != null) 1973 { 1974 if (settings.Image.Path != null) 1975 { 1976 <div class="u-margin-bottom--lg"> 1977 @RenderImage(settings.Image) 1978 </div> 1979 } 1980 } 1981 } 1982 } 1983 @using System.Reflection 1984 @using Dynamicweb.Rapido.Blocks.Components 1985 @using Dynamicweb.Rapido.Blocks.Components.Articles 1986 1987 1988 @* Component for the articles *@ 1989 1990 @helper RenderArticleSubHeader(ArticleSubHeader settings) 1991 { 1992 dynamic[] methodParameters = new dynamic[1]; 1993 methodParameters[0] = settings; 1994 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSubHeaderCustom"); 1995 1996 if (customMethod != null) 1997 { 1998 @customMethod.Invoke(this, methodParameters).ToString(); 1999 } else { 2000 if (!String.IsNullOrEmpty(settings.Title)) 2001 { 2002 <h2 class="article__header">@settings.Title</h2> 2003 } 2004 } 2005 } 2006 @using System.Reflection 2007 @using Dynamicweb.Rapido.Blocks.Components 2008 @using Dynamicweb.Rapido.Blocks.Components.Articles 2009 @using Dynamicweb.Rapido.Blocks 2010 2011 2012 @* Component for the articles *@ 2013 2014 @helper RenderArticleText(ArticleText settings) 2015 { 2016 dynamic[] methodParameters = new dynamic[1]; 2017 methodParameters[0] = settings; 2018 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleTextCustom"); 2019 2020 if (customMethod != null) 2021 { 2022 @customMethod.Invoke(this, methodParameters).ToString(); 2023 } else { 2024 if (!String.IsNullOrEmpty(settings.Text)) 2025 { 2026 string greatTextClass = settings.EnableLargeText == true ? "article__paragraph--great-text" : ""; 2027 2028 <div class="article__paragraph @greatTextClass"> 2029 @settings.Text 2030 </div> 2031 } 2032 } 2033 } 2034 @using System.Reflection 2035 @using Dynamicweb.Rapido.Blocks.Components 2036 @using Dynamicweb.Rapido.Blocks.Components.Articles 2037 @using Dynamicweb.Rapido.Blocks 2038 2039 2040 @* Component for the articles - REMEMBER TO MAKE NZ COPY OF THIS AND REFERENCE IT IN DYNAMICLISTPAGE.CSHTML *@ 2041 2042 @helper RenderArticleQuote(ArticleQuote settings) 2043 { 2044 dynamic[] methodParameters = new dynamic[1]; 2045 methodParameters[0] = settings; 2046 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleQuoteCustom"); 2047 2048 if (customMethod != null) 2049 { 2050 @customMethod.Invoke(this, methodParameters).ToString(); 2051 } else { 2052 string text = Regex.Replace(settings.Text, "<.*?>", String.Empty); 2053 2054 <div class="grid u-padding-bottom--lg"> 2055 @if (settings.Image != null) 2056 { 2057 if (settings.Image.Path != null) { 2058 <div class="grid__col-md-3 grid__col-12"> 2059 <div class="grid__cell-img"> 2060 @{ 2061 settings.Image.Title = !String.IsNullOrEmpty(settings.Image.Title) ? settings.Image.Title : settings.Author; 2062 settings.Image.CssClass += " article__image article__image--square"; 2063 settings.Image.ImageDefault.Width = 200; 2064 settings.Image.ImageDefault.Height = 200; 2065 } 2066 @RenderImage(settings.Image) 2067 </div> 2068 </div> 2069 } 2070 } 2071 <div class="grid__col-auto"> 2072 <div class="custombackground"> 2073 @if (!String.IsNullOrEmpty(settings.Text)) 2074 { 2075 <div class="article__quote dw-mod"> 2076 @settings.Text 2077 </div> 2078 } 2079 @if (!String.IsNullOrEmpty(settings.Author)) 2080 { 2081 <div class="article__quote-author dw-mod"> 2082 - @settings.Author 2083 </div> 2084 } 2085 </div> 2086 </div> 2087 </div> 2088 } 2089 } 2090 @using System.Reflection 2091 @using Dynamicweb.Rapido.Blocks.Components 2092 @using Dynamicweb.Rapido.Blocks.Components.Articles 2093 @using Dynamicweb.Rapido.Blocks 2094 2095 @* Component for the articles *@ 2096 2097 @helper RenderArticleInfoTable(ArticleInfoTable settings) 2098 { 2099 dynamic[] methodParameters = new dynamic[1]; 2100 methodParameters[0] = settings; 2101 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleInfoTableCustom"); 2102 2103 if (customMethod != null) 2104 { 2105 @customMethod.Invoke(this, methodParameters).ToString(); 2106 } else { 2107 <h3>@Translate("Facts")</h3> 2108 <table class="table table--clean"> 2109 @foreach (var row in settings.Rows) 2110 { 2111 string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two"; 2112 2113 <tr> 2114 @if (!String.IsNullOrEmpty(row.Icon)) 2115 { 2116 <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td> 2117 } 2118 <td class="u-no-margin-on-p-elements"> 2119 <div class="u-bold">@row.Title</div> 2120 @if (!String.IsNullOrEmpty(row.SubTitle)) 2121 { 2122 if (row.Link == null) 2123 { 2124 <div>@row.SubTitle</div> 2125 } 2126 else 2127 { 2128 <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a> 2129 } 2130 } 2131 </td> 2132 </tr> 2133 } 2134 </table> 2135 } 2136 } 2137 @using System.Reflection 2138 @using Dynamicweb.Rapido.Blocks.Components 2139 @using Dynamicweb.Rapido.Blocks.Components.Articles 2140 @using Dynamicweb.Rapido.Blocks 2141 2142 @* Component for the articles *@ 2143 2144 @helper RenderArticleGalleryModal(ArticleGalleryModal settings) 2145 { 2146 dynamic[] methodParameters = new dynamic[1]; 2147 methodParameters[0] = settings; 2148 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 2149 2150 if (customMethod != null) 2151 { 2152 @customMethod.Invoke(this, methodParameters).ToString(); 2153 } 2154 else 2155 { 2156 <input type="checkbox" id="ParagraphGalleryTrigger" class="modal-trigger" /> 2157 <div class="modal-container"> 2158 <label for="ParagraphGalleryTrigger" id="ParagraphGalleryOverlay" class="modal-overlay"></label> 2159 <div class="modal modal--full" id="ParagraphGallery"> 2160 <div class="modal__body modal__body--full"> 2161 <img src="/Files/Images/placeholder.gif" alt="" id="ParagraphGalleryModalImage" style="margin: 0 auto;" /> 2162 <div class="u-padding u-ta-center" id="ParagraphGalleryModalCaption"></div> 2163 <label class="modal__close-btn dw-mod" for="ParagraphGalleryTrigger"></label> 2164 </div> 2165 </div> 2166 </div> 2167 <script> 2168 function showImageInModal(image) { 2169 let imageNode = document.getElementById('ParagraphGalleryModalImage'); 2170 let captionNode = document.getElementById('ParagraphGalleryModalCaption'); 2171 let trigger = document.getElementById('ParagraphGalleryTrigger'); 2172 imageNode.src = image.src; 2173 if (image.alt != "") { 2174 captionNode.innerText = image.alt; 2175 imageNode.alt = image.alt; 2176 captionNode.style.display = "block"; 2177 } else { 2178 captionNode.style.display = "none"; 2179 } 2180 trigger.checked = true; 2181 } 2182 </script> 2183 } 2184 } 2185 @using System.Reflection 2186 @using Dynamicweb.Rapido.Blocks.Components 2187 @using Dynamicweb.Rapido.Blocks.Components.Articles 2188 @using Dynamicweb.Rapido.Blocks 2189 2190 2191 @* Component for the articles *@ 2192 2193 @helper RenderArticleRelated(ArticleRelated settings) 2194 { 2195 string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : ""; 2196 string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : ""; 2197 2198 <section class="multiple-paragraphs-container related-articles-container paragraph-container--full-width"> 2199 <div class="center-container dw-mod"> 2200 <div class="grid u-padding u-margin-bottom--lg"> 2201 <div class="grid__col-md-12 grid__col-xs-12 u-margin-bottom--lg"> 2202 <h2 class="article__header related-header u-no-margin u-margin-top dw-mod">@Translate("Andre relevante nyheder")</h2> 2203 </div> 2204 </div> 2205 2206 <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> 2207 2208 <script id="RelatedSimpleTemplate" type="text/x-template"> 2209 {{#.}} 2210 <div class="grid u-padding-bottom--lg"> 2211 {{#Cases}} 2212 <div class="grid__col-md-3 grid__col-12 image-hover--zoom dw-mod"> 2213 <a href="{{link}}" class="u-full-height related-articles-container"> 2214 {{#if image}} 2215 <div class="u-color-light--bg u-no-padding dw-mod"> 2216 <div class="flex-img image-hover__wrapper"> 2217 <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}}" /> 2218 </div> 2219 </div> 2220 {{/if}} 2221 2222 <div class="card related-articles-container article-content-container dw-mod"> 2223 <p class="article__post-info dw-mod">{{date}}</p> 2224 <h3 class="article-list__item-header u-color-dark dw-mod">{{title}}</h3> 2225 @*<p class="article__short-summary dw-mod">{{summary}}</p>*@ 2226 </div> 2227 </a> 2228 </div> 2229 {{/Cases}} 2230 </div> 2231 {{/.}} 2232 </script> 2233 </div> 2234 </section> 2235 } 2236 @using System.Reflection 2237 @using Dynamicweb.Rapido.Blocks.Components 2238 @using Dynamicweb.Rapido.Blocks.Components.Articles 2239 @using Dynamicweb.Rapido.Blocks 2240 2241 2242 @* Component for the articles *@ 2243 2244 @helper RenderArticleMenu(ArticleMenu settings) 2245 { 2246 dynamic[] methodParameters = new dynamic[1]; 2247 methodParameters[0] = settings; 2248 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleMenuCustom"); 2249 2250 if (customMethod != null) 2251 { 2252 @customMethod.Invoke(this, methodParameters).ToString(); 2253 } else { 2254 if (!String.IsNullOrEmpty(settings.Title)) { 2255 <div class="u-margin u-border-bottom"> 2256 <h3 class="u-no-margin">@settings.Title</h3> 2257 </div> 2258 } 2259 2260 <ul class="menu-left u-margin-bottom dw-mod"> 2261 @foreach (var item in settings.Items) 2262 { 2263 @RenderArticleMenuItem(item) 2264 } 2265 </ul> 2266 } 2267 } 2268 2269 @helper RenderArticleMenuItem(ArticleMenuItem settings) 2270 { 2271 dynamic[] methodParameters = new dynamic[1]; 2272 methodParameters[0] = settings; 2273 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleMenuItemCustom"); 2274 2275 if (customMethod != null) 2276 { 2277 @customMethod.Invoke(this, methodParameters).ToString(); 2278 } else { 2279 string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#"; 2280 2281 if (!String.IsNullOrEmpty(settings.Title)) { 2282 <li class="menu-left__item dw-mod"> 2283 <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a> 2284 </li> 2285 } 2286 } 2287 } 2288 @using System.Reflection 2289 @using Dynamicweb.Rapido.Blocks.Components 2290 @using Dynamicweb.Rapido.Blocks.Components.Articles 2291 @using Dynamicweb.Rapido.Blocks 2292 2293 @* Component for the articles *@ 2294 2295 @helper RenderArticleList(ArticleList settings) 2296 { 2297 dynamic[] methodParameters = new dynamic[1]; 2298 methodParameters[0] = settings; 2299 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListCustom"); 2300 2301 if (customMethod != null) 2302 { 2303 @customMethod.Invoke(this, methodParameters).ToString(); 2304 } else { 2305 if (Pageview != null) 2306 { 2307 bool isParagraph = Pageview.CurrentParagraph != null ? true : false; 2308 string[] sortArticlesListBy = new string[2]; 2309 2310 if (isParagraph) { 2311 sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2312 } 2313 else { 2314 sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2315 } 2316 2317 string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString(); 2318 2319 @RenderItemList(new 2320 { 2321 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle", 2322 ListSourceType = settings.SourceType, 2323 ListSourcePage = sourcePage, 2324 ItemFieldsList = "*", 2325 Filter = settings.Filter, 2326 ListOrderBy = sortArticlesListBy[0], 2327 ListOrderByDirection = sortArticlesListBy[1], 2328 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date", 2329 ListSecondOrderByDirection = "ASC", 2330 IncludeAllChildItems = true, 2331 ListTemplate = settings.Template, 2332 ListPageSize = settings.PageSize.ToString() 2333 }); 2334 } 2335 } 2336 } 2337 @using System.Reflection 2338 @using Dynamicweb.Rapido.Blocks.Components.Articles 2339 2340 2341 @* Component for the articles *@ 2342 2343 @helper RenderArticleSummary(ArticleSummary settings) 2344 { 2345 dynamic[] methodParameters = new dynamic[1]; 2346 methodParameters[0] = settings; 2347 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSummaryCustom"); 2348 2349 if (customMethod != null) 2350 { 2351 @customMethod.Invoke(this, methodParameters).ToString(); 2352 } else { 2353 if (!String.IsNullOrEmpty(settings.Text)) 2354 { 2355 <div class="article__summary dw-mod">@settings.Text</div> 2356 } 2357 } 2358 } 2359 @using System.Reflection 2360 @using Dynamicweb.Rapido.Blocks.Components 2361 @using Dynamicweb.Rapido.Blocks.Components.Articles 2362 @using Dynamicweb.Rapido.Blocks 2363 2364 @* Component for the articles *@ 2365 2366 @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings) 2367 { 2368 dynamic[] methodParameters = new dynamic[1]; 2369 methodParameters[0] = settings; 2370 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListCategoryFilterCustom"); 2371 2372 if (customMethod != null) 2373 { 2374 @customMethod.Invoke(this, methodParameters).ToString(); 2375 } else { 2376 string pageId = Pageview.ID.ToString(); 2377 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All"); 2378 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2379 2380 foreach (var option in settings.Categories) 2381 { 2382 selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter; 2383 } 2384 2385 if (selectedFilter == pageId) 2386 { 2387 selectedFilter = Translate("All"); 2388 } 2389 2390 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2391 { 2392 <div class="u-pull--right u-margin-left"> 2393 <div class="collection u-no-margin"> 2394 <h5>@Translate("Category")</h5> 2395 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2396 <div class="dropdown u-w180px dw-mod"> 2397 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 2398 <div class="dropdown__content dw-mod"> 2399 @foreach (var option in settings.Categories) 2400 { 2401 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 2402 } 2403 </div> 2404 <label class="dropdown-trigger-off" for="CategorySelector"></label> 2405 </div> 2406 </div> 2407 </div> 2408 } 2409 else 2410 { 2411 <div class="u-full-width u-margin-bottom"> 2412 <h5 class="u-no-margin">@Translate("Category")</h5> 2413 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2414 <div class="dropdown u-full-width dw-mod"> 2415 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 2416 <div class="dropdown__content dw-mod"> 2417 @foreach (var option in settings.Categories) 2418 { 2419 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 2420 } 2421 </div> 2422 <label class="dropdown-trigger-off" for="CategorySelector"></label> 2423 </div> 2424 </div> 2425 } 2426 } 2427 } 2428 @using System.Reflection 2429 @using System.Web.Mvc 2430 @using Dynamicweb.Environment 2431 @using Dynamicweb.Rapido.Blocks.Components 2432 @using Dynamicweb.Rapido.Blocks.Components.Articles 2433 @using Dynamicweb.Rapido.Blocks 2434 2435 @* Component for the articles *@ 2436 2437 @helper RenderArticleListFilter(ArticleListFilter settings) 2438 { 2439 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All"); 2440 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2441 2442 if (settings.Options != null) 2443 { 2444 foreach (var option in settings.Options) 2445 { 2446 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter; 2447 } 2448 2449 @*DESKTOP*@ 2450 2451 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2452 { 2453 <div class="grid"> 2454 <div class="grid__col-12 paragraph-container customlist"> 2455 2456 <section class="grid__col-12" id="custom-facets-overall-container"> 2457 2458 <input type="checkbox" id="CheckFacetGroups" class="js-remember-state u-hidden" data-expand="CheckFacetGroups" /> 2459 <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"> 2460 <div class="grid__col-12"> 2461 2462 <input type="checkbox" id="OptionsGroup_{{name}}" class="expand-trigger js-remember-state mobile-facet-input" {{defaultState}} /> 2463 2464 <div class="grid__col-12 expand-container facets-container__box custom-expand-container dw-mod js-filter"> 2465 <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> 2466 <div class="expand-container__content custom-expand-content-container dw-mod"> 2467 <div class="facets-container__list dw-mod"> 2468 <div class="grid__col-12 grid--direction-row u-no-padding grid--wrap"> 2469 @foreach (var option in settings.Options) 2470 { 2471 2472 var currentUrl = HttpContext.Current.Request.QueryString.ToString(); 2473 2474 <div class="grid__col-lg-3 grid__col-sm-3 grid__col-xs-12 u-no-padding-y"> 2475 @if (currentUrl.Contains(settings.SystemName + "=" + option.Value)) 2476 { 2477 <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)"> 2478 2479 } 2480 2481 else 2482 { 2483 <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)"> 2484 2485 } 2486 <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> 2487 </div> 2488 2489 } 2490 </div> 2491 </div> 2492 </div> 2493 </div> 2494 </div> 2495 </div> 2496 <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> 2497 <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> 2498 </section> 2499 </div> 2500 </div> 2501 2502 } 2503 2504 @*MOBILE*@ 2505 2506 else 2507 { 2508 <div class="grid"> 2509 <div class="grid__col-12 customlist u-no-padding"> 2510 2511 <section class="grid__col-12 u-no-padding" id="custom-facets-overall-container"> 2512 2513 @* REMEMBER TO MATCH HTML ATTRIBUTES DATA-EXPAND AND DATA-TRIGGER WITH THE GIVEN BUTTON (IN THIS SCENARIO CHECKFILTERS BUTTON FROM ARTICLECOMPONENTS.CSHTML) *@ 2514 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" /> 2515 <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"> 2516 <div class="grid__col-12"> 2517 2518 <input type="checkbox" id="OptionsGroup_{{name}}" class="expand-trigger js-remember-state mobile-facet-input" /> 2519 2520 <div class="grid__col-12 expand-container facets-container__box custom-expand-container dw-mod js-filter"> 2521 <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> 2522 <div class="expand-container__content custom-expand-content-container dw-mod"> 2523 <div class="facets-container__list dw-mod"> 2524 <div class="grid__col-12 grid--direction-row u-no-padding grid--wrap"> 2525 @foreach (var option in settings.Options) 2526 { 2527 2528 var currentUrl = HttpContext.Current.Request.QueryString.ToString(); 2529 2530 <div class="grid__col-lg-3 grid__col-sm-4 grid__col-xs-12 u-no-padding-y"> 2531 @if (currentUrl.Contains(settings.SystemName + "=" + option.Value)) 2532 { 2533 <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)"> 2534 2535 } 2536 2537 else 2538 { 2539 <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)"> 2540 2541 } 2542 <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> 2543 </div> 2544 2545 } 2546 </div> 2547 </div> 2548 </div> 2549 </div> 2550 </div> 2551 </div> 2552 2553 </section> 2554 </div> 2555 </div> 2556 2557 } 2558 } 2559 } 2560 @using System.Reflection 2561 @using Dynamicweb.Rapido.Blocks.Components 2562 @using Dynamicweb.Rapido.Blocks.Components.Articles 2563 @using Dynamicweb.Rapido.Blocks 2564 2565 @* Component for the articles *@ 2566 2567 @helper RenderArticleListSearch(ArticleListSearch settings) 2568 { 2569 dynamic[] methodParameters = new dynamic[1]; 2570 methodParameters[0] = settings; 2571 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListSearchCustom"); 2572 2573 if (customMethod != null) 2574 { 2575 @customMethod.Invoke(this, methodParameters).ToString(); 2576 } else { 2577 string searchString = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("Title")) ? HttpContext.Current.Request.QueryString.Get("Title").Trim('*') : ""; 2578 string className = "u-w340px u-pull--right u-margin-left"; 2579 2580 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 2581 { 2582 className = "u-full-width"; 2583 } 2584 2585 <div class="typeahead u-color-inherit u-margin-bottom dw-mod @className"> 2586 <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 + '*')"> 2587 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button> 2588 </div> 2589 } 2590 } 2591 @using System.Reflection 2592 @using Dynamicweb.Rapido.Blocks.Components 2593 @using Dynamicweb.Rapido.Blocks.Components.Articles 2594 @using Dynamicweb.Rapido.Blocks 2595 2596 @* Component for the articles *@ 2597 2598 @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings) 2599 { 2600 dynamic[] methodParameters = new dynamic[1]; 2601 methodParameters[0] = settings; 2602 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListNoResultsInfoCustom"); 2603 2604 if (customMethod != null) 2605 { 2606 @customMethod.Invoke(this, methodParameters).ToString(); 2607 } else { 2608 <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div> 2609 } 2610 } 2611 2612 @using System.Reflection 2613 @using Dynamicweb.Rapido.Blocks.Components 2614 @using Dynamicweb.Rapido.Blocks.Components.General 2615 @using Dynamicweb.Rapido.Blocks.Components.Articles 2616 @using Dynamicweb.Rapido.Blocks 2617 @using System.Text.RegularExpressions 2618 @using S_DW_HD2412.CustomCode 2619 2620 @* Component for the articles *@ 2621 2622 @helper RenderArticleListItem(ArticleListItemExtended settings) 2623 { 2624 switch (settings.Type) { 2625 case ArticleListItemType.Card: 2626 @RenderArticleListItemCard(settings); 2627 break; 2628 case ArticleListItemType.List: 2629 @RenderArticleListItemList(settings); 2630 break; 2631 case ArticleListItemType.Simple: 2632 @RenderArticleListItemSimple(settings); 2633 break; 2634 default: 2635 @RenderArticleListItemCard(settings); 2636 break; 2637 } 2638 } 2639 2640 @helper RenderArticleListItemExtended(ArticleListItemExtended settings) 2641 { 2642 switch (settings.Type) { 2643 case ArticleListItemType.Card: 2644 @RenderArticleListItemCard(settings); 2645 break; 2646 case ArticleListItemType.List: 2647 @RenderArticleListItemList(settings); 2648 break; 2649 case ArticleListItemType.Simple: 2650 @RenderArticleListItemSimple(settings); 2651 break; 2652 default: 2653 @RenderArticleListItemCard(settings); 2654 break; 2655 } 2656 } 2657 2658 @helper RenderArticleListItemCard(ArticleListItemExtended settings) { 2659 <a href="@settings.Link" class="u-full-height u-color-light--bg"> 2660 <div class="u-color-light--bg u-no-padding dw-mod"> 2661 @if (settings.Logo != null) 2662 { 2663 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;" : ""; 2664 settings.Logo.ImageDefault.Crop = 5; 2665 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 2666 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 2667 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 2668 @if (settings.Stickers != null) 2669 { 2670 if (settings.Stickers.Position != StickersListPosition.Custom) 2671 { 2672 @RenderStickersCollection(settings.Stickers); 2673 } 2674 } 2675 @RenderImage(settings.Logo) 2676 </div> 2677 } 2678 else if (settings.Image != null) 2679 { 2680 <div class="flex-img image-hover__wrapper u-position-relative dw-mod"> 2681 @if (settings.Stickers != null) 2682 { 2683 if (settings.Stickers.Position != StickersListPosition.Custom) 2684 { 2685 @RenderStickersCollection(settings.Stickers); 2686 } 2687 } 2688 @RenderImage(settings.Image) 2689 </div> 2690 } 2691 </div> 2692 2693 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 2694 { 2695 2696 <div class="paragraph-card u-color-light--bg dw-mod"> 2697 2698 2699 @if (settings.Stickers != null) 2700 { 2701 if (settings.Stickers.Position == StickersListPosition.Custom) 2702 { 2703 @RenderStickersCollection(settings.Stickers) 2704 ; 2705 } 2706 } 2707 @if (!String.IsNullOrEmpty(settings.Title)) 2708 { 2709 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 2710 } 2711 @if (!String.IsNullOrEmpty(settings.Date)) 2712 { 2713 <div class="article__post-info dw-mod">@DateTime.Parse(settings.Date).ToString("dd-MM-yyyy")</div> 2714 } 2715 @if (!String.IsNullOrEmpty(settings.SubTitle)) 2716 { 2717 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 2718 } 2719 @if (!String.IsNullOrEmpty(settings.Summary)) 2720 { 2721 <p class="article__short-summary dw-mod">@settings.Summary</p> 2722 } 2723 <a href="@settings.Link" class="search-result__name search"> 2724 @Translate("Read more") 2725 </a> 2726 </div> 2727 } 2728 </a> 2729 } 2730 2731 @helper RenderArticleListItemList(ArticleListItemExtended settings) { 2732 <a href="@settings.Link"> 2733 <div class="grid u-color-light--bg u-no-padding dw-mod"> 2734 <div class="grid__col-md-3"> 2735 <div class="u-color-light--bg u-no-padding dw-mod"> 2736 @if (settings.Logo != null) 2737 { 2738 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;" : ""; 2739 settings.Logo.ImageDefault.Crop = 5; 2740 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 2741 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 2742 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 2743 @if (settings.Stickers != null) 2744 { 2745 if (settings.Stickers.Position != StickersListPosition.Custom) 2746 { 2747 @RenderStickersCollection(settings.Stickers); 2748 } 2749 } 2750 @RenderImage(settings.Logo) 2751 </div> 2752 } else if (settings.Image != null) 2753 { 2754 <div class="flex-img image-hover__wrapper dw-mod"> 2755 @if (settings.Stickers != null) 2756 { 2757 if (settings.Stickers.Position != StickersListPosition.Custom) 2758 { 2759 @RenderStickersCollection(settings.Stickers); 2760 } 2761 } 2762 @RenderImage(settings.Image) 2763 </div> 2764 } 2765 </div> 2766 </div> 2767 2768 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 2769 { 2770 <div class="grid__col-md-9"> 2771 @if (!String.IsNullOrEmpty(settings.Title)) 2772 { 2773 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 2774 } 2775 @if (settings.Stickers != null) 2776 { 2777 if (settings.Stickers.Position == StickersListPosition.Custom) 2778 { 2779 @RenderStickersCollection(settings.Stickers); 2780 } 2781 } 2782 @if (!String.IsNullOrEmpty(settings.SubTitle)) 2783 { 2784 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 2785 } 2786 @if (!String.IsNullOrEmpty(settings.Summary)) 2787 { 2788 <p class="article__short-summary dw-mod">@settings.Summary</p> 2789 } 2790 </div> 2791 } 2792 </div> 2793 </a> 2794 } 2795 2796 @helper RenderArticleListItemSimple(ArticleListItemExtended settings) { 2797 <a href="@settings.Link" class="u-color-inherit"> 2798 <div class="grid u-color-light--bg u-no-padding dw-mod"> 2799 <div class="grid__col-md-12"> 2800 @if (!String.IsNullOrEmpty(settings.Title)) 2801 { 2802 <section class="grid__col-12 grid--justify-center"> 2803 @*<h2 class="search-headline-the-one"> 2804 @settings.Title 2805 </h2>*@ 2806 </section> 2807 2808 } 2809 @if (!String.IsNullOrEmpty(settings.SubTitle)) 2810 { 2811 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 2812 } 2813 </div> 2814 </div> 2815 </a> 2816 } 2817 @using System.Reflection 2818 @using Dynamicweb.Rapido.Blocks.Components.Articles 2819 2820 2821 @* Component for the articles *@ 2822 2823 @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings) 2824 { 2825 dynamic[] methodParameters = new dynamic[1]; 2826 methodParameters[0] = settings; 2827 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleAuthorAndDateCustom"); 2828 2829 if (customMethod != null) 2830 { 2831 @customMethod.Invoke(this, methodParameters).ToString(); 2832 } else { 2833 <small class="article__subscription"> 2834 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 2835 { 2836 <text>@Translate("Written")</text> 2837 } 2838 @if (!string.IsNullOrWhiteSpace(settings.Author)) 2839 { 2840 <text>@Translate("by") @settings.Author</text> 2841 } 2842 @if (!string.IsNullOrWhiteSpace(settings.Date)) 2843 { 2844 <text>@Translate("on") @settings.Date</text> 2845 } 2846 </small> 2847 } 2848 } 2849 @using System.Reflection 2850 @using Dynamicweb.Rapido.Blocks.Components.Articles 2851 2852 2853 @* Component for the articles *@ 2854 2855 @helper RenderArticleLink(ArticleLink settings) 2856 { 2857 dynamic[] methodParameters = new dynamic[1]; 2858 methodParameters[0] = settings; 2859 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleLinkCustom"); 2860 2861 if (customMethod != null) 2862 { 2863 @customMethod.Invoke(this, methodParameters).ToString(); 2864 } else { 2865 if (!String.IsNullOrEmpty(settings.Title)) 2866 { 2867 <div class="grid__cell"> 2868 @RenderButton(settings) 2869 </div> 2870 } 2871 } 2872 } 2873 @using System.Reflection 2874 @using Dynamicweb.Rapido.Blocks 2875 @using Dynamicweb.Rapido.Blocks.Components.Articles 2876 @using Dynamicweb.Rapido.Blocks.Components.General 2877 2878 2879 @* Component for the articles *@ 2880 2881 @helper RenderArticleCarousel(ArticleCarousel settings) 2882 { 2883 dynamic[] methodParameters = new dynamic[1]; 2884 methodParameters[0] = settings; 2885 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 2886 2887 if (customMethod != null) 2888 { 2889 @customMethod.Invoke(this, methodParameters).ToString(); 2890 } else { 2891 <div class="grid"> 2892 <div class="grid__col-12"> 2893 <div class="carousel" id="carousel_@settings.Id"> 2894 <div class="carousel__container js-carousel-slides dw-mod"> 2895 @RenderBlockList(settings.SubBlocks) 2896 </div> 2897 </div> 2898 </div> 2899 </div> 2900 2901 <script> 2902 document.addEventListener("DOMContentLoaded", function () { 2903 new CarouselModule("#carousel_@settings.Id", { 2904 slideTime: 0, 2905 dots: true 2906 }); 2907 }); 2908 </script> 2909 } 2910 } 2911 2912 @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings) 2913 { 2914 dynamic[] methodParameters = new dynamic[1]; 2915 methodParameters[0] = settings; 2916 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 2917 2918 if (customMethod != null) 2919 { 2920 @customMethod.Invoke(this, methodParameters).ToString(); 2921 } 2922 else 2923 { 2924 string imageEngine = "/Admin/Public/GetImage.ashx?"; 2925 2926 string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image; 2927 if (settings.ImageSettings != null) 2928 { 2929 defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : ""; 2930 defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : ""; 2931 defaultImage += "Crop=" + settings.ImageSettings.Crop + "&"; 2932 defaultImage += "Compression=" + settings.ImageSettings.Compression + "&"; 2933 defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&"; 2934 defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&"; 2935 } 2936 defaultImage += "&Image=" + settings.Image; 2937 2938 <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')"> 2939 <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title"> 2940 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2> 2941 <div class="article-list__item-info"> 2942 @if (settings.Stickers != null) 2943 { 2944 settings.Stickers.Position = StickersListPosition.Custom; 2945 @RenderStickersCollection(settings.Stickers); 2946 } 2947 2948 <small class="u-margin-top--lg u-color-light"> 2949 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 2950 { 2951 <text>@Translate("Written")</text> 2952 } 2953 @if (!string.IsNullOrWhiteSpace(settings.Author)) 2954 { 2955 <text>@Translate("by") @settings.Author</text> 2956 } 2957 @if (!string.IsNullOrWhiteSpace(settings.Date)) 2958 { 2959 <text>@Translate("on") @settings.Date</text> 2960 } 2961 </small> 2962 </div> 2963 2964 <h3 class="article__short-summary u-color-light">@settings.Summary</h3> 2965 </a> 2966 @if (settings.UseFilters == true) 2967 { 2968 <div class="background-image image-filter image-filter--darken dw-mod"></div> 2969 } 2970 </div> 2971 } 2972 } 2973 @using System.Text.RegularExpressions 2974 @using Dynamicweb.Rapido.Blocks.Components 2975 @using Dynamicweb.Rapido.Blocks.Components.General 2976 @using Dynamicweb.Rapido.Blocks.Components.Articles 2977 @using Dynamicweb.Rapido.Blocks 2978 2979 @* Component for the articles *@ 2980 2981 @helper RenderArticleVideo(ArticleVideo settings) 2982 { 2983 dynamic[] methodParameters = new dynamic[1]; 2984 methodParameters[0] = settings; 2985 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleTextCustom"); 2986 2987 if (customMethod != null) 2988 { 2989 @customMethod.Invoke(this, methodParameters).ToString(); 2990 } else { 2991 if (settings.Url != null) 2992 { 2993 //getting video ID from youtube URL 2994 string videoCode = settings.Url; 2995 Regex regex = new Regex(@".be\/(.[^?]*)"); 2996 Match match = regex.Match(videoCode); 2997 string videoId = ""; 2998 if (match.Success) 2999 { 3000 videoId = match.Groups[1].Value; 3001 } 3002 else 3003 { 3004 regex = new Regex(@"v=([^&]+)"); 3005 match = regex.Match(videoCode); 3006 if (match.Success) 3007 { 3008 videoId = match.Groups[1].Value; 3009 } 3010 } 3011 3012 int autoPlay = settings.AutoPlay == "true" ? 1 : 0; 3013 3014 <div class="video-wrapper"> 3015 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div> 3016 </div> 3017 } 3018 } 3019 } 3020 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3021 @using System.Reflection 3022 @using Dynamicweb.Rapido.Blocks.Components 3023 @using Dynamicweb.Rapido.Blocks.Components.General 3024 @using Dynamicweb.Rapido.Blocks.Components.Articles 3025 @using Dynamicweb.Rapido.Blocks 3026 @using S_DW_HD2412.CustomCode 3027 3028 3029 3030 @helper RenderSocialShare() 3031 { 3032 string siteURL = Pageview.SearchFriendlyUrl.ToString(); 3033 3034 <section class="socialshare grid__col-md-12 grid__col--bleed grid-custom-layout grid--justify-center u-padding--lg dw-mod"> 3035 <div class="socialheader grid__col-md-12 u-no-padding u-border-bottom"> 3036 <h3>@Translate("ShareThis")</h3> 3037 </div> 3038 <div class="sociallinks grid__col-md-12 u-no-padding"> 3039 <div class="social-container"> 3040 <div class="links"> 3041 <div class="icon-nz-nz-facebook links-share" data-sharer="facebook" data-url="@siteURL"></div> 3042 <div class="linkedin icon-nz-nz-linkedin links-share" data-sharer="linkedin" data-url="@siteURL"></div> 3043 <div data-icon-nz="nz-link" class="js-geturl icon-nz-nz-link links-share" aria-label="Copy link"> 3044 <div class="links-input js-show-hide"> 3045 <input class="js-urlCopied"> 3046 </div> 3047 </div> 3048 </div> 3049 </div> 3050 </div> 3051 </section> 3052 } 3053 3054 3055 @* Simple helpers *@ 3056 3057 @*Requires the Gallery ItemType that comes with Rapido*@ 3058 @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) 3059 { 3060 string placeHolderImage = "/Files/Images/placeholder.gif"; 3061 3062 <main class="wrapper grid grid--direction-row"> 3063 <section class="gallery grid__col-lg-9 grid__col-sm-12"> 3064 <div class="swiper-container gallery-top"> 3065 <div class="swiper-wrapper"> 3066 @if (gallery != null && gallery.Count > 0) 3067 { 3068 int count = 1; 3069 3070 foreach (var item in gallery) 3071 { 3072 if (item.GetFile("ImagePath") != null) 3073 { 3074 string focalPointParameters = item.GetFile("ImagePath") != null ? "&" + item.GetFile("ImagePath").GetFocalPointParameters() : ""; 3075 3076 string image = item.GetFile("ImagePath").PathUrlEncoded + focalPointParameters; 3077 int imagesCount = gallery.Count; 3078 string text = item.GetString("Text"); 3079 3080 <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"> 3081 <div class="swiper-text">@text</div> 3082 </div> 3083 3084 count++; 3085 } 3086 } 3087 } 3088 </div> 3089 <div class="swiper-button-next swiper-button-white"></div> 3090 <div class="swiper-button-prev swiper-button-white"></div> 3091 </div> 3092 </section> 3093 @if (gallery != null && gallery.Count > 0) 3094 { 3095 <section class="thumbs grid__col-lg-3 grid__col-sm-12"> 3096 <div class="swiper-container gallery-thumbs"> 3097 <div class="swiper-wrapper"> 3098 @{ 3099 int count = 1; 3100 } 3101 3102 @foreach (var item in gallery) 3103 { 3104 if (item.GetFile("ImagePath") != null) 3105 { 3106 string focalPointParameters = item.GetFile("ImagePath") != null ? "&" + item.GetFile("ImagePath").GetFocalPointParameters() : ""; 3107 3108 string image = item.GetFile("ImagePath").PathUrlEncoded + focalPointParameters; 3109 int imagesCount = gallery.Count; 3110 string text = item.GetString("Text"); 3111 3112 <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" /> 3113 3114 count++; 3115 } 3116 } 3117 </div> 3118 </div> 3119 </section> 3120 } 3121 </main> 3122 3123 } 3124 3125 @helper RenderArticleItemGalleryModal() 3126 { 3127 <!-- Trigger for the gallery modal --> 3128 <input type="checkbox" id="GalleryModalTrigger" class="modal-trigger" /> 3129 3130 <!-- Gallery modal --> 3131 <div class="modal-container"> 3132 <label for="GalleryModalTrigger" id="GalleryModalOverlay" class="modal-overlay"></label> 3133 <div class="modal modal--full" id="GalleryModal"> 3134 <div class="modal__body modal__body--full"> 3135 <div class="gallery-slider"> 3136 <div class="gallery-slider__image"> 3137 <img src="#" alt="" class="modal--full__img" id="FullImage" /> 3138 </div> 3139 <div class="gallery-slider__image-counter" id="FullImage_counter"></div> 3140 <label class="gallery-slider__close-btn" for="GalleryModalTrigger"></label> 3141 <button class="gallery-slider__previous-btn" id="FullImage_prev" onclick="Gallery.prevImage('FullImage')"></button> 3142 <button class="gallery-slider__next-btn" id="FullImage_next" onclick="Gallery.nextImage('FullImage')"></button> 3143 </div> 3144 </div> 3145 </div> 3146 </div> 3147 } 3148 3149 3150 @helper RenderMobileFilters(List<Block> settings) 3151 { 3152 if (settings.Count > 0) 3153 { 3154 <div class="grid__col-12"> 3155 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" /> 3156 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters"> 3157 @RenderBlockList(settings) 3158 </div> 3159 @*<label for="CheckFilters" class="btn btn--primary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label> 3160 <label for="CheckFilters" class="btn btn--primary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label>*@ 3161 </div> 3162 } 3163 } 3164 3165 3166 @if (File.Exists(HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/Components/Custom/Custom__Components.cshtml"))) 3167 { 3168 <text>@using Dynamicweb.Rapido.Blocks.Components.General 3169 </text> 3170 } 3171 3172 @* Include the Blocks for the page *@ 3173 @if (File.Exists(HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/ItemPublisher/List/Blocks/Custom__Blocks.cshtml"))) 3174 { 3175 <text>@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3176 @using Dynamicweb.Core 3177 @using System 3178 @using System.Web 3179 @using System.Collections.Generic 3180 @using Dynamicweb.Rapido.Blocks 3181 3182 @{ 3183 3184 }</text> 3185 } 3186 3187 3188 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 3189 @RenderBlockList(articlePage.BlocksRoot.BlocksList) 3190 3191 3192 @helper RenderPopularList() { 3193 List<Block> subBlocks = this.articlePage.GetBlockListById("ArticleList").OrderBy(item => item.SortId).ToList(); 3194 string title = Pageview.Item["PopularArticlesHeader"] != null ? Pageview.Item["PopularArticlesHeader"].ToString() : null; 3195 title = title == null && Pageview.Item["Title"] != null ? Pageview.Item["Title"].ToString() : title; 3196 3197 <div class="card-header u-color-light--bg dw-mod"> 3198 <h3>@title</h3> 3199 </div> 3200 3201 <div class="card u-color-light--bg article-simple-list dw-mod"> 3202 @RenderBlockList(subBlocks) 3203 </div> 3204 } 3205