bebraw
3/29/2013 - 4:06 PM

transparency_demo.js

var context, directives;

context = {
  "header": "Colors",
  "items": [
      {"name": "red", "first": true, "url": "#Red"},
      {"name": "green", "link": true, "url": "#Green"},
      {"name": "blue", "link": true, "url": "#Blue"}
  ],
  "empty": false
};

directives = {
    items: {
        name: {
            href: function() {
                return this.url;
            },
            html: function() {
                if(this.first) {
                    return '<strong>' + this.name + '</strong>';
                }
            }
        }
    }
};

$('.container').render(context, directives);