mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Remove iframe around tools menu. Tranform tools_menu.mako in a library that is used by index.mako to create and display tool panel. Pack scripts.
This commit is contained in:
@@ -39,27 +39,6 @@ class RootController( BaseUIController, UsesHistoryMixin, UsesHistoryDatasetAsso
|
||||
params=kwd )
|
||||
|
||||
## ---- Tool related -----------------------------------------------------
|
||||
@web.expose
|
||||
def tool_menu( self, trans ):
|
||||
"""Renders the tool panel of the Galaxy UI.
|
||||
"""
|
||||
if trans.app.config.require_login and not trans.user:
|
||||
return trans.fill_template( '/no_access.mako', message='Please log in to access Galaxy tools.' )
|
||||
toolbox = self.get_toolbox()
|
||||
## Get most recently used tools.
|
||||
# recent_tools = []
|
||||
# if trans.user:
|
||||
# for row in trans.sa_session.query( self.app.model.Job.tool_id ) \
|
||||
# .filter( self.app.model.Job.user == trans.user ) \
|
||||
# .order_by( self.app.model.Job.create_time.desc() ):
|
||||
# tool_id = row[0]
|
||||
# a_tool = toolbox.get_tool( tool_id )
|
||||
# if a_tool and not a_tool.hidden and a_tool not in recent_tools:
|
||||
# recent_tools.append( a_tool )
|
||||
# ## TODO: make number of recently used tools a user preference.
|
||||
# if len( recent_tools ) == 5:
|
||||
# break
|
||||
return trans.fill_template( '/root/tool_menu.mako', toolbox=toolbox )
|
||||
|
||||
@web.json
|
||||
def tool_search( self, trans, **kwd ):
|
||||
|
||||
@@ -545,6 +545,7 @@ var ToolSearchView = Backbone.View.extend({
|
||||
if (!this.model.is_visible()) {
|
||||
this.$el.hide();
|
||||
}
|
||||
this.$el.find('.tooltip').tooltip();
|
||||
return this;
|
||||
},
|
||||
|
||||
@@ -579,7 +580,7 @@ var ToolPanelView = Backbone.View.extend({
|
||||
className: 'toolMenu',
|
||||
|
||||
/**
|
||||
* Waits for collection to load and then renders.
|
||||
* Set up view.
|
||||
*/
|
||||
initialize: function() {
|
||||
this.collection.tool_search.on("change:results", this.handle_search_results, this);
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1718,7 +1718,8 @@ pre.peek {
|
||||
{
|
||||
color: @base_text;
|
||||
background: @menu_bg_over;
|
||||
margin-top: 5px;
|
||||
height: 100%;
|
||||
padding: 0px 5px;
|
||||
}
|
||||
|
||||
div.toolSectionPad
|
||||
|
||||
@@ -969,7 +969,7 @@ div.toolFormDisabled div.toolFormTitle{background:#eeeeee;border-color:#999999;}
|
||||
div.toolFormDisabled{border-color:#999999;}
|
||||
div.toolHelp{margin-top:15px;padding:5px;}
|
||||
div.toolHelpBody{width:100%;}
|
||||
.toolForm.toolFormInCanvas{border:solid #d8b365 1px;}.toolForm.toolFormInCanvas.toolForm-active{border:solid blue 3px;margin:4px;}
|
||||
.toolForm.toolFormInCanvas{border:solid #d8b365 1px;}.toolForm.toolFormInCanvas.toolForm-active{border:solid #d9edf7 3px;margin:4px;}
|
||||
.toolForm.toolFormInCanvas .toolFormTitle{font-size:12px;line-height:16px;}
|
||||
div.form-title,div.toolFormTitle{font-size:15px;line-height:24px;padding:5px 10px;background:#ebd9b2;border-bottom:solid #d8b365 1px;}
|
||||
div.form-body{padding:5px 0;}
|
||||
@@ -1142,7 +1142,7 @@ div.historyItemButtons{float:right;}
|
||||
div.historyItemBody div{padding-top:2px;}
|
||||
pre.peek{background:white;color:black;width:100%;font-size:10px;overflow:auto;}pre.peek th{color:white;background:#023858;}
|
||||
pre.peek table,pre.peek th,pre.peek tr,pre.peek td{font-family:Menlo,Monaco,"Courier New",monospace;font-size:10px;}
|
||||
.toolMenuContainer{color:#303030;background:#dfe5f9;margin-top:5px;}
|
||||
.toolMenuContainer{color:#303030;background:#dfe5f9;height:100%;padding:0px 5px;}
|
||||
div.toolSectionPad{margin:0;padding:0;height:5px;font-size:0px;}
|
||||
div.toolSectionWrapper{margin-bottom:5px;}
|
||||
div.toolSectionDetailsInner{margin-left:5px;margin-right:5px;}
|
||||
|
||||
@@ -52,8 +52,10 @@
|
||||
}
|
||||
%endif
|
||||
%if 'tools' in refresh_frames:
|
||||
if ( parent.frames && parent.frames.galaxy_tools ) {
|
||||
parent.frames.galaxy_tools.location.href="${h.url_for( controller='root', action='tool_menu')}";
|
||||
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' );
|
||||
}
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
<%inherit file="/webapps/galaxy/base_panels.mako"/>
|
||||
|
||||
<%namespace file="/root/tool_menu.mako" import="*" />
|
||||
|
||||
<%def name="stylesheets()">
|
||||
${parent.stylesheets()}
|
||||
${h.css("tool_menu")}
|
||||
</%def>
|
||||
|
||||
<%def name="javascripts()">
|
||||
${parent.javascripts()}
|
||||
${tool_menu_javascripts()}
|
||||
</%def>
|
||||
|
||||
<%def name="late_javascripts()">
|
||||
${parent.late_javascripts()}
|
||||
|
||||
@@ -131,8 +143,8 @@
|
||||
${n_('Tools')}
|
||||
</div>
|
||||
</div>
|
||||
<div class="unified-panel-body" style="overflow: hidden;">
|
||||
<iframe name="galaxy_tools" id="galaxy_tools" src="${h.url_for( controller='root', action='tool_menu' )}" frameborder="0" style="position: absolute; margin: 0; border: 0 none; height: 100%; width: 100%;"> </iframe>
|
||||
<div class="unified-panel-body" style="overflow: auto">
|
||||
${render_tool_menu()}
|
||||
</div>
|
||||
</%def>
|
||||
|
||||
|
||||
@@ -1,28 +1,8 @@
|
||||
<%inherit file="/base.mako"/>
|
||||
|
||||
<%namespace file="/tagging_common.mako" import="render_tool_tagging_elements" />
|
||||
|
||||
## Render a workflow
|
||||
<%def name="render_workflow( key, workflow, section )">
|
||||
%if section:
|
||||
<div class="toolTitle">
|
||||
%else:
|
||||
<div class="toolTitleNoSection">
|
||||
%endif
|
||||
<% encoded_id = key.lstrip( 'workflow_' ) %>
|
||||
<a id="link-${workflow.id}" href="${ h.url_for( controller='workflow', action='run', id=encoded_id )}" target="_parent">${_( util.unicodify( workflow.name ) ) }</a>
|
||||
</div>
|
||||
</%def>
|
||||
|
||||
<%def name="javascripts()">
|
||||
${parent.javascripts()}
|
||||
## Javascript required for tool menu.
|
||||
<%def name="tool_menu_javascripts()">
|
||||
${h.templates( "tool_link", "panel_section", "tool_search" )}
|
||||
${h.js( "libs/require", "galaxy.autocom_tagging" )}
|
||||
|
||||
<%
|
||||
dictified_panel = trans.app.toolbox.to_dict( trans )
|
||||
%>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
require.config({
|
||||
@@ -35,103 +15,79 @@
|
||||
require(["mvc/tools"], function(tools) {
|
||||
|
||||
// Init. on document load.
|
||||
var tool_panel, tool_panel_view, tool_search;
|
||||
$(function() {
|
||||
|
||||
// Set up search.
|
||||
tool_search = new tools.ToolSearch({
|
||||
spinner_url: "${h.url_for('/static/images/loading_small_white_bg.gif')}",
|
||||
search_url: "${h.url_for( controller='root', action='tool_search' )}",
|
||||
hidden: false
|
||||
});
|
||||
|
||||
// Set up tool panel.
|
||||
tool_panel = new tools.ToolPanel( { tool_search: tool_search } );
|
||||
tool_panel.reset( tool_panel.parse( ${h.to_json_string( dictified_panel )} ) );
|
||||
// Create tool search, tool panel, and tool panel view.
|
||||
var tool_search = new tools.ToolSearch({
|
||||
spinner_url: "${h.url_for('/static/images/loading_small_white_bg.gif')}",
|
||||
search_url: "${h.url_for( controller='root', action='tool_search' )}",
|
||||
hidden: false
|
||||
}),
|
||||
tool_panel = new tools.ToolPanel({ tool_search: tool_search }),
|
||||
tool_panel_view = new tools.ToolPanelView({ collection: tool_panel });
|
||||
|
||||
// Add tool panel to Galaxy object.
|
||||
Galaxy.toolPanel = tool_panel;
|
||||
|
||||
## Populate tool panel if (a) anonymous use possible or (b) user is logged in.
|
||||
%if trans.app.config.require_login and trans.user:
|
||||
tool_panel.reset( tool_panel.parse( ${h.to_json_string( trans.app.toolbox.to_dict( trans ) )} ) );
|
||||
%endif
|
||||
|
||||
// If there are tools, render panel and display everything.
|
||||
if (tool_panel.length > 1) { // > 1 because tool_search counts as a model
|
||||
tool_panel_view.render();
|
||||
$('.toolMenu').show();
|
||||
}
|
||||
$('.toolMenuContainer').prepend(tool_panel_view.$el);
|
||||
|
||||
// Set up tool panel view and initialize.
|
||||
tool_panel_view = new tools.ToolPanelView( {collection: tool_panel} );
|
||||
tool_panel_view.render();
|
||||
$('body').prepend(tool_panel_view.$el);
|
||||
|
||||
// Minsize init hint.
|
||||
$( "a[minsizehint]" ).click( function() {
|
||||
if ( parent.handle_minwidth_hint ) {
|
||||
parent.handle_minwidth_hint( $(this).attr( "minsizehint" ) );
|
||||
}
|
||||
});
|
||||
|
||||
// Log clicks on tools.
|
||||
/*
|
||||
$("div.toolTitle > a").click( function() {
|
||||
var tool_title = $(this).attr('id').split("-")[1];
|
||||
var section_title = $.trim( $(this).parents("div.toolSectionWrapper").find("div.toolSectionTitle").text() );
|
||||
var search_active = $(this).parents("div.toolTitle").hasClass("search_match");
|
||||
|
||||
// Log action.
|
||||
galaxy_async.log_user_action("tool_menu_click." + tool_title, section_title,
|
||||
JSON.stringify({"search_active" : search_active}));
|
||||
});
|
||||
*/
|
||||
|
||||
$( '.tooltip' ).tooltip();
|
||||
|
||||
// TODO: is this necessary?
|
||||
$( "a[minsizehint]" ).click( function() {
|
||||
if ( parent.handle_minwidth_hint ) {
|
||||
parent.handle_minwidth_hint( $(this).attr( "minsizehint" ) );
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</%def>
|
||||
|
||||
<%def name="stylesheets()">
|
||||
${parent.stylesheets()}
|
||||
${h.css("tool_menu")}
|
||||
</%def>
|
||||
|
||||
|
||||
<%def name="title()">
|
||||
${_('Galaxy Tools')}
|
||||
</%def>
|
||||
|
||||
## Default body
|
||||
<body class="toolMenuContainer">
|
||||
|
||||
<div class="toolMenu">
|
||||
## Feedback when search returns no results.
|
||||
<div id="search-no-results" style="display: none; padding-top: 5px">
|
||||
<em><strong>Search did not match any tools.</strong></em>
|
||||
</div>
|
||||
## Render tool menu.
|
||||
<%def name="render_tool_menu()">
|
||||
<div class="toolMenuContainer">
|
||||
|
||||
## Link to workflow management. The location of this may change, but eventually
|
||||
## at least some workflows will appear here (the user should be able to
|
||||
## configure which of their stored workflows appear in the tools menu).
|
||||
|
||||
%if t.user:
|
||||
<div class="toolSectionPad"></div>
|
||||
<div class="toolSectionPad"></div>
|
||||
<div class="toolSectionTitle" id="title_XXinternalXXworkflow">
|
||||
<span>Workflows</span>
|
||||
<div class="toolMenu" style="display: none">
|
||||
## Feedback when search returns no results.
|
||||
<div id="search-no-results" style="display: none; padding-top: 5px">
|
||||
<em><strong>Search did not match any tools.</strong></em>
|
||||
</div>
|
||||
<div id="XXinternalXXworkflow" class="toolSectionBody">
|
||||
<div class="toolSectionBg">
|
||||
%if t.user.stored_workflow_menu_entries:
|
||||
%for m in t.user.stored_workflow_menu_entries:
|
||||
<div class="toolTitle">
|
||||
<a href="${h.url_for( controller='workflow', action='run', id=trans.security.encode_id(m.stored_workflow_id) )}" target="galaxy_main">${ util.unicodify( m.stored_workflow.name ) }</a>
|
||||
</div>
|
||||
%endfor
|
||||
%endif
|
||||
<div class="toolTitle">
|
||||
<a href="${h.url_for( controller='workflow', action='list_for_run')}" target="galaxy_main">All workflows</a>
|
||||
|
||||
## Link to workflow management. The location of this may change, but eventually
|
||||
## at least some workflows will appear here (the user should be able to
|
||||
## configure which of their stored workflows appear in the tools menu).
|
||||
|
||||
%if t.user:
|
||||
<div class="toolSectionPad"></div>
|
||||
<div class="toolSectionPad"></div>
|
||||
<div class="toolSectionTitle" id="title_XXinternalXXworkflow">
|
||||
<span>Workflows</span>
|
||||
</div>
|
||||
<div id="XXinternalXXworkflow" class="toolSectionBody">
|
||||
<div class="toolSectionBg">
|
||||
%if t.user.stored_workflow_menu_entries:
|
||||
%for m in t.user.stored_workflow_menu_entries:
|
||||
<div class="toolTitle">
|
||||
<a href="${h.url_for( controller='workflow', action='run', id=trans.security.encode_id(m.stored_workflow_id) )}" target="galaxy_main">${ util.unicodify( m.stored_workflow.name ) }</a>
|
||||
</div>
|
||||
%endfor
|
||||
%endif
|
||||
<div class="toolTitle">
|
||||
<a href="${h.url_for( controller='workflow', action='list_for_run')}" target="galaxy_main">All workflows</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
%endif
|
||||
|
||||
%endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</%def>
|
||||
Reference in New Issue
Block a user