mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Update: Scratchbook
This commit is contained in:
@@ -735,7 +735,6 @@ var GalaxyFrameManager = Backbone.View.extend(
|
||||
|
||||
// untoggle
|
||||
$(".galaxy-frame-active .icon").removeClass("f-toggle");
|
||||
|
||||
} else {
|
||||
// activate
|
||||
this.active = true;
|
||||
@@ -1034,7 +1033,7 @@ var GalaxyFrameManager = Backbone.View.extend(
|
||||
'<div class="number f-corner">0</div>' +
|
||||
'<div class="icon fa-icon-2x"></div>' +
|
||||
'</div>'+
|
||||
'<div title="Enable/Disable Scratchbook Viewer" class="galaxy-frame-active f-corner">' +
|
||||
'<div class="galaxy-frame-active f-corner">' +
|
||||
'<div class="icon fa-icon-2x fa-icon-th"></div>' +
|
||||
'</div>';
|
||||
},
|
||||
|
||||
@@ -239,8 +239,25 @@ var HDAEditView = HDABaseView.extend( LoggableMixin ).extend(
|
||||
* @returns {jQuery} rendered DOM
|
||||
*/
|
||||
_render_visualizationsButton : function(){
|
||||
var visualizations = this.model.get( 'visualizations' );
|
||||
if( ( !this.model.hasData() )
|
||||
|| ( _.isEmpty( visualizations ) ) ){
|
||||
this.visualizationsButton = null;
|
||||
return null;
|
||||
}
|
||||
|
||||
//TODO: this is a bridge to allow the framework to be switched off
|
||||
// remove this fn and use the other when fully integrated
|
||||
if( _.isObject( visualizations[0] ) ){
|
||||
return this._render_visualizationsFrameworkButton( visualizations );
|
||||
}
|
||||
|
||||
if( !this.urls.visualization ){
|
||||
this.visualizationsButton = null;
|
||||
return null;
|
||||
}
|
||||
|
||||
var dbkey = this.model.get( 'dbkey' ),
|
||||
visualizations = this.model.get( 'visualizations' ),
|
||||
visualization_url = this.urls.visualization,
|
||||
popup_menu_dict = {},
|
||||
params = {
|
||||
@@ -250,17 +267,10 @@ var HDAEditView = HDABaseView.extend( LoggableMixin ).extend(
|
||||
// Add dbkey to params if it exists.
|
||||
if( dbkey ){ params.dbkey = dbkey; }
|
||||
|
||||
if( !( this.model.hasData() )
|
||||
|| !( visualizations && visualizations.length )
|
||||
|| !( visualization_url ) ){
|
||||
this.visualizationsButton = null;
|
||||
return null;
|
||||
}
|
||||
|
||||
// render the icon from template
|
||||
this.visualizationsButton = new IconButtonView({ model : new IconButton({
|
||||
title : _l( 'Visualize' ),
|
||||
href : visualization_url,
|
||||
href : this.urls.visualization,
|
||||
icon_class : 'chart_curve'
|
||||
})});
|
||||
var $icon = this.visualizationsButton.render().$el;
|
||||
@@ -278,15 +288,14 @@ var HDAEditView = HDABaseView.extend( LoggableMixin ).extend(
|
||||
case 'scatterplot':
|
||||
return create_scatterplot_action_fn( visualization_url, params );
|
||||
default:
|
||||
return function(){
|
||||
// add widget
|
||||
return function(){// add widget
|
||||
parent.frame_manager.frame_new(
|
||||
{
|
||||
title : "Visualization",
|
||||
type : "url",
|
||||
content : visualization_url + '/' + visualization + '?' + $.param( params )
|
||||
});
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,6 +315,40 @@ var HDAEditView = HDABaseView.extend( LoggableMixin ).extend(
|
||||
}
|
||||
return $icon;
|
||||
},
|
||||
|
||||
/** Render an icon-button or popupmenu of links based on the applicable visualizations
|
||||
* @returns {jQuery} rendered DOM
|
||||
*/
|
||||
_render_visualizationsFrameworkButton : function( visualizations ){
|
||||
if( !( this.model.hasData() )
|
||||
|| !( visualizations && !_.isEmpty( visualizations ) ) ){
|
||||
this.visualizationsButton = null;
|
||||
return null;
|
||||
}
|
||||
|
||||
// render the icon from template
|
||||
this.visualizationsButton = new IconButtonView({ model : new IconButton({
|
||||
title : _l( 'Visualize' ),
|
||||
icon_class : 'chart_curve'
|
||||
})});
|
||||
var $icon = this.visualizationsButton.render().$el;
|
||||
$icon.addClass( 'visualize-icon' ); // needed?
|
||||
|
||||
// No need for popup menu because there's a single visualization.
|
||||
if( _.keys( visualizations ).length === 1 ) {
|
||||
$icon.attr( 'title', _.keys( visualizations )[0] );
|
||||
$icon.attr( 'href', _.values( visualizations )[0] );
|
||||
|
||||
// >1: Populate menu dict with visualization fns, make the popupmenu
|
||||
} else {
|
||||
var popup_menu_options = [];
|
||||
_.each( visualizations, function( linkData ) {
|
||||
popup_menu_options.push( linkData );
|
||||
});
|
||||
var popup = new PopupMenu( $icon, popup_menu_options );
|
||||
}
|
||||
return $icon;
|
||||
},
|
||||
|
||||
// ......................................................................... secondary actions
|
||||
/** Render secondary actions: currently tagging and annotation (if user is allowed).
|
||||
@@ -567,7 +610,6 @@ HDAEditView.templates = {
|
||||
//TODO: should be imported from scatterplot.js OR abstracted to 'load this in the galaxy_main frame'
|
||||
function create_scatterplot_action_fn( url, params ){
|
||||
action = function() {
|
||||
|
||||
// add widget
|
||||
parent.frame_manager.frame_new(
|
||||
{
|
||||
@@ -657,4 +699,4 @@ function create_trackster_action_fn(vis_url, dataset_params, dbkey) {
|
||||
//==============================================================================
|
||||
//return {
|
||||
// HDAView : HDAView,
|
||||
//};});
|
||||
//};});
|
||||
@@ -150,7 +150,7 @@ ${h.js( "mvc/base-mvc", "mvc/user/user-model", "mvc/user/user-quotameter" )}
|
||||
[_('New Track Browser'), "javascript:frame_manager.frame_new({title: 'Trackster', type: 'url', content: '/visualization/trackster'});"],
|
||||
[_('Saved Visualizations'), "javascript:frame_manager.frame_new({ type: 'url', content : '/visualization/list'});" ]
|
||||
]
|
||||
tab( "visualization", _("Visualization"), "javascript:frame_manager.frame_new({title: 'Trackster', type: 'url', content: '/visualization/trackster'});", menu_options=menu_options )
|
||||
tab( "visualization", _("Visualization"), "javascript:frame_manager.frame_new({title: 'Trackster', type: 'url', content: '/visualization/list'});", menu_options=menu_options )
|
||||
%>
|
||||
|
||||
## Cloud menu.
|
||||
|
||||
Reference in New Issue
Block a user