Commit fd4259edef1faa91035a82db79ddf978f7db0e1c

  • avatar
  • arvind
  • Mon Sep 15 15:26:44 IST 2014
Fixing annotation remaining editable after swt'ing.
  
114114 initialize: function(options) {
115115 this.$el = $('#img-annotation-wrapper');
116116 this.listenTo(this.collection, 'add', this.render);
117 this.listenTo(this.collection, 'change', this.render);
117 // this.listenTo(this.collection, 'change', this.render);
118118 var self = this;
119119
120120 // attach event handlers to the anno object
170170 this.collection.each(this.render, this);
171171 },
172172 showSwtHelp: function(annotation) {
173 var self = swtr.imgAnnoView;//TODO: figure out how we can bind the scope when this func is called as a callback
173 var self = swtr.imgAnnoView;
174 //TODO: figure out how we can bind the scope when this func is called as a callback
174175 self.helpview.step(3);
175176 $('#sweet').show();
176177 },
  
5151 },
5252 render: function() {
5353 console.log('sweetsview rendering');
54 debugger;
54// debugger;
5555 $('#sweet-list').html('<h4>These are your sweet annotations!</h4>');
5656 _.each(this.collection.models, function(swt) {
5757 if(swt.has('id')) {
9595 postSweets: function(event) {
9696 event.preventDefault();
9797 console.log('posting swts');
98 debugger;
98// debugger;
9999 var appView = swtr.appView;
100100 var self = this;
101101 this.helpview.step(5);
104104 this.collection.post({
105105 success: function(collection, response) {
106106 console.log('updated', collection, response);
107 anno.reset();
108 anno.makeAnnotatable($("#annotatable-img")[0]);
109 swtr.imgAnnoView.renderWith();
110 // _.each(collection, function(k) {
111 // anno.removeAnnotation(k['how']);
112 // });
107113 swtr.sweets.add(collection, {merge: true});
108114 console.log('new swtr coll', swtr.sweets);
109115 appView.$overlay.hide();
229229 sweet: function(event) {
230230 event.preventDefault();
231231 console.log('sweeting');
232 debugger;
232// debugger;
233233 this.getSweets();
234 debugger;
234// debugger;
235235 this.showSweets();
236 debugger;
236// debugger;
237237 return false;
238238 },
239239 // function to update the urls in the UI if an image is loaded internally
340340 destroy: function() {
341341 this.helpview.remove();
342342 this.remove();
343 },
343 }
344344 });
345345
346346 var OCDView = Backbone.View.extend({