Commit 175d76af66a9308f67dd68394358263c7d0fec4b
Link from the search page to load searched images in the play area.
| | | | 313 | this.showSweets(); | 313 | this.showSweets(); |
---|
314 | return false; | 314 | return false; |
---|
315 | }, | 315 | }, |
---|
| | 316 | // function to update the urls in the UI if an image is loaded internally |
---|
| | 317 | // and not from user UI. |
---|
| | 318 | updateURLs: function(url) { |
---|
| | 319 | $('#user-input').val(url); |
---|
| | 320 | }, |
---|
316 | // load a URL for annotation (can be of image or html resource for now) | 321 | // load a URL for annotation (can be of image or html resource for now) |
---|
317 | loadURL: function(url, type) { | 322 | loadURL: function(url, type) { |
---|
318 | //console.log('loadURL()'); | 323 | //console.log('loadURL()'); |
---|
… | | … | |
---|
328 | // if type is given explicitly; we load it as such. | 328 | // if type is given explicitly; we load it as such. |
---|
329 | if(type === 'image') { | 329 | if(type === 'image') { |
---|
330 | this.initImageAnno(url); | 330 | this.initImageAnno(url); |
---|
| | 331 | this.updateURLs(url); |
---|
331 | return false; | 332 | return false; |
---|
332 | } | 333 | } |
---|
333 | // else try to find what resource is the URL.. | 334 | // else try to find what resource is the URL.. |
---|
… | | … | |
---|
547 | find('img').attr('src'); | 547 | find('img').attr('src'); |
---|
548 | //TODO: load the image in the play area/workbench | 548 | //TODO: load the image in the play area/workbench |
---|
549 | console.log('load image anno', url); | 549 | console.log('load image anno', url); |
---|
| | 550 | swtr.app_router.loadPlayArea(url, 'image'); |
---|
550 | }, | 551 | }, |
---|
551 | search: function(data, cb) { | 552 | search: function(data, cb) { |
---|
552 | swtr.appView.$overlay.show(); | 553 | swtr.appView.$overlay.show(); |
---|
… | | … | |
---|
879 | } | 879 | } |
---|
880 | $('#' + id).show(); | 880 | $('#' + id).show(); |
---|
881 | this.highlight(id); | 881 | this.highlight(id); |
---|
| | 882 | console.log('shown', id); |
---|
882 | }, | 883 | }, |
---|
883 | highlight: function(id) { | 884 | highlight: function(id) { |
---|
884 | $('#swtr-navbar-collapse li').removeClass('active'); | 885 | $('#swtr-navbar-collapse li').removeClass('active'); |
---|
… | | … | |
---|
890 | start: function() { | 890 | start: function() { |
---|
891 | var fragment = window.location.hash.split('#')[1]; | 891 | var fragment = window.location.hash.split('#')[1]; |
---|
892 | if(!fragment) { | 892 | if(!fragment) { |
---|
893 | this.navigate('home'); | | this.navigate('home'); |
---|
| | 893 | this.navigate('home', {trigger: true}); | 894 | return; | 894 | return; |
---|
895 | } | 895 | } |
---|
896 | var route = fragment.split('/')[1]; | 896 | var route = fragment.split('/')[1]; |
---|
897 | if(_.indexOf(_.keys(this.routes), route) > -1) { | 897 | if(_.indexOf(_.keys(this.routes), route) > -1) { |
---|
898 | this.navigate(fragment); | | this.navigate(fragment); |
---|
| | 898 | this.navigate(fragment, {trigger: true}); | 899 | } | 899 | } |
---|
| | 900 | }, |
---|
| | 901 | loadPlayArea: function(url, type) { |
---|
| | 902 | this.navigate('play', {trigger: true}); |
---|
| | 903 | this.mounted_component.loadURL(url, type); |
---|
900 | } | 904 | } |
---|
901 | }); | 905 | }); |
---|
902 | | 906 | |
---|