News

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