From bc065284f8bc6357f80a50d75fa76ae0c05ec82f Mon Sep 17 00:00:00 2001 From: Daniele Teti Date: Mon, 7 Oct 2024 16:53:02 +0200 Subject: [PATCH] Renamed templatepro filter "query" to "fromquery" --- sources/MVCFramework.View.Renderers.TemplatePro.pas | 4 ++-- sources/MVCFramework.pas | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sources/MVCFramework.View.Renderers.TemplatePro.pas b/sources/MVCFramework.View.Renderers.TemplatePro.pas index 773f2536..293b7034 100644 --- a/sources/MVCFramework.View.Renderers.TemplatePro.pas +++ b/sources/MVCFramework.View.Renderers.TemplatePro.pas @@ -79,7 +79,7 @@ begin end else begin - if TDuckTypedList.CanBeWrappedAsList(aValue.AsObject, lWrappedList) then + if (aValue.AsObject <> nil) and TDuckTypedList.CanBeWrappedAsList(aValue.AsObject, lWrappedList) then begin Result := lWrappedList.Count; end @@ -176,7 +176,7 @@ begin end; lCompiledTemplate.AddFilter('json', DumpAsJSONString); lCompiledTemplate.AddFilter('count', GetDataSetOrObjectListCount); - lCompiledTemplate.AddFilter('query', + lCompiledTemplate.AddFilter('fromquery', function (const aValue: TValue; const aParameters: TArray): TValue begin if Length(aParameters) = 1 then diff --git a/sources/MVCFramework.pas b/sources/MVCFramework.pas index 0a659cc1..87b72d36 100644 --- a/sources/MVCFramework.pas +++ b/sources/MVCFramework.pas @@ -923,6 +923,7 @@ type /// PageFragment ignore header and footer views /// function Page(const AViewNames: TArray; const UseCommonHeadersAndFooters: Boolean = True): string; overload; inline; + function Page(const AViewName: string; const UseCommonHeadersAndFooters: Boolean = True): string; overload; inline; /// /// Page calls GetRenderedView with sensible defaults. @@ -4392,6 +4393,11 @@ begin Result := GetRenderedView(AViewNames, JSONModel) end; +function TMVCController.Page(const AViewName: string; const UseCommonHeadersAndFooters: Boolean): string; +begin + Result := Page([AViewName], UseCommonHeadersAndFooters); +end; + function TMVCController.PageFragment(const AViewNames: TArray; const JSONModel: TJSONObject): string; begin