Commit fd4259edef1faa91035a82db79ddf978f7db0e1c

  • avatar
  • arvind
  • Mon Sep 15 15:26:44 IST 2014
Fixing annotation remaining editable after swt'ing.
  • Diff rendering mode:
  • inline
  • side by side

swtr/static/js/img_swtr.js

114 initialize: function(options) {114 initialize: function(options) {
115 this.$el = $('#img-annotation-wrapper');115 this.$el = $('#img-annotation-wrapper');
116 this.listenTo(this.collection, 'add', this.render);116 this.listenTo(this.collection, 'add', this.render);
117 this.listenTo(this.collection, 'change', this.render);
117 // this.listenTo(this.collection, 'change', this.render);
118 var self = this;118 var self = this;
119119
120 // attach event handlers to the anno object120 // attach event handlers to the anno object
170 this.collection.each(this.render, this);170 this.collection.each(this.render, this);
171 },171 },
172 showSwtHelp: function(annotation) {172 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
174 self.helpview.step(3);175 self.helpview.step(3);
175 $('#sweet').show();176 $('#sweet').show();
176 },177 },

swtr/static/js/main.js

51 },51 },
52 render: function() {52 render: function() {
53 console.log('sweetsview rendering');53 console.log('sweetsview rendering');
54 debugger;
54// debugger;
55 $('#sweet-list').html('<h4>These are your sweet annotations!</h4>');55 $('#sweet-list').html('<h4>These are your sweet annotations!</h4>');
56 _.each(this.collection.models, function(swt) {56 _.each(this.collection.models, function(swt) {
57 if(swt.has('id')) {57 if(swt.has('id')) {
95 postSweets: function(event) {95 postSweets: function(event) {
96 event.preventDefault();96 event.preventDefault();
97 console.log('posting swts');97 console.log('posting swts');
98 debugger;
98// debugger;
99 var appView = swtr.appView;99 var appView = swtr.appView;
100 var self = this;100 var self = this;
101 this.helpview.step(5);101 this.helpview.step(5);
104 this.collection.post({104 this.collection.post({
105 success: function(collection, response) {105 success: function(collection, response) {
106 console.log('updated', collection, response);106 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 // });
107 swtr.sweets.add(collection, {merge: true});113 swtr.sweets.add(collection, {merge: true});
108 console.log('new swtr coll', swtr.sweets);114 console.log('new swtr coll', swtr.sweets);
109 appView.$overlay.hide();115 appView.$overlay.hide();
229 sweet: function(event) {229 sweet: function(event) {
230 event.preventDefault();230 event.preventDefault();
231 console.log('sweeting');231 console.log('sweeting');
232 debugger;
232// debugger;
233 this.getSweets();233 this.getSweets();
234 debugger;
234// debugger;
235 this.showSweets();235 this.showSweets();
236 debugger;
236// debugger;
237 return false;237 return false;
238 },238 },
239 // function to update the urls in the UI if an image is loaded internally239 // function to update the urls in the UI if an image is loaded internally
340 destroy: function() {340 destroy: function() {
341 this.helpview.remove();341 this.helpview.remove();
342 this.remove();342 this.remove();
343 },
343 }
344 });344 });
345345
346 var OCDView = Backbone.View.extend({346 var OCDView = Backbone.View.extend({