Iphone alt
John Doe

John Doe

2 June 2022 in Trends

6 min reading time

Newspage 2

Dit is een subheader

Dit is een header

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras quis felis eu mi egestas vestibulum. Praesent eu eros a eros aliquam euismod a a velit. Vivamus vestibulum et libero in imperdiet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean consectetur, mi quis finibus tincidunt, ante ligula lobortis turpis, ut vestibulum tellus est nec lorem. Ut quis lorem quam. 

Dit is een Subheader

Dit is een header

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris id tempor dui. Duis mollis leo felis, sit amet mollis quam tristique sed. Quisque consequat libero vel turpis tempor tristique. Praesent aliquam turpis orci, vel elementum turpis consequat quis. Integer egestas, ligula et eleifend vehicula, sem orci imperdiet turpis, in ullamcorper metus nisl eget lorem. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Mauris non posuere purus. 

John Doe

About the author

John Doe

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis volutpat, diam a lobortis aliquam, mi enim varius lectus, eu gravida risus urna feugiat mauris. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Curabitur nulla purus, pulvinar ac quam vel, ornare sagittis massa. Nam lacus leo, ultricies sed odio auctor, vehicula feugiat tellus. Aliquam erat volutpat. Mauris quis lectus nec elit rhoncus venenatis eu at justo. Mauris luctus pharetra magna in viverra. Sed feugiat odio tortor, id laoreet dolor commodo eget. Nam a porttitor ligula. Integer nec libero semper, ornare libero sit amet, ullamcorper quam. Morbi vel blandit nisl, sagittis feugiat elit. Maecenas luctus sollicitudin nisl, eget congue odio mollis non. Morbi lobortis

Tags

  • Trends Voorjaar

Related items

Error compiling template "Designs/TheGift_generated/ItemPublisher/List/NewsListGridWithoutFilter.cshtml"
Line 147: The type or namespace name 'Match' could not be found (are you missing a using directive or an assembly reference?)
Line 147: The name 'Regex' does not exist in the current context
Line 153: 'Extensions.GetPageService(IServiceLocator)' is obsolete: 'Use Dynamicweb.Content.Services.Pages instead.'
Line 184: 'Services' is obsolete: 'Use Dynamicweb.Content.Services instead.'
Line 184: 'Services.Items' is obsolete: 'Use Dynamicweb.Content.Services.Items instead.'
Line 333: 'Services' is obsolete: 'Use Dynamicweb.Content.Services instead.'
Line 333: 'Services.Items' is obsolete: 'Use Dynamicweb.Content.Services.Items instead.'

1 //------------------------------------------------------------------------------ 2 // <auto-generated> 3 // This code was generated by a tool. 4 // Runtime Version:4.0.30319.42000 5 // 6 // Changes to this file may cause incorrect behavior and will be lost if 7 // the code is regenerated. 8 // </auto-generated> 9 //------------------------------------------------------------------------------ 10 11 namespace CompiledRazorTemplates.Dynamic { 12 using System; 13 using System.Collections.Generic; 14 using System.Linq; 15 16 #line 2 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 17 using Dynamicweb; 18 19 #line default 20 #line hidden 21 22 #line 3 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 23 using Dynamicweb.Content; 24 25 #line default 26 #line hidden 27 28 #line 4 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 29 using Dynamicweb.Rendering; 30 31 #line default 32 #line hidden 33 34 #line 5 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 35 using Dynamicweb.Frontend; 36 37 #line default 38 #line hidden 39 40 #line 6 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 41 using Dynamicweb.Content.Items; 42 43 #line default 44 #line hidden 45 46 #line 7 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 47 using Dynamicweb.Content.Items.Rendering; 48 49 #line default 50 #line hidden 51 52 #line 8 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 53 using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 54 55 #line default 56 #line hidden 57 58 #line 9 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 59 using Bluedesk.DynamicWeb.ItemTypes.Extensions; 60 61 #line default 62 #line hidden 63 64 65 public class RazorEngine_576311f0472a49be857aa03add006ff4 : Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> { 66 67 #line hidden 68 69 #line 208 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 70 71 int getFirstpage(int currentPage, int totalPages, double pagesToShow) 72 { 73 int firstPage = 0; 74 if(pagesToShow >= totalPages) { 75 firstPage = 1; 76 } else { 77 firstPage = currentPage - Convert.ToInt32(Math.Floor(pagesToShow / 2)); 78 firstPage = firstPage < 1 ? 1 : firstPage; 79 } 80 return firstPage; 81 } 82 83 int getLastpage(int currentPage, int totalPages, double pagesToShow, int firstPage) 84 { 85 int lastPage = 0; 86 lastPage = firstPage + Convert.ToInt32(pagesToShow); 87 if (lastPage > totalPages) { 88 lastPage = totalPages; 89 } 90 return lastPage; 91 } 92 93 string Truncate(string value, int maxChars) 94 { 95 return value.Length <= maxChars ? value : value.Substring(0, maxChars) + "..."; 96 } 97 98 #line default 99 #line hidden 100 101 102 public RazorEngine_576311f0472a49be857aa03add006ff4() { 103 } 104 105 public override void Execute() { 106 WriteLiteral("\r\n"); 107 108 109 #line 11 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 110 111 var colorService = new ColorSwatchService(); 112 var buttonIconClass = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right"; 113 var articles = GetLoop("ItemPublisher:Items.List"); 114 115 116 #line default 117 #line hidden 118 WriteLiteral("\r\n\r\n"); 119 120 121 #line 17 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 122 if(articles.Any()) 123 { 124 125 126 #line default 127 #line hidden 128 WriteLiteral(" <ul"); 129 130 WriteLiteral(" class=\"news-grid-overview__list\""); 131 132 WriteLiteral(">\r\n"); 133 134 135 #line 20 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 136 137 138 #line default 139 #line hidden 140 141 #line 20 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 142 foreach (LoopItem item in articles) 143 { 144 int itempageid = item.GetInteger("ItemPublisher:Item.Field.PageId"); 145 if(itempageid == 0) { 146 string itemUrl = item.GetString("ItemPublisher:Item.Url"); 147 Match match = Regex.Match(itemUrl, @"[?&]Id=(\d+)"); 148 if (match.Success) { 149 itempageid = int.Parse(match.Groups[1].Value); 150 } 151 } 152 153 Page page = Dynamicweb.Extensibility.ServiceLocator.Current.GetPageService().GetPage(itempageid); 154 155 // Title 156 string title = item.GetString("ItemPublisher:Item.Title"); 157 if(string.IsNullOrWhiteSpace(title)) { 158 title = page.PropertyItem["OverviewName"] != null ? page.PropertyItem["OverviewName"].ToString() : ""; 159 } 160 161 // Excerpt 162 string shortContent = item.GetString("ItemPublisher:Item.Excerpt"); 163 if(string.IsNullOrWhiteSpace(shortContent)) { 164 shortContent = page.PropertyItem["OverviewDescription"] != null ? page.PropertyItem["OverviewDescription"].ToString() : ""; 165 } 166 167 // Date 168 string date = item.GetDate("ItemPublisher:Item.Date").ToString("d MMMM yyyy"); 169 string dateYear = item.GetDate("ItemPublisher:Item.Date").ToString("yyyy"); 170 if(string.IsNullOrWhiteSpace(date) || dateYear == "0001") { 171 date = page.PropertyItem["OverviewDate"] != null ? Convert.ToDateTime(page.PropertyItem["OverviewDate"]).ToString("d MMMM yyyy") : ""; 172 dateYear = page.PropertyItem["OverviewDate"] != null ? Convert.ToDateTime(page.PropertyItem["OverviewDate"]).ToString("yyyy") : ""; 173 } 174 175 // Img 176 string img = item.GetString("ItemPublisher:Item.Image"); 177 if(string.IsNullOrWhiteSpace(img)) { 178 img = page.PropertyItem["OverviewImage"] != null ? page.PropertyItem["OverviewImage"].ToString() : ""; 179 } 180 181 string ImageUrl = "/Admin/Public/GetImage.ashx?Image=" + img + "&Crop=7&Compression=80&Format=webp&Quality=90"; 182 string url = item.GetString("ItemPublisher:Item.Url"); 183 184 BlogCategory itemCategory = !string.IsNullOrWhiteSpace(item.GetString("ItemPublisher:Item.CategoryID.Value")) ? Dynamicweb.Services.Items.GetItemById<BlogCategory>(item.GetString("ItemPublisher:Item.CategoryID.Value")) : null; 185 string itemCategoryName = itemCategory?.Label; 186 187 string labels = item.GetString("ItemPublisher:Item.TagID.Value"); 188 var labelList = labels.Split(',').ToList(); 189 190 191 192 #line default 193 #line hidden 194 WriteLiteral(" <li"); 195 196 WriteLiteral(" class=\"news-grid-overview__list-item\""); 197 198 WriteLiteral(">\r\n <a"); 199 200 WriteAttribute("href", Tuple.Create(" href=\"", 3494), Tuple.Create("\"", 3505) 201 202 #line 69 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 203 , Tuple.Create(Tuple.Create("", 3501), Tuple.Create<System.Object, System.Int32>(url 204 205 #line default 206 #line hidden 207 , 3501), false) 208 ); 209 210 WriteLiteral(" class=\"news-grid-list-item__link\""); 211 212 WriteLiteral(">\r\n\r\n"); 213 214 215 #line 71 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 216 217 218 #line default 219 #line hidden 220 221 #line 71 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 222 if(!string.IsNullOrWhiteSpace(img)) 223 { 224 225 226 #line default 227 #line hidden 228 WriteLiteral(" <figure"); 229 230 WriteLiteral(" class=\"news-grid-list-item__image-wrapper\""); 231 232 WriteLiteral(">\r\n <source"); 233 234 WriteLiteral(" media=\"(max-width: 400px)\""); 235 236 WriteAttribute("srcset", Tuple.Create(" srcset=\"", 3765), Tuple.Create("\"", 3793) 237 238 #line 74 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 239 , Tuple.Create(Tuple.Create("", 3774), Tuple.Create<System.Object, System.Int32>(ImageUrl 240 241 #line default 242 #line hidden 243 , 3774), false) 244 , Tuple.Create(Tuple.Create("", 3783), Tuple.Create("&Width=400", 3783), true) 245 ); 246 247 WriteLiteral(">\r\n <source"); 248 249 WriteLiteral(" media=\"(max-width: 994px)\""); 250 251 WriteAttribute("srcset", Tuple.Create(" srcset=\"", 3859), Tuple.Create("\"", 3887) 252 253 #line 75 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 254 , Tuple.Create(Tuple.Create("", 3868), Tuple.Create<System.Object, System.Int32>(ImageUrl 255 256 #line default 257 #line hidden 258 , 3868), false) 259 , Tuple.Create(Tuple.Create("", 3877), Tuple.Create("&Width=994", 3877), true) 260 ); 261 262 WriteLiteral(">\r\n <img"); 263 264 WriteAttribute("src", Tuple.Create(" src=\"", 3923), Tuple.Create("\"", 3949) 265 266 #line 76 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 267 , Tuple.Create(Tuple.Create("", 3929), Tuple.Create<System.Object, System.Int32>(ImageUrl 268 269 #line default 270 #line hidden 271 , 3929), false) 272 , Tuple.Create(Tuple.Create("", 3938), Tuple.Create("&Width=1200", 3938), true) 273 ); 274 275 WriteAttribute("alt", Tuple.Create(" alt=\"", 3950), Tuple.Create("\"", 3962) 276 277 #line 76 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 278 , Tuple.Create(Tuple.Create("", 3956), Tuple.Create<System.Object, System.Int32>(title 279 280 #line default 281 #line hidden 282 , 3956), false) 283 ); 284 285 WriteLiteral(" class=\"news-grid-list-item__image\""); 286 287 WriteLiteral(" loading=\"lazy\""); 288 289 WriteLiteral(" width=\"500\""); 290 291 WriteLiteral(" height=\"200\""); 292 293 WriteLiteral(">\r\n </figure>\r\n"); 294 295 296 #line 78 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 297 } 298 299 300 #line default 301 #line hidden 302 WriteLiteral("\r\n"); 303 304 305 #line 80 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 306 307 308 #line default 309 #line hidden 310 311 #line 80 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 312 if(!string.IsNullOrWhiteSpace(labels)) 313 { 314 315 316 #line default 317 #line hidden 318 WriteLiteral(" <div"); 319 320 WriteLiteral(" class=\"news-grid-list-item__label-wrapper\""); 321 322 WriteLiteral(">\r\n"); 323 324 325 #line 83 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 326 327 328 #line default 329 #line hidden 330 331 #line 83 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 332 foreach(var label in labelList) { 333 BlogTag labelConfig = Dynamicweb.Services.Items.GetItemById<BlogTag>(label); 334 string bgColor = labelConfig?.BackgroundColor?.GetColorCode(Pageview.AreaID) ?? ""; 335 string textColor = labelConfig?.TextColor?.GetColorCode(Pageview.AreaID) ?? ""; 336 string labelText = labelConfig?.Label ?? ""; 337 if(!string.IsNullOrWhiteSpace(bgColor)) { 338 bgColor = $"--tag-bg-color: {bgColor};"; 339 } 340 if(!string.IsNullOrWhiteSpace(textColor)) { 341 textColor = $"--tag-text-color: {textColor};"; 342 } 343 if(!string.IsNullOrWhiteSpace(labelText)) 344 { 345 346 347 #line default 348 #line hidden 349 WriteLiteral(" <p"); 350 351 WriteLiteral(" class=\"news-grid-list-item__label\""); 352 353 WriteAttribute("style", Tuple.Create(" style=\"", 5310), Tuple.Create("\"", 5337) 354 355 #line 96 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 356 , Tuple.Create(Tuple.Create("", 5318), Tuple.Create<System.Object, System.Int32>(bgColor 357 358 #line default 359 #line hidden 360 , 5318), false) 361 362 #line 96 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 363 , Tuple.Create(Tuple.Create(" ", 5326), Tuple.Create<System.Object, System.Int32>(textColor 364 365 #line default 366 #line hidden 367 , 5327), false) 368 ); 369 370 WriteLiteral(">"); 371 372 373 #line 96 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 374 Write(labelText); 375 376 377 #line default 378 #line hidden 379 WriteLiteral("</p>\r\n"); 380 381 382 #line 97 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 383 } 384 } 385 386 387 #line default 388 #line hidden 389 WriteLiteral(" </div>\r\n"); 390 391 392 #line 100 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 393 } 394 395 396 #line default 397 #line hidden 398 WriteLiteral("\r\n <div"); 399 400 WriteLiteral(" class=\"news-grid-list-item__content\""); 401 402 WriteLiteral(">\r\n <div"); 403 404 WriteLiteral(" class=\"news-grid-list-item__meta-content\""); 405 406 WriteLiteral(">\r\n"); 407 408 409 #line 104 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 410 411 412 #line default 413 #line hidden 414 415 #line 104 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 416 if(!string.IsNullOrWhiteSpace(date) && dateYear != "0001") 417 { 418 419 420 #line default 421 #line hidden 422 WriteLiteral(" <span"); 423 424 WriteLiteral(" class=\"news-grid-list-item__meta-content--date\""); 425 426 WriteLiteral(">"); 427 428 429 #line 106 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 430 Write(date); 431 432 433 #line default 434 #line hidden 435 WriteLiteral("</span>\r\n"); 436 437 438 #line 107 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 439 } 440 441 442 #line default 443 #line hidden 444 WriteLiteral(" "); 445 446 447 #line 108 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 448 if(!string.IsNullOrWhiteSpace(itemCategoryName)) 449 { 450 451 452 #line default 453 #line hidden 454 WriteLiteral("\t\t\t\t\t\t\t <span"); 455 456 WriteLiteral(" class=\"news-grid-list-item__meta-content--category\""); 457 458 WriteLiteral(">"); 459 460 461 #line 110 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 462 Write(itemCategoryName); 463 464 465 #line default 466 #line hidden 467 WriteLiteral("</span>\r\n"); 468 469 470 #line 111 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 471 } 472 473 474 #line default 475 #line hidden 476 WriteLiteral(" </div>\r\n <h2"); 477 478 WriteLiteral(" class=\"news-grid-list-item__title\""); 479 480 WriteLiteral(">"); 481 482 483 #line 113 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 484 Write(title); 485 486 487 #line default 488 #line hidden 489 WriteLiteral("</h2>\r\n"); 490 491 492 #line 114 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 493 494 495 #line default 496 #line hidden 497 498 #line 114 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 499 if(!string.IsNullOrWhiteSpace(shortContent)) 500 { 501 502 503 #line default 504 #line hidden 505 WriteLiteral(" <div"); 506 507 WriteLiteral(" class=\"news-grid-list-item__description\""); 508 509 WriteLiteral(">\r\n <p>"); 510 511 512 #line 117 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 513 Write(shortContent); 514 515 516 #line default 517 #line hidden 518 WriteLiteral("</p>\r\n </div>\r\n"); 519 520 521 #line 119 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 522 } 523 524 525 #line default 526 #line hidden 527 WriteLiteral(" </div>\r\n\r\n <span"); 528 529 WriteLiteral(" class=\"btn btn__secondary news-grid-list-item__button\""); 530 531 WriteLiteral(">\r\n <span"); 532 533 WriteLiteral(" class=\"btn__text\""); 534 535 WriteLiteral(">"); 536 537 538 #line 123 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 539 Write(Translate("Overview.ReadMore", "Read More")); 540 541 542 #line default 543 #line hidden 544 WriteLiteral("</span>\r\n <i"); 545 546 WriteAttribute("class", Tuple.Create(" class=\"", 6744), Tuple.Create("\"", 6778) 547 , Tuple.Create(Tuple.Create("", 6752), Tuple.Create("btn__icon", 6752), true) 548 549 #line 124 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 550 , Tuple.Create(Tuple.Create(" ", 6761), Tuple.Create<System.Object, System.Int32>(buttonIconClass 551 552 #line default 553 #line hidden 554 , 6762), false) 555 ); 556 557 WriteLiteral("></i>\r\n </span>\r\n </a>\r\n </li>\r\n"); 558 559 560 #line 128 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 561 } 562 563 564 #line default 565 #line hidden 566 WriteLiteral(" </ul>\r\n"); 567 568 569 #line 130 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 570 } else { 571 572 573 #line default 574 #line hidden 575 WriteLiteral(" <div"); 576 577 WriteLiteral(" class=\"news-grid-overview__no-results\""); 578 579 WriteLiteral(">\r\n <p>"); 580 581 582 #line 132 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 583 Write(Translate("Overview.NoResults", "No articles were found matching these filters")); 584 585 586 #line default 587 #line hidden 588 WriteLiteral("</p>\r\n </div>\r\n"); 589 590 591 #line 134 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 592 } 593 594 595 #line default 596 #line hidden 597 WriteLiteral("\r\n\r\n"); 598 599 600 #line 137 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 601 if(GetInteger("ItemPublisher:Items.Paging.TotalPages") > 1) 602 { 603 int paragraphid = GetInteger("ItemPublisher:Global.ParagraphId"); 604 int totalPages = GetInteger("ItemPublisher:Items.Paging.TotalPages"); 605 int currentPagenumber = GetInteger("ItemPublisher:Items.Paging.CurrentPage"); 606 int previousPagenumber = currentPagenumber - 1; 607 int nextPagenumber = currentPagenumber + 1; 608 int firstPage = getFirstpage(currentPagenumber, totalPages, 7); 609 int lastPage = getLastpage(currentPagenumber, totalPages, 7, firstPage); 610 611 string reqCategory = System.Web.HttpContext.Current.Request["Category"]; 612 string categoryParam = !string.IsNullOrWhiteSpace(reqCategory) ? string.Format("&Category={0}", @reqCategory) : null; 613 614 string firstPageUrl = string.Format("/Default.aspx?ID={0}&PID={1}&page={2}{3}", Pageview.ID, paragraphid, 1, categoryParam); 615 string prevPageLink = GetString("ItemPublisher:Items.Paging.PrevPage"); 616 string nextPageLink = GetString("ItemPublisher:Items.Paging.NextPage"); 617 string lastPageUrl = string.Format("/Default.aspx?ID={0}&PID={1}&page={2}{3}", Pageview.ID, paragraphid, totalPages, categoryParam); 618 619 620 621 #line default 622 #line hidden 623 WriteLiteral(" <div"); 624 625 WriteLiteral(" class=\"itempublisher__pagination\""); 626 627 WriteLiteral(">\r\n <nav"); 628 629 WriteLiteral(" class=\"pagination\""); 630 631 WriteLiteral(" role=\"navigation\""); 632 633 WriteLiteral(" aria-label=\"Pagination navigation\""); 634 635 WriteLiteral(">\r\n <ul"); 636 637 WriteLiteral(" class=\"pagination__list\""); 638 639 WriteLiteral(">\r\n\r\n"); 640 641 642 #line 159 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 643 644 645 #line default 646 #line hidden 647 648 #line 159 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 649 if(prevPageLink != "#") { 650 651 652 #line default 653 #line hidden 654 WriteLiteral(" <li"); 655 656 WriteLiteral(" class=\"pagination__list-item\""); 657 658 WriteLiteral(">\r\n <a"); 659 660 WriteAttribute("href", Tuple.Create(" href=\"", 8530), Tuple.Create("\"", 8550) 661 662 #line 161 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 663 , Tuple.Create(Tuple.Create("", 8537), Tuple.Create<System.Object, System.Int32>(firstPageUrl 664 665 #line default 666 #line hidden 667 , 8537), false) 668 ); 669 670 WriteLiteral(" class=\"pagination__button pagination__button--icon\""); 671 672 WriteLiteral(" aria-label=\"Go to page 1\""); 673 674 WriteLiteral(">\r\n <i"); 675 676 WriteLiteral(" class=\"fal fa-arrow-to-left\""); 677 678 WriteLiteral("></i>\r\n </a>\r\n </li>\r\n"); 679 680 WriteLiteral(" <li"); 681 682 WriteLiteral(" class=\"pagination__list-item\""); 683 684 WriteLiteral(">\r\n <a"); 685 686 WriteAttribute("href", Tuple.Create(" href=\"", 8837), Tuple.Create("\"", 8857) 687 688 #line 166 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 689 , Tuple.Create(Tuple.Create("", 8844), Tuple.Create<System.Object, System.Int32>(prevPageLink 690 691 #line default 692 #line hidden 693 , 8844), false) 694 ); 695 696 WriteLiteral(" class=\"pagination__button pagination__button--icon\""); 697 698 WriteAttribute("aria-label", Tuple.Create(" aria-label=\"", 8910), Tuple.Create("\"", 8953) 699 , Tuple.Create(Tuple.Create("", 8923), Tuple.Create("Go", 8923), true) 700 , Tuple.Create(Tuple.Create(" ", 8925), Tuple.Create("to", 8926), true) 701 , Tuple.Create(Tuple.Create(" ", 8928), Tuple.Create("page", 8929), true) 702 703 #line 166 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 704 , Tuple.Create(Tuple.Create(" ", 8933), Tuple.Create<System.Object, System.Int32>(previousPagenumber 705 706 #line default 707 #line hidden 708 , 8934), false) 709 ); 710 711 WriteLiteral(">\r\n <i"); 712 713 WriteLiteral(" class=\"fal fa-arrow-left\""); 714 715 WriteLiteral("></i>\r\n </a>\r\n </li>\r\n"); 716 717 718 #line 170 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 719 } 720 721 722 #line default 723 #line hidden 724 WriteLiteral("\r\n <li"); 725 726 WriteLiteral(" class=\"pagination__list-item\""); 727 728 WriteLiteral(">\r\n <ul"); 729 730 WriteLiteral(" class=\"pagination__pages\""); 731 732 WriteLiteral(">\r\n"); 733 734 735 #line 174 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 736 737 738 #line default 739 #line hidden 740 741 #line 174 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 742 for(int i = @firstPage; i <= @lastPage; i++) 743 { 744 bool isActivePage = @currentPagenumber == i; 745 string activePageClass = isActivePage ? "pagination__button--active" : ""; 746 string pageUrl = string.Format("/Default.aspx?ID={0}&PID={1}&page={2}{3}", Pageview.ID, paragraphid, i, categoryParam); 747 string ariaLabel = isActivePage ? string.Format("aria-label='Current Page, Page {0}' aria-current='true'", i) : string.Format("aria-label='Go to page {0}'", i); 748 749 750 751 #line default 752 #line hidden 753 WriteLiteral("<li"); 754 755 WriteLiteral(" class=\"pagination__list-item\""); 756 757 WriteLiteral(">\r\n <a"); 758 759 WriteAttribute("href", Tuple.Create(" href=\"", 9925), Tuple.Create("\"", 9940) 760 761 #line 182 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 762 , Tuple.Create(Tuple.Create("", 9932), Tuple.Create<System.Object, System.Int32>(pageUrl 763 764 #line default 765 #line hidden 766 , 9932), false) 767 ); 768 769 WriteAttribute("class", Tuple.Create(" class=\"", 9941), Tuple.Create("\"", 9984) 770 , Tuple.Create(Tuple.Create("", 9949), Tuple.Create("pagination__button", 9949), true) 771 772 #line 182 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 773 , Tuple.Create(Tuple.Create(" ", 9967), Tuple.Create<System.Object, System.Int32>(activePageClass 774 775 #line default 776 #line hidden 777 , 9968), false) 778 ); 779 780 WriteLiteral(" "); 781 782 783 #line 182 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 784 Write(ariaLabel); 785 786 787 #line default 788 #line hidden 789 WriteLiteral(">\r\n <span"); 790 791 WriteLiteral(" class=\"pagination__text\""); 792 793 WriteLiteral(">"); 794 795 796 #line 183 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 797 Write(i); 798 799 800 #line default 801 #line hidden 802 WriteLiteral("</span>\r\n </a>\r\n </li>\r" + 803 "\n"); 804 805 806 #line 186 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 807 } 808 809 810 #line default 811 #line hidden 812 WriteLiteral(" </ul>\r\n </li>\r\n\r\n"); 813 814 815 #line 190 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 816 817 818 #line default 819 #line hidden 820 821 #line 190 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 822 if(nextPageLink != "#") { 823 824 825 #line default 826 #line hidden 827 WriteLiteral(" <li"); 828 829 WriteLiteral(" class=\"pagination__list-item\""); 830 831 WriteLiteral(">\r\n <a"); 832 833 WriteAttribute("href", Tuple.Create(" href=\"", 10355), Tuple.Create("\"", 10375) 834 835 #line 192 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 836 , Tuple.Create(Tuple.Create("", 10362), Tuple.Create<System.Object, System.Int32>(nextPageLink 837 838 #line default 839 #line hidden 840 , 10362), false) 841 ); 842 843 WriteLiteral(" class=\"pagination__button pagination__button--icon\""); 844 845 WriteAttribute("aria-label", Tuple.Create(" aria-label=\"", 10428), Tuple.Create("\"", 10467) 846 , Tuple.Create(Tuple.Create("", 10441), Tuple.Create("Go", 10441), true) 847 , Tuple.Create(Tuple.Create(" ", 10443), Tuple.Create("to", 10444), true) 848 , Tuple.Create(Tuple.Create(" ", 10446), Tuple.Create("page", 10447), true) 849 850 #line 192 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 851 , Tuple.Create(Tuple.Create(" ", 10451), Tuple.Create<System.Object, System.Int32>(nextPagenumber 852 853 #line default 854 #line hidden 855 , 10452), false) 856 ); 857 858 WriteLiteral(">\r\n <i"); 859 860 WriteLiteral(" class=\"fal fa-arrow-right\""); 861 862 WriteLiteral("></i>\r\n </a>\r\n </li>\r\n"); 863 864 WriteLiteral(" <li"); 865 866 WriteLiteral(" class=\"pagination__list-item\""); 867 868 WriteLiteral(">\r\n <a"); 869 870 WriteAttribute("href", Tuple.Create(" href=\"", 10674), Tuple.Create("\"", 10693) 871 872 #line 197 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 873 , Tuple.Create(Tuple.Create("", 10681), Tuple.Create<System.Object, System.Int32>(lastPageUrl 874 875 #line default 876 #line hidden 877 , 10681), false) 878 ); 879 880 WriteLiteral(" class=\"pagination__button pagination__button--icon\""); 881 882 WriteAttribute("aria-label", Tuple.Create(" aria-label=\"", 10746), Tuple.Create("\"", 10781) 883 , Tuple.Create(Tuple.Create("", 10759), Tuple.Create("Go", 10759), true) 884 , Tuple.Create(Tuple.Create(" ", 10761), Tuple.Create("to", 10762), true) 885 , Tuple.Create(Tuple.Create(" ", 10764), Tuple.Create("page", 10765), true) 886 887 #line 197 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 888 , Tuple.Create(Tuple.Create(" ", 10769), Tuple.Create<System.Object, System.Int32>(totalPages 889 890 #line default 891 #line hidden 892 , 10770), false) 893 ); 894 895 WriteLiteral(">\r\n <i"); 896 897 WriteLiteral(" class=\"fal fa-arrow-to-right\""); 898 899 WriteLiteral("></i>\r\n </a>\r\n </li>\r\n"); 900 901 902 #line 201 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 903 } 904 905 906 #line default 907 #line hidden 908 WriteLiteral("\r\n </ul>\r\n </nav>\r\n </div>\r\n"); 909 910 911 #line 206 "D:\dynamicweb.net\Solutions\TheGift\Production\files\Templates\Designs\TheGift_generated\ItemPublisher\List\NewsListGridWithoutFilter.cshtml" 912 } 913 914 915 #line default 916 #line hidden 917 WriteLiteral("\r\n"); 918 919 } 920 } 921 } 922

1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using Dynamicweb; 3 @using Dynamicweb.Content; 4 @using Dynamicweb.Rendering; 5 @using Dynamicweb.Frontend; 6 @using Dynamicweb.Content.Items; 7 @using Dynamicweb.Content.Items.Rendering; 8 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 9 @using Bluedesk.DynamicWeb.ItemTypes.Extensions; 10 11 @{ 12 var colorService = new ColorSwatchService(); 13 var buttonIconClass = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right"; 14 var articles = GetLoop("ItemPublisher:Items.List"); 15 } 16 17 @if(articles.Any()) 18 { 19 <ul class="news-grid-overview__list"> 20 @foreach (LoopItem item in articles) 21 { 22 int itempageid = item.GetInteger("ItemPublisher:Item.Field.PageId"); 23 if(itempageid == 0) { 24 string itemUrl = item.GetString("ItemPublisher:Item.Url"); 25 Match match = Regex.Match(itemUrl, @"[?&]Id=(\d+)"); 26 if (match.Success) { 27 itempageid = int.Parse(match.Groups[1].Value); 28 } 29 } 30 31 Page page = Dynamicweb.Extensibility.ServiceLocator.Current.GetPageService().GetPage(itempageid); 32 33 // Title 34 string title = item.GetString("ItemPublisher:Item.Title"); 35 if(string.IsNullOrWhiteSpace(title)) { 36 title = page.PropertyItem["OverviewName"] != null ? page.PropertyItem["OverviewName"].ToString() : ""; 37 } 38 39 // Excerpt 40 string shortContent = item.GetString("ItemPublisher:Item.Excerpt"); 41 if(string.IsNullOrWhiteSpace(shortContent)) { 42 shortContent = page.PropertyItem["OverviewDescription"] != null ? page.PropertyItem["OverviewDescription"].ToString() : ""; 43 } 44 45 // Date 46 string date = item.GetDate("ItemPublisher:Item.Date").ToString("d MMMM yyyy"); 47 string dateYear = item.GetDate("ItemPublisher:Item.Date").ToString("yyyy"); 48 if(string.IsNullOrWhiteSpace(date) || dateYear == "0001") { 49 date = page.PropertyItem["OverviewDate"] != null ? Convert.ToDateTime(page.PropertyItem["OverviewDate"]).ToString("d MMMM yyyy") : ""; 50 dateYear = page.PropertyItem["OverviewDate"] != null ? Convert.ToDateTime(page.PropertyItem["OverviewDate"]).ToString("yyyy") : ""; 51 } 52 53 // Img 54 string img = item.GetString("ItemPublisher:Item.Image"); 55 if(string.IsNullOrWhiteSpace(img)) { 56 img = page.PropertyItem["OverviewImage"] != null ? page.PropertyItem["OverviewImage"].ToString() : ""; 57 } 58 59 string ImageUrl = "/Admin/Public/GetImage.ashx?Image=" + img + "&Crop=7&Compression=80&Format=webp&Quality=90"; 60 string url = item.GetString("ItemPublisher:Item.Url"); 61 62 BlogCategory itemCategory = !string.IsNullOrWhiteSpace(item.GetString("ItemPublisher:Item.CategoryID.Value")) ? Dynamicweb.Services.Items.GetItemById<BlogCategory>(item.GetString("ItemPublisher:Item.CategoryID.Value")) : null; 63 string itemCategoryName = itemCategory?.Label; 64 65 string labels = item.GetString("ItemPublisher:Item.TagID.Value"); 66 var labelList = labels.Split(',').ToList(); 67 68 <li class="news-grid-overview__list-item"> 69 <a href="@url" class="news-grid-list-item__link"> 70 71 @if(!string.IsNullOrWhiteSpace(img)) 72 { 73 <figure class="news-grid-list-item__image-wrapper"> 74 <source media="(max-width: 400px)" srcset="@ImageUrl&Width=400"> 75 <source media="(max-width: 994px)" srcset="@ImageUrl&Width=994"> 76 <img src="@ImageUrl&Width=1200" alt="@title" class="news-grid-list-item__image" loading="lazy" width="500" height="200"> 77 </figure> 78 } 79 80 @if(!string.IsNullOrWhiteSpace(labels)) 81 { 82 <div class="news-grid-list-item__label-wrapper"> 83 @foreach(var label in labelList) { 84 BlogTag labelConfig = Dynamicweb.Services.Items.GetItemById<BlogTag>(label); 85 string bgColor = labelConfig?.BackgroundColor?.GetColorCode(Pageview.AreaID) ?? ""; 86 string textColor = labelConfig?.TextColor?.GetColorCode(Pageview.AreaID) ?? ""; 87 string labelText = labelConfig?.Label ?? ""; 88 if(!string.IsNullOrWhiteSpace(bgColor)) { 89 bgColor = $"--tag-bg-color: {bgColor};"; 90 } 91 if(!string.IsNullOrWhiteSpace(textColor)) { 92 textColor = $"--tag-text-color: {textColor};"; 93 } 94 if(!string.IsNullOrWhiteSpace(labelText)) 95 { 96 <p class="news-grid-list-item__label" style="@bgColor @textColor">@labelText</p> 97 } 98 } 99 </div> 100 } 101 102 <div class="news-grid-list-item__content"> 103 <div class="news-grid-list-item__meta-content"> 104 @if(!string.IsNullOrWhiteSpace(date) && dateYear != "0001") 105 { 106 <span class="news-grid-list-item__meta-content--date">@date</span> 107 } 108 @if(!string.IsNullOrWhiteSpace(itemCategoryName)) 109 { 110 <span class="news-grid-list-item__meta-content--category">@itemCategoryName</span> 111 } 112 </div> 113 <h2 class="news-grid-list-item__title">@title</h2> 114 @if(!string.IsNullOrWhiteSpace(shortContent)) 115 { 116 <div class="news-grid-list-item__description"> 117 <p>@shortContent</p> 118 </div> 119 } 120 </div> 121 122 <span class="btn btn__secondary news-grid-list-item__button"> 123 <span class="btn__text">@Translate("Overview.ReadMore", "Read More")</span> 124 <i class="btn__icon @buttonIconClass"></i> 125 </span> 126 </a> 127 </li> 128 } 129 </ul> 130 } else { 131 <div class="news-grid-overview__no-results"> 132 <p>@Translate("Overview.NoResults", "No articles were found matching these filters")</p> 133 </div> 134 } 135 136 137 @if(GetInteger("ItemPublisher:Items.Paging.TotalPages") > 1) 138 { 139 int paragraphid = GetInteger("ItemPublisher:Global.ParagraphId"); 140 int totalPages = GetInteger("ItemPublisher:Items.Paging.TotalPages"); 141 int currentPagenumber = GetInteger("ItemPublisher:Items.Paging.CurrentPage"); 142 int previousPagenumber = currentPagenumber - 1; 143 int nextPagenumber = currentPagenumber + 1; 144 int firstPage = getFirstpage(currentPagenumber, totalPages, 7); 145 int lastPage = getLastpage(currentPagenumber, totalPages, 7, firstPage); 146 147 string reqCategory = System.Web.HttpContext.Current.Request["Category"]; 148 string categoryParam = !string.IsNullOrWhiteSpace(reqCategory) ? string.Format("&Category={0}", @reqCategory) : null; 149 150 string firstPageUrl = string.Format("/Default.aspx?ID={0}&PID={1}&page={2}{3}", Pageview.ID, paragraphid, 1, categoryParam); 151 string prevPageLink = GetString("ItemPublisher:Items.Paging.PrevPage"); 152 string nextPageLink = GetString("ItemPublisher:Items.Paging.NextPage"); 153 string lastPageUrl = string.Format("/Default.aspx?ID={0}&PID={1}&page={2}{3}", Pageview.ID, paragraphid, totalPages, categoryParam); 154 155 <div class="itempublisher__pagination"> 156 <nav class="pagination" role="navigation" aria-label="Pagination navigation"> 157 <ul class="pagination__list"> 158 159 @if(prevPageLink != "#") { 160 <li class="pagination__list-item"> 161 <a href="@firstPageUrl" class="pagination__button pagination__button--icon" aria-label="Go to page 1"> 162 <i class="fal fa-arrow-to-left"></i> 163 </a> 164 </li> 165 <li class="pagination__list-item"> 166 <a href="@prevPageLink" class="pagination__button pagination__button--icon" aria-label="Go to page @previousPagenumber"> 167 <i class="fal fa-arrow-left"></i> 168 </a> 169 </li> 170 } 171 172 <li class="pagination__list-item"> 173 <ul class="pagination__pages"> 174 @for(int i = @firstPage; i <= @lastPage; i++) 175 { 176 bool isActivePage = @currentPagenumber == i; 177 string activePageClass = isActivePage ? "pagination__button--active" : ""; 178 string pageUrl = string.Format("/Default.aspx?ID={0}&PID={1}&page={2}{3}", Pageview.ID, paragraphid, i, categoryParam); 179 string ariaLabel = isActivePage ? string.Format("aria-label='Current Page, Page {0}' aria-current='true'", i) : string.Format("aria-label='Go to page {0}'", i); 180 181 <li class="pagination__list-item"> 182 <a href="@pageUrl" class="pagination__button @activePageClass" @ariaLabel> 183 <span class="pagination__text">@i</span> 184 </a> 185 </li> 186 } 187 </ul> 188 </li> 189 190 @if(nextPageLink != "#") { 191 <li class="pagination__list-item"> 192 <a href="@nextPageLink" class="pagination__button pagination__button--icon" aria-label="Go to page @nextPagenumber"> 193 <i class="fal fa-arrow-right"></i> 194 </a> 195 </li> 196 <li class="pagination__list-item"> 197 <a href="@lastPageUrl" class="pagination__button pagination__button--icon" aria-label="Go to page @totalPages"> 198 <i class="fal fa-arrow-to-right"></i> 199 </a> 200 </li> 201 } 202 203 </ul> 204 </nav> 205 </div> 206 } 207 208 @functions { 209 int getFirstpage(int currentPage, int totalPages, double pagesToShow) 210 { 211 int firstPage = 0; 212 if(pagesToShow >= totalPages) { 213 firstPage = 1; 214 } else { 215 firstPage = currentPage - Convert.ToInt32(Math.Floor(pagesToShow / 2)); 216 firstPage = firstPage < 1 ? 1 : firstPage; 217 } 218 return firstPage; 219 } 220 221 int getLastpage(int currentPage, int totalPages, double pagesToShow, int firstPage) 222 { 223 int lastPage = 0; 224 lastPage = firstPage + Convert.ToInt32(pagesToShow); 225 if (lastPage > totalPages) { 226 lastPage = totalPages; 227 } 228 return lastPage; 229 } 230 231 string Truncate(string value, int maxChars) 232 { 233 return value.Length <= maxChars ? value : value.Substring(0, maxChars) + "..."; 234 } 235 } 236
To Top