react-templates/playground/samples/todo.rt

21 lines
943 B
Plaintext
Raw Normal View History

2014-12-02 17:59:03 +01:00
<div>
2014-12-30 09:42:31 +01:00
<strong>{_.filter(this.state.todos, {done:true}).length}</strong>
done,
<strong>{_.filter(this.state.todos, {done:false}).length}</strong>
pending
2014-12-02 17:59:03 +01:00
<br/>
<div rt-repeat="todo in this.state.todos" key="{todo.key}">
2014-12-30 09:42:31 +01:00
<img src="img/samples/delete.png"
onClick="()=>this.remove(todo)"
title="Remove Todo"
style="cursor:pointer"/>
<input type="checkbox" checked="{todo.done}"
onChange="()=>this.toggleChecked(todoIndex)"/>
2014-12-02 17:59:03 +01:00
<span style="text-decoration: {todo.done ? 'line-through': 'none'}">{todo.value}</span>
</div>
2014-12-30 09:42:31 +01:00
<input key="myinput" style="width:130px" type="text"
onKeyDown="(e) => if (e.keyCode == 13) { e.preventDefault(); this.add(); }"
valueLink="{this.linkState('edited')}"/>
2014-12-02 17:59:03 +01:00
<button onClick="()=>this.add()">Add</button><br/>
<button onClick="()=>this.clearDone()">Clear done</button>
</div>