Skip to content

Instantly share code, notes, and snippets.

@rubenspgcavalcante
Last active August 29, 2015 14:00
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 rubenspgcavalcante/11096271 to your computer and use it in GitHub Desktop.
Save rubenspgcavalcante/11096271 to your computer and use it in GitHub Desktop.
/**
* The card view
* @extends {maria.ElementView}
*/
SL.MVC.CardView = {};
SL.MVC.CardTemplate = SL.Utils.Template.load("card");
maria.ElementView.subclass(SL.MVC, "CardView", {
uiActions: {
'dragStop .card': 'onDragStop'
},
properties: {
buildData: function() {
var $templ = $(this.find(""));
var cardSvg = SL.App.cardFactory.getCardSVG(this.getModel());
$templ.html(cardSvg);
$templ.draggable({
stop: function(ev){
/*
* Triggers when the user drops the card
*/
this.dispatchEvent(new Event('dragStop')); // this === ev.currentTarget
}
});
},
update: function(){
this.buildData();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment