Created
August 13, 2015 18:37
-
-
Save LinzardMac/29151266367250bf4447 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
/* backbone functions for views */ | |
render: function() { | |
var compat = this.model.get('compat'); | |
if ( ! compat || ! compat.item ) { | |
return; | |
} | |
this.views.detach(); | |
this.$el.html( compat.item ); | |
this.views.render(); | |
return this; | |
}, | |
save: function( event ) { | |
var data = {}; | |
if ( event ) { | |
event.preventDefault(); | |
} | |
_.each( this.$el.serializeArray(), function( pair ) { | |
data[ pair.name ] = pair.value; | |
}); | |
this.controller.trigger( 'attachment:compat:waiting', ['waiting'] ); | |
this.model.saveCompat( data ).always( _.bind( this.postSave, this ) ); | |
}, | |
postSave: function() { | |
this.controller.trigger( 'attachment:compat:ready', ['ready'] ); | |
} | |
/* basic .on() test code */ | |
jQuery(document).on('click', 'a', function(event) { | |
event.preventDefault() | |
alert('hey'); | |
var input = jQuery('input'); | |
input.css('background-color' , 'red'); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment