Skip to content

Instantly share code, notes, and snippets.

@Paxa
Created September 2, 2010 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Paxa/562169 to your computer and use it in GitHub Desktop.
Save Paxa/562169 to your computer and use it in GitHub Desktop.
$('some-link').clk(function(el, event) {
Footer.render('my-friends', Profile.id);
});
var Present = {
id: function(present_id, callback){
if (var present = this.getCached(present_id)) {
callback(present);
} else {
this.fetch(present_id, callback);
}
}
};
Template.register('my-friends', {
main: function(friends){
return
['#someblock', {bind: [this, 'container']}, this.renderCollection(this.friend, friends) || this.render(this.emptyFriends)];
},
friend: function(friend){
return
['.user.small',
['%img.userpic.small', {'src': friend.picture.small}],
['a', {clk: this.showFriend(friend), store: ['frien_obj', friend]}, friend.full_name]
];
},
emptyFriends: function () {
return ['a.no_friends', {clk: this.allPeople}, 'Find friends'];
},
// this will be wrapped to catch result
render: function(friends){
this.renderMain(this.main);
// this.result -- will be result node
// some logic after rendering
},
showFriend: function(friend) {
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment