mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-15 07:45:54 +01:00
Improved template engines mechanism
This commit is contained in:
parent
01da47ea76
commit
4c00333115
@ -106,7 +106,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
var lJItm := lJDevices.AddObject;
|
var lJItm := lJDevices.AddObject;
|
||||||
lJItm.S['name'] := lItem;
|
lJItm.S['name'] := lItem;
|
||||||
lJItm.B['selected'] := TArray.BinarySearch<String>(lDevices, lItem, lIdx);
|
lJItm.B['selected'] := TArray.BinarySearch<String>(lPerson.Devices, lItem, lIdx);
|
||||||
end;
|
end;
|
||||||
Result := Page(['editperson'], lJObj);
|
Result := Page(['editperson'], lJObj);
|
||||||
finally
|
finally
|
||||||
|
@ -29,19 +29,11 @@ interface
|
|||||||
uses
|
uses
|
||||||
System.Rtti;
|
System.Rtti;
|
||||||
|
|
||||||
//uses
|
|
||||||
// mormot.core.mustache;
|
|
||||||
|
|
||||||
function MyHelper1(const aValue: TValue; const aParameters: TArray<string>): string;
|
function MyHelper1(const aValue: TValue; const aParameters: TArray<string>): string;
|
||||||
function MyHelper2(const aValue: TValue; const aParameters: TArray<string>): string;
|
function MyHelper2(const aValue: TValue; const aParameters: TArray<string>): string;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
|
||||||
MVCFramework.View.Renderers.Mustache, System.SysUtils;
|
|
||||||
|
|
||||||
{ TMyMustacheHelpers }
|
|
||||||
|
|
||||||
function MyHelper1(const aValue: TValue; const aParameters: TArray<string>): string;
|
function MyHelper1(const aValue: TValue; const aParameters: TArray<string>): string;
|
||||||
begin
|
begin
|
||||||
Result := aValue.ToString + ' (I''m The MyHelper1)';
|
Result := aValue.ToString + ' (I''m The MyHelper1)';
|
||||||
|
@ -12,6 +12,7 @@ uses
|
|||||||
Winapi.Windows,
|
Winapi.Windows,
|
||||||
{$ENDIF }
|
{$ENDIF }
|
||||||
IdHTTPWebBrokerBridge,
|
IdHTTPWebBrokerBridge,
|
||||||
|
TemplatePro,
|
||||||
MVCFramework.View.Renderers.TemplatePro,
|
MVCFramework.View.Renderers.TemplatePro,
|
||||||
Web.WebReq,
|
Web.WebReq,
|
||||||
Web.WebBroker,
|
Web.WebBroker,
|
||||||
@ -19,8 +20,7 @@ uses
|
|||||||
WebSiteControllerU in 'WebSiteControllerU.pas',
|
WebSiteControllerU in 'WebSiteControllerU.pas',
|
||||||
DAL in 'DAL.pas',
|
DAL in 'DAL.pas',
|
||||||
MyDataModuleU in '..\renders\MyDataModuleU.pas' {MyDataModule: TDataModule},
|
MyDataModuleU in '..\renders\MyDataModuleU.pas' {MyDataModule: TDataModule},
|
||||||
CustomTemplateProFiltersU in 'CustomTemplateProFiltersU.pas',
|
CustomTemplateProFiltersU in 'CustomTemplateProFiltersU.pas';
|
||||||
TemplatePro in '..\..\..\templatepro\TemplatePro.pas';
|
|
||||||
|
|
||||||
{$R *.res}
|
{$R *.res}
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ begin
|
|||||||
LServer.DefaultPort := APort;
|
LServer.DefaultPort := APort;
|
||||||
LServer.Active := True;
|
LServer.Active := True;
|
||||||
{$IFDEF MSWINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
//ShellExecute(0, 'open', PChar('http://localhost:' + inttostr(APort)), nil, nil, SW_SHOW);
|
ShellExecute(0, 'open', PChar('http://localhost:' + inttostr(APort)), nil, nil, SW_SHOW);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
LogI('Ctrl+C to stop the server');
|
LogI('Ctrl+C to stop the server');
|
||||||
WaitForTerminationSignal;
|
WaitForTerminationSignal;
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<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)'==''">Win32</Platform>
|
<Platform Condition="'$(Platform)'==''">Win64</Platform>
|
||||||
<TargetedPlatforms>1</TargetedPlatforms>
|
<TargetedPlatforms>3</TargetedPlatforms>
|
||||||
<AppType>Console</AppType>
|
<AppType>Console</AppType>
|
||||||
<ProjectName Condition="'$(ProjectName)'==''">ServerSideViewsTemplatePro</ProjectName>
|
<ProjectName Condition="'$(ProjectName)'==''">ServerSideViewsTemplatePro</ProjectName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@ -35,6 +35,12 @@
|
|||||||
<Cfg_1>true</Cfg_1>
|
<Cfg_1>true</Cfg_1>
|
||||||
<Base>true</Base>
|
<Base>true</Base>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win64)'!=''">
|
||||||
|
<Cfg_1_Win64>true</Cfg_1_Win64>
|
||||||
|
<CfgParent>Cfg_1</CfgParent>
|
||||||
|
<Cfg_1>true</Cfg_1>
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
|
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
|
||||||
<Cfg_2>true</Cfg_2>
|
<Cfg_2>true</Cfg_2>
|
||||||
<CfgParent>Base</CfgParent>
|
<CfgParent>Base</CfgParent>
|
||||||
@ -57,12 +63,20 @@
|
|||||||
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
|
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
|
||||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||||
<DCC_ExeOutput>.\bin</DCC_ExeOutput>
|
<DCC_ExeOutput>.\bin</DCC_ExeOutput>
|
||||||
<VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(ModuleName);FileDescription=$(ModuleName);ProductName=$(ModuleName)</VerInfo_Keys>
|
<VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
|
||||||
<Manifest_File>None</Manifest_File>
|
<Manifest_File>None</Manifest_File>
|
||||||
<DCC_UsePackage>DBXSqliteDriver;RESTComponents;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;frxe23;vclFireDAC;emsclientfiredac;DataSnapFireDAC;svnui;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;Intraweb;DBXOracleDriver;ipstudiowinwordxp;inetdb;FmxTeeUI;FireDACIBDriver;fmx;fmxdae;DelphiCookbookListViewAppearance;vclib;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;DataSnapCommon;emsclient;FireDACCommon;bdertl;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;frxTee23;JclDeveloperTools;vclie;CPortLibDXE;bindengine;DBXMySQLDriver;FireDACOracleDriver;CloudService;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonDriver;DataSnapClient;inet;bindcompdbx;IndyIPCommon;vcl;DBXSybaseASEDriver;IndyIPServer;IndySystem;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;FireDAC;Jcl;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;ipstudiowinclient;soaprtl;DbxCommonDriver;ibxpress;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;DTKANPRPackage;DBXSybaseASADriver;CustomIPTransport;vcldsnap;CodeSiteExpressPkg;SampleListViewMultiDetailAppearancePackage;bindcomp;appanalytics;ipstudiowin;DBXInformixDriver;officeXPrt;IndyIPClient;bindcompvcl;frxDB23;vcldbx;TeeUI;vclribbon;dbxcds;VclSmp;adortl;FireDACODBCDriver;JclVcl;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;IndyProtocols;frx23;JclContainers;fmxase;$(DCC_UsePackage)</DCC_UsePackage>
|
<DCC_UsePackage>DBXSqliteDriver;RESTComponents;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;frxe23;vclFireDAC;emsclientfiredac;DataSnapFireDAC;svnui;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;Intraweb;DBXOracleDriver;ipstudiowinwordxp;inetdb;FmxTeeUI;FireDACIBDriver;fmx;fmxdae;DelphiCookbookListViewAppearance;vclib;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;DataSnapCommon;emsclient;FireDACCommon;bdertl;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;frxTee23;JclDeveloperTools;vclie;CPortLibDXE;bindengine;DBXMySQLDriver;FireDACOracleDriver;CloudService;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonDriver;DataSnapClient;inet;bindcompdbx;IndyIPCommon;vcl;DBXSybaseASEDriver;IndyIPServer;IndySystem;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;FireDAC;Jcl;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;ipstudiowinclient;soaprtl;DbxCommonDriver;ibxpress;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;DTKANPRPackage;DBXSybaseASADriver;CustomIPTransport;vcldsnap;CodeSiteExpressPkg;SampleListViewMultiDetailAppearancePackage;bindcomp;appanalytics;ipstudiowin;DBXInformixDriver;officeXPrt;IndyIPClient;bindcompvcl;frxDB23;vcldbx;TeeUI;vclribbon;dbxcds;VclSmp;adortl;FireDACODBCDriver;JclVcl;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;IndyProtocols;frx23;JclContainers;fmxase;$(DCC_UsePackage)</DCC_UsePackage>
|
||||||
|
<AppDPIAwarenessMode>none</AppDPIAwarenessMode>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Base_Win64)'!=''">
|
<PropertyGroup Condition="'$(Base_Win64)'!=''">
|
||||||
<DCC_UsePackage>DBXSqliteDriver;RESTComponents;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;emsclientfiredac;DataSnapFireDAC;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;Intraweb;DBXOracleDriver;inetdb;FmxTeeUI;FireDACIBDriver;fmx;fmxdae;vclib;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;DataSnapCommon;emsclient;FireDACCommon;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;CloudService;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonDriver;DataSnapClient;inet;bindcompdbx;IndyIPCommon;vcl;DBXSybaseASEDriver;IndyIPServer;IndySystem;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;FireDAC;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;ipstudiowinclient;soaprtl;DbxCommonDriver;ibxpress;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;ipstudiowin;DBXInformixDriver;officeXPrt;IndyIPClient;bindcompvcl;TeeUI;vclribbon;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;IndyProtocols;fmxase;$(DCC_UsePackage)</DCC_UsePackage>
|
<DCC_UsePackage>DBXSqliteDriver;RESTComponents;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;emsclientfiredac;DataSnapFireDAC;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;Intraweb;DBXOracleDriver;inetdb;FmxTeeUI;FireDACIBDriver;fmx;fmxdae;vclib;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;DataSnapCommon;emsclient;FireDACCommon;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;CloudService;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonDriver;DataSnapClient;inet;bindcompdbx;IndyIPCommon;vcl;DBXSybaseASEDriver;IndyIPServer;IndySystem;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;FireDAC;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;ipstudiowinclient;soaprtl;DbxCommonDriver;ibxpress;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;ipstudiowin;DBXInformixDriver;officeXPrt;IndyIPClient;bindcompvcl;TeeUI;vclribbon;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;IndyProtocols;fmxase;$(DCC_UsePackage)</DCC_UsePackage>
|
||||||
|
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
|
||||||
|
<BT_BuildType>Debug</BT_BuildType>
|
||||||
|
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
||||||
|
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||||
|
<DCC_ExeOutput>.\bin</DCC_ExeOutput>
|
||||||
|
<Manifest_File>(None)</Manifest_File>
|
||||||
|
<AppDPIAwarenessMode>none</AppDPIAwarenessMode>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Cfg_1)'!=''">
|
<PropertyGroup Condition="'$(Cfg_1)'!=''">
|
||||||
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
|
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
|
||||||
@ -80,8 +94,9 @@
|
|||||||
<DCC_DynamicBase>false</DCC_DynamicBase>
|
<DCC_DynamicBase>false</DCC_DynamicBase>
|
||||||
<DCC_IntegerOverflowCheck>true</DCC_IntegerOverflowCheck>
|
<DCC_IntegerOverflowCheck>true</DCC_IntegerOverflowCheck>
|
||||||
<DCC_RangeChecking>true</DCC_RangeChecking>
|
<DCC_RangeChecking>true</DCC_RangeChecking>
|
||||||
<VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
|
</PropertyGroup>
|
||||||
<AppDPIAwarenessMode>none</AppDPIAwarenessMode>
|
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
|
||||||
|
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Cfg_2)'!=''">
|
<PropertyGroup Condition="'$(Cfg_2)'!=''">
|
||||||
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
|
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
|
||||||
@ -104,7 +119,6 @@
|
|||||||
<DesignClass>TDataModule</DesignClass>
|
<DesignClass>TDataModule</DesignClass>
|
||||||
</DCCReference>
|
</DCCReference>
|
||||||
<DCCReference Include="CustomTemplateProFiltersU.pas"/>
|
<DCCReference Include="CustomTemplateProFiltersU.pas"/>
|
||||||
<DCCReference Include="..\..\..\templatepro\TemplatePro.pas"/>
|
|
||||||
<BuildConfiguration Include="Base">
|
<BuildConfiguration Include="Base">
|
||||||
<Key>Base</Key>
|
<Key>Base</Key>
|
||||||
</BuildConfiguration>
|
</BuildConfiguration>
|
||||||
@ -140,6 +154,18 @@
|
|||||||
<Overwrite>true</Overwrite>
|
<Overwrite>true</Overwrite>
|
||||||
</Platform>
|
</Platform>
|
||||||
</DeployFile>
|
</DeployFile>
|
||||||
|
<DeployFile LocalName="bin\ServerSideViewsTemplatePro.exe" Configuration="Debug" Class="ProjectOutput">
|
||||||
|
<Platform Name="Win64">
|
||||||
|
<RemoteName>ServerSideViewsTemplatePro.exe</RemoteName>
|
||||||
|
<Overwrite>true</Overwrite>
|
||||||
|
</Platform>
|
||||||
|
</DeployFile>
|
||||||
|
<DeployFile LocalName="bin\ServerSideViewsTemplatePro.rsm" Configuration="Debug" Class="DebugSymbols">
|
||||||
|
<Platform Name="Win64">
|
||||||
|
<RemoteName>ServerSideViewsTemplatePro.rsm</RemoteName>
|
||||||
|
<Overwrite>true</Overwrite>
|
||||||
|
</Platform>
|
||||||
|
</DeployFile>
|
||||||
<DeployClass Name="AdditionalDebugSymbols">
|
<DeployClass Name="AdditionalDebugSymbols">
|
||||||
<Platform Name="OSX32">
|
<Platform Name="OSX32">
|
||||||
<Operation>1</Operation>
|
<Operation>1</Operation>
|
||||||
@ -1001,7 +1027,7 @@
|
|||||||
</Deployment>
|
</Deployment>
|
||||||
<Platforms>
|
<Platforms>
|
||||||
<Platform value="Win32">True</Platform>
|
<Platform value="Win32">True</Platform>
|
||||||
<Platform value="Win64">False</Platform>
|
<Platform value="Win64">True</Platform>
|
||||||
</Platforms>
|
</Platforms>
|
||||||
</BorlandProject>
|
</BorlandProject>
|
||||||
<ProjectFileVersion>12</ProjectFileVersion>
|
<ProjectFileVersion>12</ProjectFileVersion>
|
||||||
|
@ -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":"45","last_name":"45","age":45,"devices":["smartphone","laptop"],"guid":"A53742C5F79E4274ADBD61DE8E579368"}]
|
[{"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"}]
|
@ -4,9 +4,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row_fluid">
|
<div class="row_fluid">
|
||||||
<div class="col-sm-12">
|
|
||||||
<span>N.B. All these views are UTF-8 encoded with BOM</span>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-8 bg-primary">
|
<div class="col-sm-8 bg-primary">
|
||||||
<span>Powered by DMVCFramework</span>
|
<span>Powered by DMVCFramework</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -277,3 +277,4 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ type
|
|||||||
function RenderJSON(lViewEngine: TSynMustache; const JSON: UTF8String; Partials: TSynMustachePartials;
|
function RenderJSON(lViewEngine: TSynMustache; const JSON: UTF8String; Partials: TSynMustachePartials;
|
||||||
Helpers: TSynMustacheHelpers; OnTranslate: TOnStringTranslate; EscapeInvert: boolean): UTF8String; virtual;
|
Helpers: TSynMustacheHelpers; OnTranslate: TOnStringTranslate; EscapeInvert: boolean): UTF8String; virtual;
|
||||||
public
|
public
|
||||||
procedure Execute(const ViewName: string; const OutputStream: TStream); override;
|
procedure Execute(const ViewName: string; const Builder: TStringBuilder); override;
|
||||||
constructor Create(const AEngine: TMVCEngine; const AWebContext: TWebContext;
|
constructor Create(const AEngine: TMVCEngine; const AWebContext: TWebContext;
|
||||||
const AViewModel: TMVCViewDataObject;
|
const AViewModel: TMVCViewDataObject;
|
||||||
const AContentType: string); override;
|
const AContentType: string); override;
|
||||||
@ -131,12 +131,11 @@ begin
|
|||||||
Result := lViewEngine.RenderJSON(JSON, Partials, Helpers, OnTranslate, EscapeInvert);
|
Result := lViewEngine.RenderJSON(JSON, Partials, Helpers, OnTranslate, EscapeInvert);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMVCMustacheViewEngine.Execute(const ViewName: string; const OutputStream: TStream);
|
procedure TMVCMustacheViewEngine.Execute(const ViewName: string; const Builder: TStringBuilder);
|
||||||
var
|
var
|
||||||
lViewFileName: string;
|
lViewFileName: string;
|
||||||
lViewTemplate: UTF8String;
|
lViewTemplate: UTF8String;
|
||||||
lViewEngine: TSynMustache;
|
lViewEngine: TSynMustache;
|
||||||
lSW: TStreamWriter;
|
|
||||||
begin
|
begin
|
||||||
PrepareModels;
|
PrepareModels;
|
||||||
lViewFileName := GetRealFileName(ViewName);
|
lViewFileName := GetRealFileName(ViewName);
|
||||||
@ -144,12 +143,7 @@ begin
|
|||||||
raise EMVCFrameworkViewException.CreateFmt('View [%s] not found', [ViewName]);
|
raise EMVCFrameworkViewException.CreateFmt('View [%s] not found', [ViewName]);
|
||||||
lViewTemplate := StringToUTF8(TFile.ReadAllText(lViewFileName, TEncoding.UTF8));
|
lViewTemplate := StringToUTF8(TFile.ReadAllText(lViewFileName, TEncoding.UTF8));
|
||||||
lViewEngine := TSynMustache.Parse(lViewTemplate);
|
lViewEngine := TSynMustache.Parse(lViewTemplate);
|
||||||
lSW := TStreamWriter.Create(OutputStream);
|
Builder.Append(UTF8Tostring(RenderJSON(lViewEngine, FJSONModelAsString, fPartials, fHelpers, nil, false)));
|
||||||
try
|
|
||||||
lSW.Write(UTF8Tostring(RenderJSON(lViewEngine, FJSONModelAsString, fPartials, fHelpers, nil, false)));
|
|
||||||
finally
|
|
||||||
lSW.Free;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMVCMustacheViewEngine.LoadHelpers;
|
procedure TMVCMustacheViewEngine.LoadHelpers;
|
||||||
|
@ -34,7 +34,7 @@ type
|
|||||||
{ This class implements the TemplatePro view engine for server side views }
|
{ This class implements the TemplatePro view engine for server side views }
|
||||||
TMVCTemplateProViewEngine = class(TMVCBaseViewEngine)
|
TMVCTemplateProViewEngine = class(TMVCBaseViewEngine)
|
||||||
public
|
public
|
||||||
procedure Execute(const ViewName: string; const OutputStream: TStream); override;
|
procedure Execute(const ViewName: string; const Builder: TStringBuilder); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -73,8 +73,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMVCTemplateProViewEngine.Execute(const ViewName: string;
|
procedure TMVCTemplateProViewEngine.Execute(const ViewName: string; const Builder: TStringBuilder);
|
||||||
const OutputStream: TStream);
|
|
||||||
var
|
var
|
||||||
lTP: TTProCompiler;
|
lTP: TTProCompiler;
|
||||||
lViewFileName: string;
|
lViewFileName: string;
|
||||||
@ -120,7 +119,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
lCompiledTemplate.AddFilter('json', DumpAsJSONString);
|
lCompiledTemplate.AddFilter('json', DumpAsJSONString);
|
||||||
//lCompiledTemplate.DumpToFile(TPath.Combine(AppPath, 'TProDump.txt'));
|
//lCompiledTemplate.DumpToFile(TPath.Combine(AppPath, 'TProDump.txt'));
|
||||||
TStringStream(OutputStream).WriteString(lCompiledTemplate.Render);
|
Builder.Append(lCompiledTemplate.Render);
|
||||||
except
|
except
|
||||||
on E: ETProException do
|
on E: ETProException do
|
||||||
begin
|
begin
|
||||||
|
@ -1286,7 +1286,7 @@ type
|
|||||||
const AContentType: string); overload; virtual;
|
const AContentType: string); overload; virtual;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
procedure Execute(const ViewName: string; const OutputStream: TStream); virtual; abstract;
|
procedure Execute(const ViewName: string; const Builder: TStringBuilder); virtual; abstract;
|
||||||
|
|
||||||
property ViewName: string read FViewName;
|
property ViewName: string read FViewName;
|
||||||
property WebContext: TWebContext read FWebContext;
|
property WebContext: TWebContext read FWebContext;
|
||||||
@ -4149,9 +4149,9 @@ end;
|
|||||||
|
|
||||||
function TMVCController.GetRenderedView(const AViewNames: TArray<string>; const JSONModel: TJSONObject): string;
|
function TMVCController.GetRenderedView(const AViewNames: TArray<string>; const JSONModel: TJSONObject): string;
|
||||||
var
|
var
|
||||||
lView: TMVCBaseViewEngine; lViewName: string; lStrStream: TStringStream;
|
lView: TMVCBaseViewEngine; lViewName: string; lStrStream: TStringBuilder;
|
||||||
begin
|
begin
|
||||||
lStrStream := TStringStream.Create('', TEncoding.UTF8);
|
lStrStream := TStringBuilder.Create;
|
||||||
try
|
try
|
||||||
lView := FEngine.ViewEngineClass.Create(Engine, Context, FViewModel, JSONModel, ContentType);
|
lView := FEngine.ViewEngineClass.Create(Engine, Context, FViewModel, JSONModel, ContentType);
|
||||||
try
|
try
|
||||||
@ -4162,8 +4162,7 @@ begin
|
|||||||
finally
|
finally
|
||||||
lView.Free;
|
lView.Free;
|
||||||
end;
|
end;
|
||||||
lStrStream.Position := 0;
|
Result := lStrStream.ToString;
|
||||||
Result := lStrStream.DataString;
|
|
||||||
finally
|
finally
|
||||||
lStrStream.Free;
|
lStrStream.Free;
|
||||||
end;
|
end;
|
||||||
@ -4792,9 +4791,9 @@ end;
|
|||||||
|
|
||||||
function TMVCController.GetRenderedView(const AViewNames: TArray<string>): string;
|
function TMVCController.GetRenderedView(const AViewNames: TArray<string>): string;
|
||||||
var
|
var
|
||||||
lView: TMVCBaseViewEngine; lViewName: string; lStrStream: TStringStream;
|
lView: TMVCBaseViewEngine; lViewName: string; lStrStream: TStringBuilder;
|
||||||
begin
|
begin
|
||||||
lStrStream := TStringStream.Create('', TEncoding.UTF8);
|
lStrStream := TStringBuilder.Create;
|
||||||
try
|
try
|
||||||
lView := FEngine.ViewEngineClass.Create(
|
lView := FEngine.ViewEngineClass.Create(
|
||||||
Engine, Context,
|
Engine, Context,
|
||||||
@ -4808,8 +4807,7 @@ begin
|
|||||||
finally
|
finally
|
||||||
lView.Free;
|
lView.Free;
|
||||||
end;
|
end;
|
||||||
lStrStream.Position := 0;
|
Result := lStrStream.ToString;
|
||||||
Result := lStrStream.DataString;
|
|
||||||
finally
|
finally
|
||||||
lStrStream.Free;
|
lStrStream.Free;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user