JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Thorax Example</title>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.0/jquery-1.8.0.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0.beta6/handlebars.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.3/underscore-min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.2/backbone-min.js"></script>
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.0.4/js/bootstrap.min.js"></script>
<script src="https://raw.github.com/walmartlabs/thorax/master/dist/thorax.js"></script>
<script src="https://raw.github.com/gist/3504663/d1e6321e9fdb69ff47d636eab5df5e52acb64ae0/gistfile1.txt"></script>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.0.4/css/bootstrap-combined.min.css"/>
</head>
<body>
</body>
</html>
CoffeeScript
# sample data declared at
# https://raw.github.com/gist/3504663/d1e6321e9fdb69ff47d636eab5df5e52acb64ae0/gistfile1.txt
mittens = Thorax.Collections.Cats.instance.at(0)
TodosView = Thorax.View.extend
name: 'todos'
title: mittens.get('name') + " Todos"
todos: mittens.get('todos')
events:
'change input[type="checkbox"]': (event) ->
target = $(event.target)
target.model().set done: !!target.attr('checked')
'submit form': (event) ->
event.preventDefault()
input = @$('input[type="text"]')
@todos.add item: input.val()
input.val('')
template: """
<h3>{{title}}</h3>
{{#collection todos tag="ul"}}
<li{{#if done}} class="done"{{/if}}>
<input type="checkbox" name="done"{{#if done}} checked="checked"{{/if}}>
<span>{{item}}</span>
</li>
{{/collection}}
<form class="form-inline">
<input type="text">
<input type="submit" value="Add" class="btn btn-primary">
</form>
"""
FreezeView = TodosView.extend
name: 'freeze'
title: "Freezable Todos"
callFreeze: (event) ->
$(event.target).html('So very cold...').addClass('disabled')
@freeze dom: false
template: """
{{super}}
{{#button "callFreeze" class="btn btn-small"}}Freeze{{/button}}
"""
Application.setView new FreezeView