Last active
December 15, 2015 01:19
-
-
Save airportyh/5178916 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function ITEM_VIEW(){ with(BindUp) { return ( | |
| SECTION({id: 'item-view'}, | |
| H2($('name'), | |
| IMG({ | |
| src: $('imageURL'), | |
| alt: 'Side-view shot' | |
| }), | |
| LABEL('Price'), SPAN($('price')), | |
| SECTION( | |
| { | |
| id: 'reviews', | |
| style: { | |
| display: $ifelse( | |
| 'reviews.length', | |
| 'block', 'none') | |
| } | |
| }, | |
| UL( | |
| $each('reviews', | |
| LI( | |
| H3($('title')), | |
| P($('text')) | |
| ) | |
| ) | |
| ) | |
| ) | |
| ) | |
| )}} | |
| var item = { | |
| name: 'Big Huge Muffin', | |
| imageURL: 'http://s3.amazon.com/.../big_hugh_muffin.jpg', | |
| price: 12.99, | |
| reviews: [ | |
| ... | |
| ] | |
| } | |
| var view = ITEM_VIEW().bind(item) | |
| view.renderTo(document.body) | |
| item.price = 14.99 | |
| view.update() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment