Skip to content

Commit

Permalink
Merge pull request #732 from guerler/fix_history_001
Browse files Browse the repository at this point in the history
Trigger iframe event for history
  • Loading branch information
carlfeberhard committed Sep 15, 2015
2 parents 71a1def + 89cc67b commit 1e2adc6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 33 deletions.
31 changes: 0 additions & 31 deletions client/galaxy/scripts/galaxy-app-base.js
Expand Up @@ -143,40 +143,9 @@ GalaxyApp.prototype._setUpListeners = function _setUpListeners(){
};
//TODO:?? we might somehow manage to *retry* ajax using either this hook or Backbone.sync
});
self._listenToGalaxyMain();
return self;
};

/** trigger an event when the main frame loads a new page */
GalaxyApp.prototype._listenToGalaxyMain = function _listenToGalaxyMain(){
var self = this,
selector = 'iframe#galaxy_main',
galaxy_main = $( selector );
galaxy_main = galaxy_main.size()? galaxy_main.get( 0 ).contentWindow : undefined ;
if( galaxy_main ){
// TODO: this would be better external to this function so it can be removed
var handler = function __galaxyMainOnLoadHandler( ev ){
try {
var _galaxy_main = $( selector ).get( 0 ).contentWindow,
full = _galaxy_main.location.pathname + _galaxy_main.location.search + _galaxy_main.location.hash;
self.trigger( 'galaxy_main:load', {
fullpath: full,
pathname: _galaxy_main.location.pathname,
search : _galaxy_main.location.search,
hash : _galaxy_main.location.hash
});

} catch( err ){
self.debug( 'Error handling main frame load:', err );
}
};
$( selector ).on( 'load', handler );

} else {
self.debug( 'No galaxy_main found' );
}
};

/** string rep */
GalaxyApp.prototype.toString = function toString(){
var userEmail = this.user.get( 'email' ) || '(anonymous)';
Expand Down
9 changes: 9 additions & 0 deletions client/galaxy/scripts/mvc/app/app-analysis.js
Expand Up @@ -19,6 +19,15 @@ define(['utils/utils', 'mvc/tools', 'mvc/upload/upload-view', 'mvc/ui/ui-misc',
this.$( '#galaxy_main' ).on( 'load', function() {
$( this ).show();
self.$( '#center-panel' ).empty().hide();
var galaxy_main = this.contentWindow;
if ( galaxy_main ) {
Galaxy.trigger( 'galaxy_main:load', {
fullpath: galaxy_main.location.pathname + galaxy_main.location.search + galaxy_main.location.hash,
pathname: galaxy_main.location.pathname,
search : galaxy_main.location.search,
hash : galaxy_main.location.hash
});
}
});
},
display: function( $el ) {
Expand Down
2 changes: 1 addition & 1 deletion static/maps/mvc/app/app-analysis.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion static/scripts/mvc/app/app-analysis.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1e2adc6

Please sign in to comment.