JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://raw.github.com/mikeric/rivets/v0.3.8/lib/rivets.min.js"></script>
<div id="editItemDialog" data-modal="store.ActiveItem">
<a data-on-click="store:ClearActiveItem" href="#">close - works</a>
<div data-each-item="store.ActiveItem | toArray">
<div>
<label>name:</label><input data-value="item.Name < store.ActiveItem"/>
</div>
<div>
<label>price:</label><input data-value="item.Price < store.ActiveItem"/>
</div>
<div>
<label>description:</label><textarea data-value="item.Description < store.ActiveItem"></textarea>
</div>
</div>
</div>
CoffeeScript
# Include https://raw.github.com/mikeric/rivets/v0.3.8/lib/rivets.min.js
class StoreModel
ActiveItem:
Name: 'Car'
Price: 123
Description: 'A lovely blue vehicle'
ClearActiveItem: ->
alert 'Click!'
storeInstance = new StoreModel
rivets.configure
adapter:
subscribe: (obj, keypath, callback) ->
# Our simple model does not support subscriptions
unsubscribe: (obj, keypath, callback) ->
# As above
read: (obj, keypath) ->
return obj[keypath]
publish: (obj, keypath, value) ->
obj[keypath] = value
rivets.formatters.toArray = (value) -> [value]
rivets.bind $('#editItemDialog'), store: storeInstance