cea0d08c1d
Fixed textnode bug, whitespace was being removed. Added added local name for #with and #each. Form of ${#each list [localName]} and ${#with object [localNme]} Added ability to call another template (located in the same tmpl file). Form is ${#templateName(parms)}
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9728009
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5665 260f80e4-7a28-3924-810f-c04153c831b5
50 lines
1.1 KiB
Cheetah
50 lines
1.1 KiB
Cheetah
template TopSearches(Person person, var searches) {
|
|
css {
|
|
.metrics-item {
|
|
font-family: arial;
|
|
background-color: lightgray;
|
|
margin-left: 10px;
|
|
border-bottom: 1px solid white;
|
|
}
|
|
.total-hits {
|
|
position: absolute;
|
|
left: 100px;
|
|
}
|
|
}
|
|
<div>
|
|
${#with person}
|
|
<div>
|
|
<span>${name}, </span>
|
|
<span>age = </span>
|
|
<span>${age}</span>
|
|
</div>
|
|
<div>
|
|
${#each searches search}
|
|
<div>query=${search.query}, rank=${search.rank}, total=${search.total}</div>
|
|
${#each search.metrics metric}
|
|
<div class="metrics-item">
|
|
<span>${metric.country}</span>
|
|
<span class="total-hits">${metric.quantity}</span>
|
|
</div>
|
|
${/each}
|
|
${/each}
|
|
</div>
|
|
${/with}
|
|
</div>
|
|
}
|
|
|
|
template NameEntry(String name, int age) {
|
|
css {
|
|
.name-item {
|
|
font-size: 18pt;
|
|
font-weight: bold;
|
|
}
|
|
}
|
|
<div var=topDiv class="name-item" attr="test" attr1=test1 attr2='test2' attr3=test3>
|
|
<span var=spanElem>${name}</span>
|
|
<span> - </span>
|
|
<span>${age}</span>
|
|
</div>
|
|
}
|
|
|