Commit fd4259edef1faa91035a82db79ddf978f7db0e1c
- Diff rendering mode:
- inline
- side by side
swtr/static/js/img_swtr.js
(3 / 2)
  | |||
114 | 114 | initialize: function(options) { | |
115 | 115 | this.$el = $('#img-annotation-wrapper'); | |
116 | 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 | 118 | var self = this; | |
119 | 119 | ||
120 | 120 | // attach event handlers to the anno object | |
… | … | ||
170 | 170 | this.collection.each(this.render, this); | |
171 | 171 | }, | |
172 | 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 | 175 | self.helpview.step(3); | |
175 | 176 | $('#sweet').show(); | |
176 | 177 | }, |
swtr/static/js/main.js
(12 / 6)
  | |||
51 | 51 | }, | |
52 | 52 | render: function() { | |
53 | 53 | console.log('sweetsview rendering'); | |
54 | debugger; | ||
54 | // debugger; | ||
55 | 55 | $('#sweet-list').html('<h4>These are your sweet annotations!</h4>'); | |
56 | 56 | _.each(this.collection.models, function(swt) { | |
57 | 57 | if(swt.has('id')) { | |
… | … | ||
95 | 95 | postSweets: function(event) { | |
96 | 96 | event.preventDefault(); | |
97 | 97 | console.log('posting swts'); | |
98 | debugger; | ||
98 | // debugger; | ||
99 | 99 | var appView = swtr.appView; | |
100 | 100 | var self = this; | |
101 | 101 | this.helpview.step(5); | |
… | … | ||
104 | 104 | this.collection.post({ | |
105 | 105 | success: function(collection, response) { | |
106 | 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 | 113 | swtr.sweets.add(collection, {merge: true}); | |
108 | 114 | console.log('new swtr coll', swtr.sweets); | |
109 | 115 | appView.$overlay.hide(); | |
… | … | ||
229 | 229 | sweet: function(event) { | |
230 | 230 | event.preventDefault(); | |
231 | 231 | console.log('sweeting'); | |
232 | debugger; | ||
232 | // debugger; | ||
233 | 233 | this.getSweets(); | |
234 | debugger; | ||
234 | // debugger; | ||
235 | 235 | this.showSweets(); | |
236 | debugger; | ||
236 | // debugger; | ||
237 | 237 | return false; | |
238 | 238 | }, | |
239 | 239 | // function to update the urls in the UI if an image is loaded internally | |
… | … | ||
340 | 340 | destroy: function() { | |
341 | 341 | this.helpview.remove(); | |
342 | 342 | this.remove(); | |
343 | }, | ||
343 | } | ||
344 | 344 | }); | |
345 | 345 | ||
346 | 346 | var OCDView = Backbone.View.extend({ |