mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Create mako module/function for refreshing Galaxy frames and use module/function to replace duplicated code.
This commit is contained in:
@@ -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' )}";
|
||||
|
||||
+4
-44
@@ -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 )
|
||||
{
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
@@ -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 )">
|
||||
|
||||
Reference in New Issue
Block a user