Files
sdk/utils/tests/template/top_searches_css.tmpl
T
terry@google.com cea0d08c1d Template bug fixes and new features.
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
2012-03-19 23:12:37 +00:00

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},&nbsp;</span>
<span>age&nbsp;=&nbsp;</span>
<span>${age}</span>
</div>
<div>
${#each searches search}
<div>query=${search.query},&nbsp;rank=${search.rank},&nbsp;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>
}