Skip to content

Instantly share code, notes, and snippets.

@jamiely
Created September 27, 2011 14:59
Show Gist options
  • Select an option

  • Save jamiely/1245279 to your computer and use it in GitHub Desktop.

Select an option

Save jamiely/1245279 to your computer and use it in GitHub Desktop.
intermap.diff
diff --git a/js/intermap/models/Interaction.js b/js/intermap/models/Interaction.js
index 5b74c7b..c10c4e0 100644
--- a/js/intermap/models/Interaction.js
+++ b/js/intermap/models/Interaction.js
@@ -7,7 +7,7 @@ var Interaction = Backbone.Model.extend({
comment: ''
},
initialize: function(args) {
- _.bindAll(this, 'hasTerm');
+ _.bindAll(this, 'hasTerm', 'destroy');
if(args.terms && args.terms.length < 2) {
throw 'You must specify two terms to create an interaction.';
@@ -30,8 +30,14 @@ var Interaction = Backbone.Model.extend({
_.each(args.terms, function(term){
term.addInteraction(self);
+ term.bind('destroy', self.destroy);
});
- }
+ }
+ },
+ destroy: function(options) {
+ //if(this.collection) this.collection.remove(this);
+ this.trigger('destroy', this, this.collection, options);
+ return this;
},
getTerms: function() {
return [this.get('termA'), this.get('termB')];
diff --git a/js/intermap/models/Term.js b/js/intermap/models/Term.js
index f32b991..a4744a7 100644
--- a/js/intermap/models/Term.js
+++ b/js/intermap/models/Term.js
@@ -10,20 +10,12 @@ Intermap.Term = Backbone.Model.extend({
sortOrder: 0
},
initialize: function(){
- _.bindAll(this, '_onDestroy', 'updateDegreeCentrality');
+ _.bindAll(this, 'updateDegreeCentrality');
this.set({
interactions: [],
collections: []
});
- this.bind('destroy', this._onDestroy);
- },
- _onDestroy: function() {
- var interactions = this.get('interactions');
-
- _.each(interactions, function(interaction) {
- interaction.trigger('remove');
- });
},
_termTextPresent: function(termText){
var self = this;
diff --git a/store b/store
index f65cc56..1934ce6 160000
--- a/store
+++ b/store
@@ -1 +1 @@
-Subproject commit f65cc5627875a036160dccf71b6528055dd7fce4
+Subproject commit 1934ce6f4cabc413a24fbc7e26e1c3696426b54b-dirty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment