commit/galaxy-central: jgoecks: Create mako module/function for refreshing Galaxy frames and use module/function to replace duplicated code.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/cab4a220c5c9/ Changeset: cab4a220c5c9 User: jgoecks Date: 2013-06-17 23:17:33 Summary: Create mako module/function for refreshing Galaxy frames and use module/function to replace duplicated code. Affected #: 5 files diff -r 5a8d6c2a1b31cb592c2233413a76a4c1fd215c15 -r cab4a220c5c971a89de38b152e81c36aaec38f49 templates/grid_base.mako --- a/templates/grid_base.mako +++ b/templates/grid_base.mako @@ -13,6 +13,7 @@ %><%inherit file="${inherit(context)}"/><%namespace file="/display_common.mako" import="render_message" /> +<%namespace file="/refresh_frames.mako" import="handle_refresh_frames" /><%def name="init()"><% @@ -53,43 +54,10 @@ <%def name="grid_javascripts()"> ${h.js("libs/jquery/jquery.autocomplete", "galaxy.autocom_tagging", "libs/jquery/jquery.rating", "galaxy.grids" )} + ${handle_refresh_frames()} + <script type="text/javascript"> - ## TODO: Can this be moved into base.mako? Also, this is history-specific grid code. - %if refresh_frames: - %if 'masthead' in refresh_frames: - ## Refresh masthead == user changes (backward compatibility) - if ( parent.user_changed ) { - %if trans.user: - parent.user_changed( "${trans.user.email}", ${int( app.config.is_admin_user( trans.user ) )} ); - %else: - parent.user_changed( null, false ); - %endif - } - %endif - %if 'history' in refresh_frames: - if ( parent.frames && parent.frames.galaxy_history ) { - parent.frames.galaxy_history.location.href="${url( controller='root', action='history')}"; - if ( parent.force_right_panel ) { - parent.force_right_panel( 'show' ); - } - } - else { - // TODO: redirecting to root should be done on the server side so that page - // does not have to load. - // No history frame, so refresh to root to see history. - window.top.location.href = "${url( controller='root' )}"; - } - %endif - %if 'tools' in refresh_frames: - if ( parent.frames && parent.frames.galaxy_tools ) { - parent.frames.galaxy_tools.location.href="${url( controller='root', action='tool_menu')}"; - if ( parent.force_left_panel ) { - parent.force_left_panel( 'show' ); - } - } - %endif - %endif - + // Needed URLs for grid history searching. var history_tag_autocomplete_url = "${url( controller='tag', action='tag_autocomplete_data', item_class='History' )}", history_name_autocomplete_url = "${url( controller='history', action='name_autocomplete_data' )}"; diff -r 5a8d6c2a1b31cb592c2233413a76a4c1fd215c15 -r cab4a220c5c971a89de38b152e81c36aaec38f49 templates/message.mako --- a/templates/message.mako +++ b/templates/message.mako @@ -10,6 +10,9 @@ return '/base.mako' %><%inherit file="${inherit(context)}"/> + +<%namespace file="/refresh_frames.mako" import="handle_refresh_frames" /> + <% _=n_ %><%def name="init()"> @@ -21,52 +24,9 @@ %></%def> -<%def name="handle_refresh_frames()"> - <script type="text/javascript"> - %if 'everything' in refresh_frames: - parent.location.href="${h.url_for( controller='root' )}"; - %endif - %if 'masthead' in refresh_frames: - ## if ( parent.frames && parent.frames.galaxy_masthead ) { - ## parent.frames.galaxy_masthead.location.href="${h.url_for( controller='root', action='masthead')}"; - ## } - ## else if ( parent.parent && parent.parent.frames && parent.parent.frames.galaxy_masthead ) { - ## parent.parent.frames.galaxy_masthead.location.href="${h.url_for( controller='root', action='masthead')}"; - ## } - - ## Refresh masthead == user changes (backward compatibility) - if ( parent.user_changed ) { - %if trans.user: - parent.user_changed( "${trans.user.email}", ${int( app.config.is_admin_user( trans.user ) )} ); - %else: - parent.user_changed( null, false ); - %endif - } - %endif - %if 'history' in refresh_frames: - if ( parent.frames && parent.frames.galaxy_history ) { - parent.frames.galaxy_history.location.href="${h.url_for( controller='root', action='history')}"; - if ( parent.force_right_panel ) { - parent.force_right_panel( 'show' ); - } - } - %endif - %if 'tools' in refresh_frames: - if ( parent.frames && Galaxy.toolPanel ) { - // FIXME: refreshing the tool menu does not work with new JS-based approach, - // but refreshing the tool menu is not used right now, either. - - if ( parent.force_left_panel ) { - parent.force_left_panel( 'show' ); - } - } - %endif - </script> -</%def> - <%def name="javascripts()"> ${parent.javascripts()} - ${self.handle_refresh_frames()} + ${handle_refresh_frames()} <script type="text/javascript"> if ( parent.handle_minwidth_hint ) { diff -r 5a8d6c2a1b31cb592c2233413a76a4c1fd215c15 -r cab4a220c5c971a89de38b152e81c36aaec38f49 templates/refresh_frames.mako --- /dev/null +++ b/templates/refresh_frames.mako @@ -0,0 +1,46 @@ +## Include JavaScript code to refresh Galaxy application frames as needed. +<%def name="handle_refresh_frames()"> + <script type="text/javascript"> + <% + if not refresh_frames: return + %> + %if 'everything' in refresh_frames: + parent.location.href="${h.url_for( controller='root' )}"; + %endif + %if 'masthead' in refresh_frames: + ## if ( parent.frames && parent.frames.galaxy_masthead ) { + ## parent.frames.galaxy_masthead.location.href="${h.url_for( controller='root', action='masthead')}"; + ## } + ## else if ( parent.parent && parent.parent.frames && parent.parent.frames.galaxy_masthead ) { + ## parent.parent.frames.galaxy_masthead.location.href="${h.url_for( controller='root', action='masthead')}"; + ## } + + ## Refresh masthead == user changes (backward compatibility) + if ( parent.user_changed ) { + %if trans.user: + parent.user_changed( "${trans.user.email}", ${int( app.config.is_admin_user( trans.user ) )} ); + %else: + parent.user_changed( null, false ); + %endif + } + %endif + %if 'history' in refresh_frames: + if ( parent.frames && parent.frames.galaxy_history ) { + parent.frames.galaxy_history.location.href="${h.url_for( controller='root', action='history')}"; + if ( parent.force_right_panel ) { + parent.force_right_panel( 'show' ); + } + } + %endif + %if 'tools' in refresh_frames: + if ( parent.frames && Galaxy.toolPanel ) { + // FIXME: refreshing the tool menu does not work with new JS-based approach, + // but refreshing the tool menu is not used right now, either. + + if ( parent.force_left_panel ) { + parent.force_left_panel( 'show' ); + } + } + %endif + </script> +</%def> \ No newline at end of file diff -r 5a8d6c2a1b31cb592c2233413a76a4c1fd215c15 -r cab4a220c5c971a89de38b152e81c36aaec38f49 templates/webapps/galaxy/dataset/copy_view.mako --- a/templates/webapps/galaxy/dataset/copy_view.mako +++ b/templates/webapps/galaxy/dataset/copy_view.mako @@ -1,9 +1,13 @@ <%inherit file="/base.mako"/> +<%namespace file="/refresh_frames.mako" import="handle_refresh_frames" /> + <%def name="title()">Copy History Items</%def><%def name="javascripts()"> ${parent.javascripts()} + + ${handle_refresh_frames} <script type="text/javascript"> $(function() { @@ -13,14 +17,6 @@ $("#multiple-destination").show(); }); }); - %if 'history' in refresh_frames: - if ( parent.frames && parent.frames.galaxy_history ) { - parent.frames.galaxy_history.location.href="${h.url_for( controller='root', action='history')}"; - if ( parent.force_right_panel ) { - parent.force_right_panel( 'show' ); - } - } - %endif </script></%def> diff -r 5a8d6c2a1b31cb592c2233413a76a4c1fd215c15 -r cab4a220c5c971a89de38b152e81c36aaec38f49 templates/webapps/galaxy/history/grid.mako --- a/templates/webapps/galaxy/history/grid.mako +++ b/templates/webapps/galaxy/history/grid.mako @@ -1,19 +1,11 @@ <%inherit file="../grid_base.mako"/> +<%namespace file="/refresh_frames.mako" import="handle_refresh_frames" /> + <%def name="grid_javascripts()"> ${parent.grid_javascripts()} - <script type="text/javascript"> - %if refresh_frames: - %if 'history' in refresh_frames: - if ( parent.frames && parent.frames.galaxy_history ) { - parent.frames.galaxy_history.location.href="${h.url_for( controller='root', action='history')}"; - if ( parent.force_right_panel ) { - parent.force_right_panel( 'show' ); - } - } - %endif - %endif - </script> + + ${handle_refresh_frames()} </%def><%def name="grid_body( grid )"> 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.
participants (1)
-
commits-noreply@bitbucket.org