Updated TemplatePro

This commit is contained in:
Daniele Teti 2024-08-15 16:08:46 +02:00
parent a452ecd433
commit 986b6186c4
8 changed files with 501 additions and 115 deletions

View File

@ -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":"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"}]

View File

@ -11,7 +11,7 @@
<div class="row_fluid">
<div class="col-sm-12">
<form class="form form-horizontal" id="myForm" name="myForm" method="POST" action="/people">
<input type="hidden" value="{{person.guid}}" name="guid">
<input type="hidden" value="{{:person.guid}}" name="guid">
<div class="row">
<div class="col-sm-offset-2 col-sm-8">
{{if(!person)}}
@ -26,7 +26,7 @@
<div class="form-group">
<label for="first_name" class="col-sm-2 control-label">First name</label>
<div class="col-sm-4">
<input type="text" value="{{person.FirstName}}" class="form-control" id="first_name" placeholder="First name" name="first_name">
<input type="text" value="{{:person.FirstName}}" class="form-control" id="first_name" placeholder="First name" name="first_name">
</div>
</div>
</div>
@ -35,7 +35,7 @@
<div class="form-group">
<label for="last_name" class="col-sm-2 control-label">Last name</label>
<div class="col-sm-4">
<input type="text" value="{{person.LastName}}" class="form-control" id="last_name" placeholder="Last name" name="last_name">
<input type="text" value="{{:person.LastName}}" class="form-control" id="last_name" placeholder="Last name" name="last_name">
</div>
</div>
</div>
@ -44,7 +44,7 @@
<div class="form-group">
<label for="age" class="col-sm-2 control-label">Age</label>
<div class="col-sm-4">
<input type="number" value="{{person.Age}}" class="form-control" id="age" placeholder="Age" name="age">
<input type="number" value="{{:person.Age}}" class="form-control" id="age" placeholder="Age" name="age">
</div>
</div>
</div>
@ -55,8 +55,8 @@
<label for="devices" class="col-sm-2 control-label">Devices</label>
<div class="col-sm-4">
<select name="devices" multiple class="form-control">
{{loop(devices)}}
<option value="{{devices.DeviceName}}" {{if(devices.Selected)}}selected{{endif}}>{{devices.DeviceName}}</option>
{{loop(devices) as device}}
<option value="{{:device.DeviceName}}" {{if(device.Selected)}}selected{{endif}}>{{:device.DeviceName}}</option>
{{endloop}}
</select>
<span style="font-size: 80%">(Ctrl+Click to select multiple devices)</span>

View File

@ -1 +1 @@
{{people.FirstName}}, {{people.LastName}}
{{:person.FirstName}}, {{:person.LastName}}

View File

@ -1,2 +1,2 @@
{{loop(people)}}{{people.guid}};"{{people.FirstName}}";"{{people.LastName}}";{{people.Age}}
{{loop(people) as person}}{{:person.guid}};"{{:person.FirstName}}";"{{:person.LastName}}";{{:person.Age}}
{{endloop}}

View File

@ -13,12 +13,12 @@
</thead>
<tbody>
{{if(people)}}
{{loop(people)}}
{{loop(people) as person}}
<tr>
<td>{{people.@@index}}</td>
<td>{{people.FirstName}}</td>
<td>{{people.LastName}}</td>
<td>{{people.Age}}</td>
<td>{{:person.@@index}}</td>
<td>{{:person.FirstName}}</td>
<td>{{:person.LastName}}</td>
<td>{{:person.Age}}</td>
<td class="text-right">
{{include("view_person_link.tpro")}}
</td>

View File

@ -40,8 +40,8 @@ This page is a showcase for all the TemplatePro features usable from DMVCFramewo
{{if(people)}}
<div>No People Found</div>
{{else}}
{{loop(people)}}
<div>{{people.@@index}}. {{people.FirstName}} {{people.LastName}}</div>
{{loop(people) as person}}
<div>{{:person.@@index}}. {{:person.FirstName}} {{:person.LastName}}</div>
{{endloop}}
{{endif}}
</div>
@ -53,8 +53,8 @@ This page is a showcase for all the TemplatePro features usable from DMVCFramewo
{{if(!people2)}}
<div>No People Found</div>
{{else}}
{{loop(people2)}}
<div>{{people2.@@index}}. {{people2.FirstName}} {{people2.LastName}}</div>
{{loop(people2) as person}}
<div>{{:person.@@index}}. {{:person.FirstName}} {{:person.LastName}}</div>
{{endloop}}
{{endif}}
</div>
@ -64,7 +64,7 @@ This page is a showcase for all the TemplatePro features usable from DMVCFramewo
<h2 class="section">Avoid HTML automatic escaping using {{{variablename$}} (put a $ after variable name)</h2>
<div class="box">
{{myobj.rawhtml$}}
{{:myobj.rawhtml$}}
<br>
<blockquote >Check source code to know how to escape curly braces</blockquote >
</div>
@ -75,7 +75,7 @@ This page is a showcase for all the TemplatePro features usable from DMVCFramewo
<div>
<h2><pre>Using include("partial_person.tpro")</pre></h2>
<ul>
{{loop(people)}}
{{loop(people) as person}}
<li>{{include("partial_person.tpro")}}</li>
{{endloop}}
</ul>
@ -86,12 +86,12 @@ 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>
{{loop(people)}}
<div>{{people.@@index}}. {{people.first_name|uppercase}} {{people.last_name|uppercase}}</div>
{{loop(people) as person}}
<div>{{:person.@@index}}. {{:person.first_name|uppercase}} {{:person.last_name|uppercase}}</div>
{{endloop}}
</div>
<hr>

View File

@ -1 +1 @@
<a class="btn btn-default" href="/edit/{{people.guid}}"><span class="glyphicon glyphicon-pencil"></span> View</a>
<a class="btn btn-default" href="/edit/{{:person.guid}}"><span class="glyphicon glyphicon-pencil"></span> View</a>

File diff suppressed because it is too large Load Diff