Error executing template "Designs/Rapido/ItemPublisher/List/EventList.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_4b306a0dc280460f93d7242154e21ffa.b__80_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamic Applications\farmaci.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\ItemPublisher\List\EventList.cshtml:line 3496
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_4b306a0dc280460f93d7242154e21ffa.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamic Applications\farmaci.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\ItemPublisher\List\EventList.cshtml:line 203
   at CompiledRazorTemplates.Dynamic.RazorEngine_4b306a0dc280460f93d7242154e21ffa.<>c__DisplayClass1_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamic Applications\farmaci.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\ItemPublisher\List\EventList.cshtml:line 141
   at CompiledRazorTemplates.Dynamic.RazorEngine_4b306a0dc280460f93d7242154e21ffa.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamic Applications\farmaci.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\ItemPublisher\List\EventList.cshtml:line 236
   at CompiledRazorTemplates.Dynamic.RazorEngine_4b306a0dc280460f93d7242154e21ffa.<>c__DisplayClass1_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamic Applications\farmaci.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\ItemPublisher\List\EventList.cshtml:line 130
   at CompiledRazorTemplates.Dynamic.RazorEngine_4b306a0dc280460f93d7242154e21ffa.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamic Applications\farmaci.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\ItemPublisher\List\EventList.cshtml:line 236
   at CompiledRazorTemplates.Dynamic.RazorEngine_4b306a0dc280460f93d7242154e21ffa.<>c__DisplayClass1_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamic Applications\farmaci.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\ItemPublisher\List\EventList.cshtml:line 141
   at CompiledRazorTemplates.Dynamic.RazorEngine_4b306a0dc280460f93d7242154e21ffa.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamic Applications\farmaci.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\ItemPublisher\List\EventList.cshtml:line 236
   at CompiledRazorTemplates.Dynamic.RazorEngine_4b306a0dc280460f93d7242154e21ffa.<>c__DisplayClass1_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamic Applications\farmaci.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\ItemPublisher\List\EventList.cshtml:line 130
   at CompiledRazorTemplates.Dynamic.RazorEngine_4b306a0dc280460f93d7242154e21ffa.Execute() in D:\dynamicweb.net\Solutions\Dynamic Applications\farmaci.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\ItemPublisher\List\EventList.cshtml:line 3489
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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