mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-15 07:45:54 +01:00
Update TemplatePro and small samples fixes
Some checks failed
TOC Generator / TOC Generator (push) Has been cancelled
Some checks failed
TOC Generator / TOC Generator (push) Has been cancelled
This commit is contained in:
parent
feadf973f2
commit
99a521f354
@ -19,7 +19,7 @@
|
|||||||
<td>{{:cust.first_name}}</td>
|
<td>{{:cust.first_name}}</td>
|
||||||
<td>{{:cust.last_name}}</td>
|
<td>{{:cust.last_name}}</td>
|
||||||
<td>{{:cust.country|capitalize}}</td>
|
<td>{{:cust.country|capitalize}}</td>
|
||||||
<td>{{:cust.dob}}{{if cust.dob|ge,"2000/01/01"}}📅{{endif}}</td>
|
<td>{{:cust.dob|datetostr}}{{if cust.dob|ge,"2000/01/01"}}📅{{endif}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{endfor}}
|
{{endfor}}
|
||||||
{{endif}}
|
{{endif}}
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
<Base>True</Base>
|
<Base>True</Base>
|
||||||
<Config Condition="'$(Config)'==''">Debug</Config>
|
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||||
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||||
<ProjectName Condition="'$(ProjectName)'==''">htmx_website_with_templatepro</ProjectName>
|
<TargetedPlatforms>129</TargetedPlatforms>
|
||||||
<TargetedPlatforms>1</TargetedPlatforms>
|
|
||||||
<AppType>Console</AppType>
|
<AppType>Console</AppType>
|
||||||
<MainSource>htmx_website_with_templatepro.dpr</MainSource>
|
<MainSource>htmx_website_with_templatepro.dpr</MainSource>
|
||||||
|
<ProjectName Condition="'$(ProjectName)'==''">htmx_website_with_templatepro</ProjectName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
|
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
|
||||||
<Base>true</Base>
|
<Base>true</Base>
|
||||||
@ -44,6 +44,12 @@
|
|||||||
<CfgParent>Base</CfgParent>
|
<CfgParent>Base</CfgParent>
|
||||||
<Base>true</Base>
|
<Base>true</Base>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="('$(Platform)'=='Linux64' and '$(Cfg_1)'=='true') or '$(Cfg_1_Linux64)'!=''">
|
||||||
|
<Cfg_1_Linux64>true</Cfg_1_Linux64>
|
||||||
|
<CfgParent>Cfg_1</CfgParent>
|
||||||
|
<Cfg_1>true</Cfg_1>
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
|
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
|
||||||
<Cfg_1_Win32>true</Cfg_1_Win32>
|
<Cfg_1_Win32>true</Cfg_1_Win32>
|
||||||
<CfgParent>Cfg_1</CfgParent>
|
<CfgParent>Cfg_1</CfgParent>
|
||||||
@ -104,6 +110,9 @@
|
|||||||
<DCC_IntegerOverflowCheck>true</DCC_IntegerOverflowCheck>
|
<DCC_IntegerOverflowCheck>true</DCC_IntegerOverflowCheck>
|
||||||
<DCC_RangeChecking>true</DCC_RangeChecking>
|
<DCC_RangeChecking>true</DCC_RangeChecking>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Cfg_1_Linux64)'!=''">
|
||||||
|
<Debugger_DebugSourcePath>C:\DEV\dmvcframework\sources\;$(Debugger_DebugSourcePath)</Debugger_DebugSourcePath>
|
||||||
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
|
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
|
||||||
<DCC_RemoteDebug>false</DCC_RemoteDebug>
|
<DCC_RemoteDebug>false</DCC_RemoteDebug>
|
||||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||||
@ -179,6 +188,12 @@
|
|||||||
<Overwrite>true</Overwrite>
|
<Overwrite>true</Overwrite>
|
||||||
</Platform>
|
</Platform>
|
||||||
</DeployFile>
|
</DeployFile>
|
||||||
|
<DeployFile LocalName="bin\htmx_website_with_templatepro" Configuration="Debug" Class="ProjectOutput">
|
||||||
|
<Platform Name="Linux64">
|
||||||
|
<RemoteName>htmx_website_with_templatepro</RemoteName>
|
||||||
|
<Overwrite>true</Overwrite>
|
||||||
|
</Platform>
|
||||||
|
</DeployFile>
|
||||||
<DeployClass Name="AdditionalDebugSymbols">
|
<DeployClass Name="AdditionalDebugSymbols">
|
||||||
<Platform Name="OSX32">
|
<Platform Name="OSX32">
|
||||||
<Operation>1</Operation>
|
<Operation>1</Operation>
|
||||||
@ -1024,7 +1039,7 @@
|
|||||||
<Platforms>
|
<Platforms>
|
||||||
<Platform value="Android">False</Platform>
|
<Platform value="Android">False</Platform>
|
||||||
<Platform value="Android64">False</Platform>
|
<Platform value="Android64">False</Platform>
|
||||||
<Platform value="Linux64">False</Platform>
|
<Platform value="Linux64">True</Platform>
|
||||||
<Platform value="Win32">True</Platform>
|
<Platform value="Win32">True</Platform>
|
||||||
<Platform value="Win64">False</Platform>
|
<Platform value="Win64">False</Platform>
|
||||||
</Platforms>
|
</Platforms>
|
||||||
|
@ -9,7 +9,6 @@ type
|
|||||||
[MVCPath]
|
[MVCPath]
|
||||||
TBooksController = class(TMVCController)
|
TBooksController = class(TMVCController)
|
||||||
public
|
public
|
||||||
[MVCPath]
|
|
||||||
[MVCPath]
|
[MVCPath]
|
||||||
function Index([MVCFromQueryString('query','')] SearchQueryText: String): String;
|
function Index([MVCFromQueryString('query','')] SearchQueryText: String): String;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ var
|
|||||||
LServer: TIdHTTPWebBrokerBridge;
|
LServer: TIdHTTPWebBrokerBridge;
|
||||||
begin
|
begin
|
||||||
ReportMemoryLeaksOnShutdown := True;
|
ReportMemoryLeaksOnShutdown := True;
|
||||||
LogI(Format('Starting HTTP Server on port %d', [APort]));
|
LogI(Format('Starting HTTP Server on http://localhost:%d', [APort]));
|
||||||
LServer := TIdHTTPWebBrokerBridge.Create(nil);
|
LServer := TIdHTTPWebBrokerBridge.Create(nil);
|
||||||
try
|
try
|
||||||
LServer.DefaultPort := APort;
|
LServer.DefaultPort := APort;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<MainSource>ServerSideViewsTemplatePro.dpr</MainSource>
|
<MainSource>ServerSideViewsTemplatePro.dpr</MainSource>
|
||||||
<Base>True</Base>
|
<Base>True</Base>
|
||||||
<Config Condition="'$(Config)'==''">Debug</Config>
|
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||||
<Platform Condition="'$(Platform)'==''">Win64</Platform>
|
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||||
<TargetedPlatforms>3</TargetedPlatforms>
|
<TargetedPlatforms>3</TargetedPlatforms>
|
||||||
<AppType>Console</AppType>
|
<AppType>Console</AppType>
|
||||||
<ProjectName Condition="'$(ProjectName)'==''">ServerSideViewsTemplatePro</ProjectName>
|
<ProjectName Condition="'$(ProjectName)'==''">ServerSideViewsTemplatePro</ProjectName>
|
||||||
@ -149,7 +149,6 @@
|
|||||||
<Deployment Version="5">
|
<Deployment Version="5">
|
||||||
<DeployFile LocalName="bin\ServerSideViews.exe" Configuration="Debug" Class="ProjectOutput"/>
|
<DeployFile LocalName="bin\ServerSideViews.exe" Configuration="Debug" Class="ProjectOutput"/>
|
||||||
<DeployFile LocalName="bin\ServerSideViewsTemplatePro.exe" Configuration="Debug" Class="ProjectOutput"/>
|
<DeployFile LocalName="bin\ServerSideViewsTemplatePro.exe" Configuration="Debug" Class="ProjectOutput"/>
|
||||||
<DeployFile LocalName="bin\ServerSideViewsTemplatePro.exe" Configuration="Debug" Class="ProjectOutput"/>
|
|
||||||
<DeployFile LocalName="bin\ServerSideViewsTemplatePro.rsm" Configuration="Debug" Class="DebugSymbols"/>
|
<DeployFile LocalName="bin\ServerSideViewsTemplatePro.rsm" Configuration="Debug" Class="DebugSymbols"/>
|
||||||
<DeployClass Name="AdditionalDebugSymbols">
|
<DeployClass Name="AdditionalDebugSymbols">
|
||||||
<Platform Name="OSX32">
|
<Platform Name="OSX32">
|
||||||
|
@ -1 +1 @@
|
|||||||
[{"first_name":"Daniele","last_name":"Teti","age":43,"devices":[],"guid":"49E8419B66C744529D63DB292389D541"},{"first_name":"Peter","last_name":"Parker","age":23,"devices":[],"guid":"C5489969A04D4AE4B00D4FC50C8ADB5C"},{"first_name":"Bruce","last_name":"Banner","age":50,"devices":[],"guid":"B41D180F30584558B4F4A1AAF849FFA3"},{"first_name":"Sue","last_name":"Storm","age":33,"devices":[],"guid":"3F058118B8C6470D9684E127BC30A84A"},{"first_name":"Scott","last_name":"Summer","age":35,"devices":[],"guid":"3518D8C6F60E42D19C5A7250ADEADC33"},{"first_name":"Reed","last_name":"Richards","age":45,"devices":["smartphone","desktop"],"guid":"09C85C9DEB714476AADB9EB0AD689536"},{"first_name":"Paolino","last_name":"Paperino","age":34,"devices":["dumbphone","laptop"],"guid":"40E3AA589440403C851D28FD649735E8"},{"first_name":"Paolino","last_name":"Paperino","age":34,"devices":["dumbphone","laptop"],"guid":"A9F3E3B5F6D344EC93C47C6E2B721B16"}]
|
[{"first_name":"Daniele","last_name":"Teti","age":43,"devices":[],"guid":"49E8419B66C744529D63DB292389D541"},{"first_name":"Peter","last_name":"Parker","age":23,"devices":[],"guid":"C5489969A04D4AE4B00D4FC50C8ADB5C"},{"first_name":"Bruce","last_name":"Banner","age":50,"devices":[],"guid":"B41D180F30584558B4F4A1AAF849FFA3"},{"first_name":"Sue","last_name":"Storm","age":33,"devices":[],"guid":"3F058118B8C6470D9684E127BC30A84A"},{"first_name":"Scott","last_name":"Summer","age":35,"devices":[],"guid":"3518D8C6F60E42D19C5A7250ADEADC33"},{"first_name":"Reed","last_name":"Richards","age":45,"devices":["smartphone","desktop"],"guid":"09C85C9DEB714476AADB9EB0AD689536"},{"first_name":"Paolino","last_name":"Paperino","age":34,"devices":["dumbphone","laptop"],"guid":"40E3AA589440403C851D28FD649735E8"},{"first_name":"Paolino","last_name":"Paperino","age":34,"devices":["dumbphone","laptop"],"guid":"A9F3E3B5F6D344EC93C47C6E2B721B16"},{"first_name":"Bruce","last_name":"Banner 2","age":45,"devices":["dumbphone"],"guid":"CD5DCFF20B5F45E69C78F653840B9EE5"}]
|
@ -86,7 +86,7 @@ This page is a showcase for all the TemplatePro features usable from DMVCFramewo
|
|||||||
<h2 class="section">Using Filters</h2>
|
<h2 class="section">Using Filters</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Using syntax {{{"value as string"|uppercase}} = {{"value as string"|uppercase}} Filter "uppercase" is invoked passing "value as string" as constant value.</li>
|
<li>Using syntax {{{"value as string"|uppercase}} = {{"value as string"|uppercase}} Filter "uppercase" is invoked passing "value as string" as constant value.</li>
|
||||||
<li>Using syntax {{{first_name!uppercase}} = {{:first_name|uppercase}} Filter "uppercase" is invoked passing the value contained in the attribute first_name.</li>
|
<li>Using syntax {{{first_name|uppercase}} = {{:first_name|uppercase}} Filter "uppercase" is invoked passing the value contained in the attribute first_name.</li>
|
||||||
<li>Helpers cannot be nested (yet)</li>
|
<li>Helpers cannot be nested (yet)</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div>
|
<div>
|
||||||
|
@ -182,7 +182,7 @@ type
|
|||||||
function EvaluateIfExpressionAt(var Idx: Int64): Boolean;
|
function EvaluateIfExpressionAt(var Idx: Int64): Boolean;
|
||||||
function GetVariables: TTProVariables;
|
function GetVariables: TTProVariables;
|
||||||
procedure SplitVariableName(const VariableWithMember: String; out VarName, VarMembers: String);
|
procedure SplitVariableName(const VariableWithMember: String; out VarName, VarMembers: String);
|
||||||
function ExecuteFilter(aFunctionName: string; aParameters: TArray<string>; aValue: TValue): TValue;
|
function ExecuteFilter(aFunctionName: string; aParameters: TArray<string>; aValue: TValue; const aVarNameWhereShoudBeApplied: String): TValue;
|
||||||
procedure CheckParNumber(const aHowManyPars: Integer; const aParameters: TArray<string>); overload;
|
procedure CheckParNumber(const aHowManyPars: Integer; const aParameters: TArray<string>); overload;
|
||||||
procedure CheckParNumber(const aMinParNumber, aMaxParNumber: Integer; const aParameters: TArray<string>); overload;
|
procedure CheckParNumber(const aMinParNumber, aMaxParNumber: Integer; const aParameters: TArray<string>); overload;
|
||||||
function GetPseudoVariable(const VarIterator: Integer; const PseudoVarName: String): TValue; overload;
|
function GetPseudoVariable(const VarIterator: Integer; const PseudoVarName: String): TValue; overload;
|
||||||
@ -1615,7 +1615,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TTProCompiledTemplate.ExecuteFilter(aFunctionName: string; aParameters: TArray<string>;
|
function TTProCompiledTemplate.ExecuteFilter(aFunctionName: string; aParameters: TArray<string>;
|
||||||
aValue: TValue): TValue;
|
aValue: TValue; const aVarNameWhereShoudBeApplied: String): TValue;
|
||||||
var
|
var
|
||||||
lDateValue: TDateTime;
|
lDateValue: TDateTime;
|
||||||
lDateFilterFormatSetting: TFormatSettings;
|
lDateFilterFormatSetting: TFormatSettings;
|
||||||
@ -1624,7 +1624,9 @@ var
|
|||||||
lAnonFunc: TTProTemplateAnonFunction;
|
lAnonFunc: TTProTemplateAnonFunction;
|
||||||
lIntegerPar1: Integer;
|
lIntegerPar1: Integer;
|
||||||
lDecimalMask: string;
|
lDecimalMask: string;
|
||||||
|
lExecuteAsFilterOnAValue: Boolean;
|
||||||
begin
|
begin
|
||||||
|
lExecuteAsFilterOnAValue := not aVarNameWhereShoudBeApplied.IsEmpty;
|
||||||
aFunctionName := lowercase(aFunctionName);
|
aFunctionName := lowercase(aFunctionName);
|
||||||
if SameText(aFunctionName, 'gt') then
|
if SameText(aFunctionName, 'gt') then
|
||||||
begin
|
begin
|
||||||
@ -1664,7 +1666,7 @@ begin
|
|||||||
end
|
end
|
||||||
else if SameText(aFunctionName, 'uppercase') then
|
else if SameText(aFunctionName, 'uppercase') then
|
||||||
begin
|
begin
|
||||||
if not aValue.IsEmpty then
|
if lExecuteAsFilterOnAValue then
|
||||||
begin
|
begin
|
||||||
CheckParNumber(0, aParameters);
|
CheckParNumber(0, aParameters);
|
||||||
Result := UpperCase(aValue.AsString);
|
Result := UpperCase(aValue.AsString);
|
||||||
@ -1677,7 +1679,7 @@ begin
|
|||||||
end
|
end
|
||||||
else if SameText(aFunctionName, 'lowercase') then
|
else if SameText(aFunctionName, 'lowercase') then
|
||||||
begin
|
begin
|
||||||
if not aValue.IsEmpty then
|
if lExecuteAsFilterOnAValue then
|
||||||
begin
|
begin
|
||||||
CheckParNumber(0, aParameters);
|
CheckParNumber(0, aParameters);
|
||||||
Result := lowercase(aValue.AsString);
|
Result := lowercase(aValue.AsString);
|
||||||
@ -1690,7 +1692,7 @@ begin
|
|||||||
end
|
end
|
||||||
else if SameText(aFunctionName, 'capitalize') then
|
else if SameText(aFunctionName, 'capitalize') then
|
||||||
begin
|
begin
|
||||||
if not aValue.IsEmpty then
|
if lExecuteAsFilterOnAValue then
|
||||||
begin
|
begin
|
||||||
CheckParNumber(0, aParameters);
|
CheckParNumber(0, aParameters);
|
||||||
Result := CapitalizeString(aValue.AsString, True);
|
Result := CapitalizeString(aValue.AsString, True);
|
||||||
@ -1820,7 +1822,7 @@ begin
|
|||||||
end
|
end
|
||||||
else if SameText(aFunctionName, 'version') then
|
else if SameText(aFunctionName, 'version') then
|
||||||
begin
|
begin
|
||||||
if not aValue.IsEmpty then
|
if lExecuteAsFilterOnAValue then
|
||||||
begin
|
begin
|
||||||
FunctionError(aFunctionName, 'cannot be applied to a value - [HINT] Use {{:|' + aFunctionName + '}}');
|
FunctionError(aFunctionName, 'cannot be applied to a value - [HINT] Use {{:|' + aFunctionName + '}}');
|
||||||
end;
|
end;
|
||||||
@ -3126,11 +3128,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
case lCurrTokenType of
|
case lCurrTokenType of
|
||||||
ttValue:
|
ttValue:
|
||||||
Result := ExecuteFilter(lFilterName, lFilterParameters, GetVarAsTValue(lVarName));
|
Result := ExecuteFilter(lFilterName, lFilterParameters, GetVarAsTValue(lVarName), lVarName);
|
||||||
ttBoolExpression:
|
ttBoolExpression:
|
||||||
Result := IsTruthy(ExecuteFilter(lFilterName, lFilterParameters, GetVarAsTValue(lVarName)));
|
Result := IsTruthy(ExecuteFilter(lFilterName, lFilterParameters, GetVarAsTValue(lVarName), lVarName));
|
||||||
ttLiteralString:
|
ttLiteralString:
|
||||||
Result := ExecuteFilter(lFilterName, lFilterParameters, lVarName);
|
Result := ExecuteFilter(lFilterName, lFilterParameters, lVarName, lVarName);
|
||||||
else
|
else
|
||||||
Error('Invalid token in EvaluateValue');
|
Error('Invalid token in EvaluateValue');
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user