diff --git a/Build/CommonAssemblyInfo.cs b/Build/CommonAssemblyInfo.cs index 37f4187..72a7c16 100644 --- a/Build/CommonAssemblyInfo.cs +++ b/Build/CommonAssemblyInfo.cs @@ -15,6 +15,6 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("3.6.34")] -[assembly: AssemblyFileVersion("3.6.34")] +[assembly: AssemblyVersion("3.6.35")] +[assembly: AssemblyFileVersion("3.6.35")] //[assembly: AssemblyInformationalVersion("2.5-filters")] diff --git a/Griddly.Mvc/GriddlyHtmlButton.cs b/Griddly.Mvc/GriddlyHtmlButton.cs index 632f368..8124ea9 100644 --- a/Griddly.Mvc/GriddlyHtmlButton.cs +++ b/Griddly.Mvc/GriddlyHtmlButton.cs @@ -1,4 +1,5 @@ using System; +using System.Threading.Tasks; #if NETCOREAPP using Microsoft.AspNetCore.Html; @@ -6,14 +7,38 @@ namespace Griddly.Mvc { +#if NETCOREAPP public class GriddlyHtmlButton : GriddlyButton { - public Func content) + { + ContentTask = o => Task.FromResult(content(o)); + } + public GriddlyHtmlButton(Task content) + { + ContentTask = o => content; + } + + /// + /// Pass the HtmlTemplate in to the constructor instead of using this setter. + /// Kept for backward compatibility only. + /// + [Obsolete("Pass the HtmlTemplate in to the constructor")] + public Func HtmlTemplate + { + set + { + var func = value; + ContentTask = o => Task.FromResult(func(o)); + } + } + + public Func> ContentTask { get; private set; } + } #else - object -#endif - > HtmlTemplate { get; set; } + public class GriddlyHtmlButton : GriddlyButton + { + public Func HtmlTemplate { get; set; } } +#endif } \ No newline at end of file diff --git a/Griddly.NetCore.Razor/Pages/Shared/Griddly/BootstrapButton.cshtml b/Griddly.NetCore.Razor/Pages/Shared/Griddly/BootstrapButton.cshtml index affb920..3096409 100644 --- a/Griddly.NetCore.Razor/Pages/Shared/Griddly/BootstrapButton.cshtml +++ b/Griddly.NetCore.Razor/Pages/Shared/Griddly/BootstrapButton.cshtml @@ -99,7 +99,7 @@ Func, IHtmlContent> RenderList = @@{ } else if (button is GriddlyHtmlButton) - {@(((GriddlyHtmlButton)button).HtmlTemplate(button))} + {@await ((GriddlyHtmlButton)button).ContentTask(button)} else {@RenderLink((button, false, true))} } @@ -123,7 +123,7 @@ Func, IHtmlContent> RenderList = @@{ {
  • @if (button is GriddlyHtmlButton) - {@(((GriddlyHtmlButton)button).HtmlTemplate(button))} + {@await ((GriddlyHtmlButton)button).ContentTask(button)} else {@RenderLink((button, false, true))}
  • @@ -135,7 +135,7 @@ Func, IHtmlContent> RenderList = @@{ @if (Model is GriddlyHtmlButton) { - @(((GriddlyHtmlButton)Model).HtmlTemplate(Model)) + @await ((GriddlyHtmlButton)Model).ContentTask(Model) } else if (!Model.Buttons.Any()) {