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.last_name}}</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>
|
||||
{{endfor}}
|
||||
{{endif}}
|
||||
|
@ -6,10 +6,10 @@
|
||||
<Base>True</Base>
|
||||
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||
<ProjectName Condition="'$(ProjectName)'==''">htmx_website_with_templatepro</ProjectName>
|
||||
<TargetedPlatforms>1</TargetedPlatforms>
|
||||
<TargetedPlatforms>129</TargetedPlatforms>
|
||||
<AppType>Console</AppType>
|
||||
<MainSource>htmx_website_with_templatepro.dpr</MainSource>
|
||||
<ProjectName Condition="'$(ProjectName)'==''">htmx_website_with_templatepro</ProjectName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
|
||||
<Base>true</Base>
|
||||
@ -44,6 +44,12 @@
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</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)'!=''">
|
||||
<Cfg_1_Win32>true</Cfg_1_Win32>
|
||||
<CfgParent>Cfg_1</CfgParent>
|
||||
@ -104,6 +110,9 @@
|
||||
<DCC_IntegerOverflowCheck>true</DCC_IntegerOverflowCheck>
|
||||
<DCC_RangeChecking>true</DCC_RangeChecking>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_1_Linux64)'!=''">
|
||||
<Debugger_DebugSourcePath>C:\DEV\dmvcframework\sources\;$(Debugger_DebugSourcePath)</Debugger_DebugSourcePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
|
||||
<DCC_RemoteDebug>false</DCC_RemoteDebug>
|
||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||
@ -179,6 +188,12 @@
|
||||
<Overwrite>true</Overwrite>
|
||||
</Platform>
|
||||
</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">
|
||||
<Platform Name="OSX32">
|
||||
<Operation>1</Operation>
|
||||
@ -1024,7 +1039,7 @@
|
||||
<Platforms>
|
||||
<Platform value="Android">False</Platform>
|
||||
<Platform value="Android64">False</Platform>
|
||||
<Platform value="Linux64">False</Platform>
|
||||
<Platform value="Linux64">True</Platform>
|
||||
<Platform value="Win32">True</Platform>
|
||||
<Platform value="Win64">False</Platform>
|
||||
</Platforms>
|
||||
|
@ -9,7 +9,6 @@ type
|
||||
[MVCPath]
|
||||
TBooksController = class(TMVCController)
|
||||
public
|
||||
[MVCPath]
|
||||
[MVCPath]
|
||||
function Index([MVCFromQueryString('query','')] SearchQueryText: String): String;
|
||||
|
||||
|
@ -30,7 +30,7 @@ var
|
||||
LServer: TIdHTTPWebBrokerBridge;
|
||||
begin
|
||||
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);
|
||||
try
|
||||
LServer.DefaultPort := APort;
|
||||
|
@ -6,7 +6,7 @@
|
||||
<MainSource>ServerSideViewsTemplatePro.dpr</MainSource>
|
||||
<Base>True</Base>
|
||||
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||
<Platform Condition="'$(Platform)'==''">Win64</Platform>
|
||||
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||
<TargetedPlatforms>3</TargetedPlatforms>
|
||||
<AppType>Console</AppType>
|
||||
<ProjectName Condition="'$(ProjectName)'==''">ServerSideViewsTemplatePro</ProjectName>
|
||||
@ -149,7 +149,6 @@
|
||||
<Deployment Version="5">
|
||||
<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.rsm" Configuration="Debug" Class="DebugSymbols"/>
|
||||
<DeployClass Name="AdditionalDebugSymbols">
|
||||
<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>
|
||||
<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 {{{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>
|
||||
</ul>
|
||||
<div>
|
||||
|
@ -182,7 +182,7 @@ type
|
||||
function EvaluateIfExpressionAt(var Idx: Int64): Boolean;
|
||||
function GetVariables: TTProVariables;
|
||||
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 aMinParNumber, aMaxParNumber: Integer; const aParameters: TArray<string>); overload;
|
||||
function GetPseudoVariable(const VarIterator: Integer; const PseudoVarName: String): TValue; overload;
|
||||
@ -1615,7 +1615,7 @@ begin
|
||||
end;
|
||||
|
||||
function TTProCompiledTemplate.ExecuteFilter(aFunctionName: string; aParameters: TArray<string>;
|
||||
aValue: TValue): TValue;
|
||||
aValue: TValue; const aVarNameWhereShoudBeApplied: String): TValue;
|
||||
var
|
||||
lDateValue: TDateTime;
|
||||
lDateFilterFormatSetting: TFormatSettings;
|
||||
@ -1624,7 +1624,9 @@ var
|
||||
lAnonFunc: TTProTemplateAnonFunction;
|
||||
lIntegerPar1: Integer;
|
||||
lDecimalMask: string;
|
||||
lExecuteAsFilterOnAValue: Boolean;
|
||||
begin
|
||||
lExecuteAsFilterOnAValue := not aVarNameWhereShoudBeApplied.IsEmpty;
|
||||
aFunctionName := lowercase(aFunctionName);
|
||||
if SameText(aFunctionName, 'gt') then
|
||||
begin
|
||||
@ -1664,7 +1666,7 @@ begin
|
||||
end
|
||||
else if SameText(aFunctionName, 'uppercase') then
|
||||
begin
|
||||
if not aValue.IsEmpty then
|
||||
if lExecuteAsFilterOnAValue then
|
||||
begin
|
||||
CheckParNumber(0, aParameters);
|
||||
Result := UpperCase(aValue.AsString);
|
||||
@ -1677,7 +1679,7 @@ begin
|
||||
end
|
||||
else if SameText(aFunctionName, 'lowercase') then
|
||||
begin
|
||||
if not aValue.IsEmpty then
|
||||
if lExecuteAsFilterOnAValue then
|
||||
begin
|
||||
CheckParNumber(0, aParameters);
|
||||
Result := lowercase(aValue.AsString);
|
||||
@ -1690,7 +1692,7 @@ begin
|
||||
end
|
||||
else if SameText(aFunctionName, 'capitalize') then
|
||||
begin
|
||||
if not aValue.IsEmpty then
|
||||
if lExecuteAsFilterOnAValue then
|
||||
begin
|
||||
CheckParNumber(0, aParameters);
|
||||
Result := CapitalizeString(aValue.AsString, True);
|
||||
@ -1820,7 +1822,7 @@ begin
|
||||
end
|
||||
else if SameText(aFunctionName, 'version') then
|
||||
begin
|
||||
if not aValue.IsEmpty then
|
||||
if lExecuteAsFilterOnAValue then
|
||||
begin
|
||||
FunctionError(aFunctionName, 'cannot be applied to a value - [HINT] Use {{:|' + aFunctionName + '}}');
|
||||
end;
|
||||
@ -3126,11 +3128,11 @@ begin
|
||||
end;
|
||||
case lCurrTokenType of
|
||||
ttValue:
|
||||
Result := ExecuteFilter(lFilterName, lFilterParameters, GetVarAsTValue(lVarName));
|
||||
Result := ExecuteFilter(lFilterName, lFilterParameters, GetVarAsTValue(lVarName), lVarName);
|
||||
ttBoolExpression:
|
||||
Result := IsTruthy(ExecuteFilter(lFilterName, lFilterParameters, GetVarAsTValue(lVarName)));
|
||||
Result := IsTruthy(ExecuteFilter(lFilterName, lFilterParameters, GetVarAsTValue(lVarName), lVarName));
|
||||
ttLiteralString:
|
||||
Result := ExecuteFilter(lFilterName, lFilterParameters, lVarName);
|
||||
Result := ExecuteFilter(lFilterName, lFilterParameters, lVarName, lVarName);
|
||||
else
|
||||
Error('Invalid token in EvaluateValue');
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user