Skip to content

Instantly share code, notes, and snippets.

@yansern
Created June 6, 2014 10:22
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 yansern/4ff8478d179689960f15 to your computer and use it in GitHub Desktop.
Save yansern/4ff8478d179689960f15 to your computer and use it in GitHub Desktop.
Selector Function Extension
$.Controller("Comment",
{
defaultOptions: {
"{comment}": "[data-comment]"
}
},
function(self) { return {
comment: {
remove: function(id) {
// Remove comment
self.comment()
.where("id", id)
.remove();
// Trigger commentRemove
self.trigger("commentRemove", [id]);
}
},
"{deleteButton} click": function(deleteButton) {
var id = self.comment.of(deleteButton).data("id");
self.comment.remove(id);
}
}};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment