1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/369bb0f7ebef/ Changeset: 369bb0f7ebef User: carlfeberhard Date: 2014-04-24 16:34:24 Summary: Client app: extract method on client app init to javascript_app so it isn't called twice when using parent.javascripts() Affected #: 5 files diff -r 641f7063ce3c5dcf375aafdd9a65a2e3f7ccfa4c -r 369bb0f7ebef50a72f36cf2f74d23f7d351d61c4 templates/base.mako --- a/templates/base.mako +++ b/templates/base.mako @@ -12,6 +12,7 @@ ${self.metas()} ${self.stylesheets()} ${self.javascripts()} + ${self.javascript_app()} </head><body class="inbound"> ${next.body()} @@ -83,8 +84,6 @@ }); </script> - ${ galaxy_client.load( app=self.js_app ) } - %if not form_input_auto_focus is UNDEFINED and form_input_auto_focus: <script type="text/javascript"> $(document).ready( function() { @@ -98,5 +97,9 @@ </%def> +<%def name="javascript_app()"> + ${ galaxy_client.load( app=self.js_app ) } +</%def> + ## Additional metas can be defined by templates inheriting from this one. <%def name="metas()"></%def> diff -r 641f7063ce3c5dcf375aafdd9a65a2e3f7ccfa4c -r 369bb0f7ebef50a72f36cf2f74d23f7d351d61c4 templates/base/base_panels.mako --- a/templates/base/base_panels.mako +++ b/templates/base/base_panels.mako @@ -1,6 +1,6 @@ <!DOCTYPE HTML> +<%namespace name="galaxy_client" file="/galaxy_client_app.mako" /> -<%namespace name="galaxy_client" file="/galaxy_client_app.mako" /><% self.has_left_panel = hasattr( self, 'left_panel' ) self.has_right_panel = hasattr( self, 'right_panel' ) @@ -20,7 +20,10 @@ ## Default stylesheets <%def name="stylesheets()"> - ${h.css('base','jquery.rating')} + ${h.css( + 'base', + 'jquery.rating' + )} <style type="text/css"> #center { %if not self.has_left_panel: @@ -67,9 +70,9 @@ root: '${h.url_for( "/" )}' }; - ## load additional style sheet - if (window != window.top) - $('<link href="' + galaxy_config.root + 'static/style/galaxy.frame.masthead.css" rel="stylesheet">').appendTo('head'); + //## load additional style sheet + //if (window != window.top) + // $('<link href="' + galaxy_config.root + 'static/style/galaxy.frame.masthead.css" rel="stylesheet">').appendTo('head'); // console protection window.console = window.console || { @@ -91,16 +94,24 @@ }); </script> +</%def> + +<%def name="javascript_app()"> ## load the Galaxy global js var ${ galaxy_client.load() } - </%def> ## Default late-load javascripts <%def name="late_javascripts()"> ## Scripts can be loaded later since they progressively add features to ## the panels, but do not change layout - ${h.js( 'libs/jquery/jquery.event.drag', 'libs/jquery/jquery.event.hover', 'libs/jquery/jquery.form', 'libs/jquery/jquery.rating', 'galaxy.panels' )} + ${h.js( + 'libs/jquery/jquery.event.drag', + 'libs/jquery/jquery.event.hover', + 'libs/jquery/jquery.form', + 'libs/jquery/jquery.rating', + 'galaxy.panels' + )} <script type="text/javascript"> ensure_dd_helper(); @@ -295,6 +306,7 @@ <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> ${self.stylesheets()} ${self.javascripts()} + ${self.javascript_app()} </head><% diff -r 641f7063ce3c5dcf375aafdd9a65a2e3f7ccfa4c -r 369bb0f7ebef50a72f36cf2f74d23f7d351d61c4 templates/webapps/galaxy/base_panels.mako --- a/templates/webapps/galaxy/base_panels.mako +++ b/templates/webapps/galaxy/base_panels.mako @@ -1,4 +1,5 @@ <%inherit file="/base/base_panels.mako"/> +<!-- webapps/galaxy/base_panels.mako --><%namespace name="mod_masthead" file="/webapps/galaxy/galaxy.masthead.mako"/> ## Default title @@ -17,4 +18,4 @@ <% mod_masthead.load(self.active_view); %> -</%def> \ No newline at end of file +</%def> diff -r 641f7063ce3c5dcf375aafdd9a65a2e3f7ccfa4c -r 369bb0f7ebef50a72f36cf2f74d23f7d351d61c4 templates/webapps/galaxy/galaxy.panels.mako --- a/templates/webapps/galaxy/galaxy.panels.mako +++ b/templates/webapps/galaxy/galaxy.panels.mako @@ -101,6 +101,11 @@ }); var galaxy_config = ${ h.to_json_string( self.galaxy_config ) }; + </script> +</%def> + +<%def name="javascript_app()"> + <script type="text/javascript"> // load any app configured define( 'app', function(){ var jscript = galaxy_config.app.jscript; @@ -116,6 +121,7 @@ } }); </script> + ## load the Galaxy global js var and run 'app' from above ${ galaxy_client.load( app='app' ) } @@ -125,7 +131,6 @@ ##${ galaxy_client.load( app=( app_config[ 'jscript' ] if 'jscript' in app_config else None )) } ##TODO: at that point, we can think about optimizing the various apps - </%def> ## default late-load javascripts @@ -165,6 +170,7 @@ ## load scripts ${self.javascripts()} + ${self.javascript_app()} </head><body scroll="no" class="full-content"> diff -r 641f7063ce3c5dcf375aafdd9a65a2e3f7ccfa4c -r 369bb0f7ebef50a72f36cf2f74d23f7d351d61c4 templates/webapps/galaxy/root/history.mako --- a/templates/webapps/galaxy/root/history.mako +++ b/templates/webapps/galaxy/root/history.mako @@ -8,13 +8,16 @@ ## ----------------------------------------------------------------------------- <%def name="javascripts()"> ${ parent.javascripts() } - <script type="text/javascript"> $(function(){ $( 'body' ).addClass( 'historyPage' ).addClass( 'history-panel' ) .css({ margin: '0px', padding: '0px' }); }); +</script> +</%def> +<%def name="javascript_app()"> +<script type="text/javascript"> define( 'app', function(){ require([ 'mvc/history/current-history-panel' @@ -34,8 +37,7 @@ }); }); }); -}) +}); </script> ${ galaxy_client.load( app='app', history=history, hdas=hdas, show_deleted=show_deleted, show_hidden=show_hidden ) } - </%def> Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.