Guest User

Untitled

a guest
Jan 19th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. diff --git a/js/intermap/models/Interaction.js b/js/intermap/models/Interaction.js
  2. index 5b74c7b..c10c4e0 100644
  3. --- a/js/intermap/models/Interaction.js
  4. +++ b/js/intermap/models/Interaction.js
  5. @@ -7,7 +7,7 @@ var Interaction = Backbone.Model.extend({
  6. comment: ''
  7. },
  8. initialize: function(args) {
  9. - _.bindAll(this, 'hasTerm');
  10. + _.bindAll(this, 'hasTerm', 'destroy');
  11.  
  12. if(args.terms && args.terms.length < 2) {
  13. throw 'You must specify two terms to create an interaction.';
  14. @@ -30,8 +30,14 @@ var Interaction = Backbone.Model.extend({
  15.  
  16. _.each(args.terms, function(term){
  17. term.addInteraction(self);
  18. + term.bind('destroy', self.destroy);
  19. });
  20. - }
  21. + }
  22. + },
  23. + destroy: function(options) {
  24. + //if(this.collection) this.collection.remove(this);
  25. + this.trigger('destroy', this, this.collection, options);
  26. + return this;
  27. },
  28. getTerms: function() {
  29. return [this.get('termA'), this.get('termB')];
  30. diff --git a/js/intermap/models/Term.js b/js/intermap/models/Term.js
  31. index f32b991..a4744a7 100644
  32. --- a/js/intermap/models/Term.js
  33. +++ b/js/intermap/models/Term.js
  34. @@ -10,20 +10,12 @@ Intermap.Term = Backbone.Model.extend({
  35. sortOrder: 0
  36. },
  37. initialize: function(){
  38. - _.bindAll(this, '_onDestroy', 'updateDegreeCentrality');
  39. + _.bindAll(this, 'updateDegreeCentrality');
  40.  
  41. this.set({
  42. interactions: [],
  43. collections: []
  44. });
  45. - this.bind('destroy', this._onDestroy);
  46. - },
  47. - _onDestroy: function() {
  48. - var interactions = this.get('interactions');
  49. -
  50. - _.each(interactions, function(interaction) {
  51. - interaction.trigger('remove');
  52. - });
  53. },
  54. _termTextPresent: function(termText){
  55. var self = this;
  56. diff --git a/store b/store
  57. index f65cc56..1934ce6 160000
  58. --- a/store
  59. +++ b/store
  60. @@ -1 +1 @@
  61. -Subproject commit f65cc5627875a036160dccf71b6528055dd7fce4
  62. +Subproject commit 1934ce6f4cabc413a24fbc7e26e1c3696426b54b-dirty
Add Comment
Please, Sign In to add comment