File: view.html

package info (click to toggle)
tempura 0.1.2r3-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 400 kB
  • ctags: 399
  • sloc: ruby: 1,826; makefile: 84; xml: 80
file content (70 lines) | stat: -rw-r--r-- 2,095 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<html>
<head>
<meta http-equiv="content-type" content="text/html" />
<title>Tempura - TEMPlate Utility for Ruby Application</title>
</head>
<body>
<h1>Tempura - TEMPlate Utility for Ruby Application</h1>

<!-- switch a view template -->
[English]
[<a href="dummy" _event_="lang//lang==>%(ja)">Japanese</a>]

<!-- view of model -->
<hr/><h2>Model</h2>
<table width="100%"><tr>

<!-- as table -->
<td width="50%">
<h3>View as Table</h3>
<table frame="box" border="1">
<tr><th>index</th><th>name</th><th>price</th></tr>
<tr _nil_=""><td>1</td><td>pencil</td><td>12</td></tr>
<tr _nil_=""><td>2</td><td>eraser</td><td>3</td></tr>
<tr _nil_=""><td>3</td><td>notebook</td><td>15</td></tr>
<tr _block_="@model.items//each_with_index//item,index"><td _child_="index+1">(index)</td><td _child_="item.name">(name)</td><td _child_="item.price">(price)</td></tr>
<tr><td>&nbsp;</td><td>Amount</td><td style="font-weight:bold" _child_="@model.amount">(amount)</td></tr>
</table>
</td>

<!-- as list -->
<td width="50%">
<h3>View as List</h3>
<ul>
<li _nil_=""><span>pencil</span> - <span>12</span></li>
<li _nil_=""><span>eraser</span> - <span>3</span></li>
<li _nil_=""><span>notebook</span> - <span>15</span></li>
<li _block_="@model.items//each//i"><span _self_="i.name">(name)</span> - <span _self_="i.price">(price)</span></li>
</ul>
Amount: <span _self_="@model.amount">(amount)</span>
</td>

</tr></table>

<!-- user action -->
<hr/><h2>User Action</h2>

<!-- add -->
<form _event_="add">
Name: <input type="text" name="name" />
Price: <input type="text" name="price" />
<input type="submit" value="add" />
</form>

<!-- delete -->
<form _event_="del">
Name: <select name="name">
<option value="--" selected="true">--</option>
<option _nil_="" value="pencil">pencil</option>
<option _nil_="" value="eraser">eraser</option>
<option _nil_="" value="notebook">notebook</option>
<option _block_="@model.items//each//i" _attr_value="i.name" _child_="i.name">(name)</option>
</select>
<input type="submit" value="delete" />
</form>

<!-- reset -->
<a href="dummy" _event_="reset">clear</a>

</body>
</html>