mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Create object to store Galaxy paths for use in JavaScript.
This commit is contained in:
@@ -1,6 +1,16 @@
|
||||
/**
|
||||
* Utility models and views for Galaxy objects.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Necessary Galaxy paths.
|
||||
*/
|
||||
var GalaxyPaths = Backbone.Model.extend({
|
||||
defaults: {
|
||||
root_path: "",
|
||||
image_path: ""
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Clickable button represented as an icon.
|
||||
|
||||
@@ -217,7 +217,7 @@ function show_in_overlay( options ) {
|
||||
hide_modal();
|
||||
$("#overlay-background").unbind( "click.overlay" );
|
||||
});
|
||||
show_modal( null, $( "<div style='margin: -5px;'><img id='close_button' style='position:absolute;right:-17px;top:-15px;src='" + image_path + "/closebox.png'><iframe style='margin: 0; padding: 0;' src='" + options.url + "' width='" + width + "' height='" + height + "' scrolling='" + scroll + "' frameborder='0'></iframe></div>" ) );
|
||||
show_modal( null, $( "<div style='margin: -5px;'><img id='close_button' style='position:absolute;right:-17px;top:-15px;src='" + galaxy_paths.attributes.image_path + "/closebox.png'><iframe style='margin: 0; padding: 0;' src='" + options.url + "' width='" + width + "' height='" + height + "' scrolling='" + scroll + "' frameborder='0'></iframe></div>" ) );
|
||||
$("#close_button").bind( "click", function() { hide_modal(); } );
|
||||
}
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ $.extend( Node.prototype, {
|
||||
.appendTo( "body" )
|
||||
.append(
|
||||
$("<div class='buttons'></div>").append(
|
||||
$("<img/>").attr("src", image_path + '/delete_icon.png').click( function() {
|
||||
$("<img/>").attr("src", galaxy_paths.attributes.image_path + '/delete_icon.png').click( function() {
|
||||
$.each( terminal.connectors, function( _, x ) {
|
||||
x.destroy();
|
||||
});
|
||||
@@ -335,13 +335,13 @@ $.extend( Node.prototype, {
|
||||
.css( { display: 'none' } )
|
||||
.append(
|
||||
$("<div class='buttons'></div>").append(
|
||||
$("<img/>").attr('src', image_path + '/fugue/asterisk-small-outline.png').click( function() {
|
||||
$("<img/>").attr('src', galaxy_paths.attributes.image_path + '/fugue/asterisk-small-outline.png').click( function() {
|
||||
if ($.inArray(output.name, node.workflow_outputs) != -1){
|
||||
node.workflow_outputs.splice($.inArray(output.name, node.workflow_outputs), 1);
|
||||
callout.find('img').attr('src', image_path + '/fugue/asterisk-small-outline.png');
|
||||
callout.find('img').attr('src', galaxy_paths.attributes.image_path + '/fugue/asterisk-small-outline.png');
|
||||
}else{
|
||||
node.workflow_outputs.push(output.name);
|
||||
callout.find('img').attr('src', image_path + '/fugue/asterisk-small.png');
|
||||
callout.find('img').attr('src', galaxy_paths.attributes.image_path + '/fugue/asterisk-small.png');
|
||||
}
|
||||
workflow.has_changes = true;
|
||||
canvas_manager.draw_overview();
|
||||
@@ -355,19 +355,19 @@ $.extend( Node.prototype, {
|
||||
callout.show();
|
||||
r.append(callout);
|
||||
if ($.inArray(output.name, node.workflow_outputs) === -1){
|
||||
callout.find('img').attr('src', image_path + '/fugue/asterisk-small-outline.png');
|
||||
callout.find('img').attr('src', galaxy_paths.attributes.image_path + '/fugue/asterisk-small-outline.png');
|
||||
}else{
|
||||
callout.find('img').attr('src', image_path + '/fugue/asterisk-small.png');
|
||||
callout.find('img').attr('src', galaxy_paths.attributes.image_path + '/fugue/asterisk-small.png');
|
||||
}
|
||||
r.hover(
|
||||
function(){
|
||||
callout.find('img').attr('src', image_path + '/fugue/asterisk-small-yellow.png');
|
||||
callout.find('img').attr('src', galaxy_paths.attributes.image_path + '/fugue/asterisk-small-yellow.png');
|
||||
},
|
||||
function(){
|
||||
if ($.inArray(output.name, node.workflow_outputs) === -1){
|
||||
callout.find('img').attr('src', image_path + '/fugue/asterisk-small-outline.png');
|
||||
callout.find('img').attr('src', galaxy_paths.attributes.image_path + '/fugue/asterisk-small-outline.png');
|
||||
}else{
|
||||
callout.find('img').attr('src', image_path + '/fugue/asterisk-small.png');
|
||||
callout.find('img').attr('src', galaxy_paths.attributes.image_path + '/fugue/asterisk-small.png');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -793,18 +793,18 @@ function prebuild_node( type, title_text, tool_id ) {
|
||||
f.append( title );
|
||||
f.css( "left", $(window).scrollLeft() + 20 ); f.css( "top", $(window).scrollTop() + 20 );
|
||||
var b = $("<div class='toolFormBody'></div>");
|
||||
var tmp = "<div><img height='16' align='middle' src='" +image_path+ "/loading_small_white_bg.gif'/> loading tool info...</div>";
|
||||
var tmp = "<div><img height='16' align='middle' src='" +galaxy_paths.attributes.image_path+ "/loading_small_white_bg.gif'/> loading tool info...</div>";
|
||||
b.append( tmp );
|
||||
node.form_html = tmp;
|
||||
f.append( b );
|
||||
// Fix width to computed width
|
||||
// Now add floats
|
||||
var buttons = $("<div class='buttons' style='float: right;'></div>");
|
||||
buttons.append( $("<img/>").attr("src", image_path + '/delete_icon.png').click( function( e ) {
|
||||
buttons.append( $("<img/>").attr("src", galaxy_paths.attributes.image_path + '/delete_icon.png').click( function( e ) {
|
||||
node.destroy();
|
||||
} ).hover(
|
||||
function() { $(this).attr( "src", image_path + "/delete_icon_dark.png" ); },
|
||||
function() { $(this).attr( "src", image_path + "/delete_icon.png" ); }
|
||||
function() { $(this).attr( "src", galaxy_paths.attributes.image_path + "/delete_icon_dark.png" ); },
|
||||
function() { $(this).attr( "src", galaxy_paths.attributes.image_path + "/delete_icon.png" ); }
|
||||
) );
|
||||
// Place inside container
|
||||
f.appendTo( "#canvas-container" );
|
||||
|
||||
@@ -1 +1 @@
|
||||
var IconButton=Backbone.Model.extend({defaults:{title:"",icon_class:"",on_click:null}});var IconButtonCollection=Backbone.Collection.extend({model:IconButton});var IconButtonView=Backbone.View.extend({tagName:"a",className:"icon-button menu-button",events:{click:"on_click"},render:function(){this.$el.attr("href","javascript:void(0)").attr("title",this.model.attributes.title).addClass(this.model.attributes.icon_class);return this},on_click:function(){this.model.attributes.on_click()}});var IconButtonMenuView=Backbone.View.extend({tagName:"div",render:function(){var a=this;this.collection.each(function(c){var b=new IconButtonView({model:c});b.render();a.$el.append(b.$el)});return this}});var Grid=Backbone.Collection.extend({});var GridView=Backbone.View.extend({});
|
||||
var GalaxyPaths=Backbone.Model.extend({defaults:{root_path:"",image_path:""}});var IconButton=Backbone.Model.extend({defaults:{title:"",icon_class:"",on_click:null}});var IconButtonCollection=Backbone.Collection.extend({model:IconButton});var IconButtonMenuView=Backbone.View.extend({tagName:"div",render:function(){var a=this;this.collection.each(function(b){$("<a/>").attr("href","javascript:void(0)").attr("title",b.attributes.title).addClass("icon-button menu-button").addClass(b.attributes.icon_class).appendTo(a.$el).click(b.attributes.on_click)});return this}});var Grid=Backbone.Collection.extend({});var GridView=Backbone.View.extend({});
|
||||
@@ -1 +1 @@
|
||||
!function(c,d){var e=function(){if(d("#DD-helper").length==0){d("<div id='DD-helper'/>").css({background:"white",opacity:0,zIndex:9000,position:"absolute",top:0,left:0,width:"100%",height:"100%"}).appendTo("body").hide()}};var b=150,h=800;var k=function(n){this.$panel=n.panel;this.$center=n.center;this.$drag=n.drag;this.$toggle=n.toggle;this.left=!n.right;this.hidden=false;this.hidden_by_tool=false;this.saved_size=null;this.init()};d.extend(k.prototype,{resize:function(n){this.$panel.css("width",n);if(this.left){this.$center.css("left",n)}else{this.$center.css("right",n)}if(document.recalc){document.recalc()}},do_toggle:function(){var n=this;if(this.hidden){this.$toggle.removeClass("hidden");if(this.left){this.$panel.css("left",-this.saved_size).show().animate({left:0},"fast",function(){n.resize(n.saved_size)})}else{this.$panel.css("right",-this.saved_size).show().animate({right:0},"fast",function(){n.resize(n.saved_size)})}n.hidden=false}else{n.saved_size=this.$panel.width();if(document.recalc){document.recalc()}if(this.left){this.$panel.animate({left:-this.saved_size},"fast")}else{this.$panel.animate({right:-this.saved_size},"fast")}if(this.left){this.$center.css("left",0)}else{this.$center.css("right",0)}n.hidden=true;n.$toggle.addClass("hidden")}this.hidden_by_tool=false},handle_minwidth_hint:function(n){var o=this.$center.width()-(this.hidden?this.saved_size:0);if(o<n){if(!this.hidden){this.do_toggle();this.hidden_by_tool=true}}else{if(this.hidden_by_tool){this.do_toggle();this.hidden_by_tool=false}}},force_panel:function(n){if((this.hidden&&n=="show")||(!this.hidden&&n=="hide")){this.do_toggle()}},init:function(){var n=this;this.$toggle.remove().appendTo("body");this.$drag.on("dragstart",function(o,p){d("#DD-helper").show();p.width=n.$panel.width()}).on("dragend",function(){d("#DD-helper").hide()}).on("drag",function(p,q){var o;if(n.left){o=q.width+q.deltaX}else{o=q.width-q.deltaX}o=Math.min(h,Math.max(b,o));n.resize(o)});n.$toggle.on("click",function(){n.do_toggle()})}});var f=function(n){this.$overlay=n.overlay;this.$dialog=n.dialog;this.$header=this.$dialog.find(".modal-header");this.$body=this.$dialog.find(".modal-body");this.$footer=this.$dialog.find(".modal-footer");this.$backdrop=n.backdrop};d.extend(f.prototype,{setContent:function(p){if(p.title){this.$header.find(".title").html(p.title);this.$header.show()}else{this.$header.hide()}this.$footer.hide();var o=this.$footer.find(".buttons").html("");if(p.buttons){d.each(p.buttons,function(r,s){o.append(d("<button></button> ").text(r).click(s)).append(" ")});this.$footer.show()}var q=this.$footer.find(".extra_buttons").html("");if(p.extra_buttons){d.each(p.extra_buttons,function(r,s){q.append(d("<button></button>").text(r).click(s)).append(" ")});this.$footer.show()}var n=p.body;if(n=="progress"){n=d("<div class='progress progress-striped active'><div class='bar' style='width: 100%'></div></div>")}this.$body.html(n)},show:function(n,o){if(!this.$dialog.is(":visible")){if(n.backdrop){this.$backdrop.addClass("in")}else{this.$backdrop.removeClass("in")}this.$overlay.show();this.$dialog.show();this.$body.css("min-width",this.$body.width())}if(o){o()}},hide:function(){var n=this;n.$dialog.fadeOut(function(){n.$overlay.hide();n.$backdrop.removeClass("in");n.$body.children().remove();n.$body.css("min-width",undefined)})}});var m;d(function(){m=new f({overlay:d("#overlay"),dialog:d("#dialog-box"),backdrop:d("#overlay-background")})});function a(){m.hide()}function l(r,n,p,o,q){m.setContent({title:r,body:n,buttons:p,extra_buttons:o});m.show({backdrop:true},q)}function g(r,n,p,o,q){m.setContent({title:r,body:n,buttons:p,extra_buttons:o});m.show({backdrop:false},q)}function j(p){var q=p.width||"600";var o=p.height||"400";var n=p.scroll||"auto";d("#overlay-background").bind("click.overlay",function(){a();d("#overlay-background").unbind("click.overlay")});l(null,d("<div style='margin: -5px;'><img id='close_button' style='position:absolute;right:-17px;top:-15px;src='"+image_path+"/closebox.png'><iframe style='margin: 0; padding: 0;' src='"+p.url+"' width='"+q+"' height='"+o+"' scrolling='"+n+"' frameborder='0'></iframe></div>"));d("#close_button").bind("click",function(){a()})}function i(n,o){if(n){d(".loggedin-only").show();d(".loggedout-only").hide();d("#user-email").text(n);if(o){d(".admin-only").show()}}else{d(".loggedin-only").hide();d(".loggedout-only").show();d(".admin-only").hide()}}d(function(){var n=d("#masthead ul.nav > li.dropdown > .dropdown-menu");d("body").on("click.nav_popups",function(p){n.hide();d("#DD-helper").hide();if(d(p.target).closest("#masthead ul.nav > li.dropdown > .dropdown-menu").length){return}var o=d(p.target).closest("#masthead ul.nav > li.dropdown");if(o.length){d("#DD-helper").show();o.children(".dropdown-menu").show();p.preventDefault()}})});c.ensure_dd_helper=e;c.Panel=k;c.Modal=f;c.hide_modal=a;c.show_modal=l;c.show_message=g;c.show_in_overlay=j;c.user_changed=i}(window,window.jQuery);
|
||||
!function(c,d){var e=function(){if(d("#DD-helper").length==0){d("<div id='DD-helper'/>").css({background:"white",opacity:0,zIndex:9000,position:"absolute",top:0,left:0,width:"100%",height:"100%"}).appendTo("body").hide()}};var b=150,h=800;var k=function(n){this.$panel=n.panel;this.$center=n.center;this.$drag=n.drag;this.$toggle=n.toggle;this.left=!n.right;this.hidden=false;this.hidden_by_tool=false;this.saved_size=null;this.init()};d.extend(k.prototype,{resize:function(n){this.$panel.css("width",n);if(this.left){this.$center.css("left",n)}else{this.$center.css("right",n)}if(document.recalc){document.recalc()}},do_toggle:function(){var n=this;if(this.hidden){this.$toggle.removeClass("hidden");if(this.left){this.$panel.css("left",-this.saved_size).show().animate({left:0},"fast",function(){n.resize(n.saved_size)})}else{this.$panel.css("right",-this.saved_size).show().animate({right:0},"fast",function(){n.resize(n.saved_size)})}n.hidden=false}else{n.saved_size=this.$panel.width();if(document.recalc){document.recalc()}if(this.left){this.$panel.animate({left:-this.saved_size},"fast")}else{this.$panel.animate({right:-this.saved_size},"fast")}if(this.left){this.$center.css("left",0)}else{this.$center.css("right",0)}n.hidden=true;n.$toggle.addClass("hidden")}this.hidden_by_tool=false},handle_minwidth_hint:function(n){var o=this.$center.width()-(this.hidden?this.saved_size:0);if(o<n){if(!this.hidden){this.do_toggle();this.hidden_by_tool=true}}else{if(this.hidden_by_tool){this.do_toggle();this.hidden_by_tool=false}}},force_panel:function(n){if((this.hidden&&n=="show")||(!this.hidden&&n=="hide")){this.do_toggle()}},init:function(){var n=this;this.$toggle.remove().appendTo("body");this.$drag.on("dragstart",function(o,p){d("#DD-helper").show();p.width=n.$panel.width()}).on("dragend",function(){d("#DD-helper").hide()}).on("drag",function(p,q){var o;if(n.left){o=q.width+q.deltaX}else{o=q.width-q.deltaX}o=Math.min(h,Math.max(b,o));n.resize(o)});n.$toggle.on("click",function(){n.do_toggle()})}});var f=function(n){this.$overlay=n.overlay;this.$dialog=n.dialog;this.$header=this.$dialog.find(".modal-header");this.$body=this.$dialog.find(".modal-body");this.$footer=this.$dialog.find(".modal-footer");this.$backdrop=n.backdrop};d.extend(f.prototype,{setContent:function(p){if(p.title){this.$header.find(".title").html(p.title);this.$header.show()}else{this.$header.hide()}this.$footer.hide();var o=this.$footer.find(".buttons").html("");if(p.buttons){d.each(p.buttons,function(r,s){o.append(d("<button></button> ").text(r).click(s)).append(" ")});this.$footer.show()}var q=this.$footer.find(".extra_buttons").html("");if(p.extra_buttons){d.each(p.extra_buttons,function(r,s){q.append(d("<button></button>").text(r).click(s)).append(" ")});this.$footer.show()}var n=p.body;if(n=="progress"){n=d("<div class='progress progress-striped active'><div class='bar' style='width: 100%'></div></div>")}this.$body.html(n)},show:function(n,o){if(!this.$dialog.is(":visible")){if(n.backdrop){this.$backdrop.addClass("in")}else{this.$backdrop.removeClass("in")}this.$overlay.show();this.$dialog.show();this.$body.css("min-width",this.$body.width())}if(o){o()}},hide:function(){var n=this;n.$dialog.fadeOut(function(){n.$overlay.hide();n.$backdrop.removeClass("in");n.$body.children().remove();n.$body.css("min-width",undefined)})}});var m;d(function(){m=new f({overlay:d("#overlay"),dialog:d("#dialog-box"),backdrop:d("#overlay-background")})});function a(){m.hide()}function l(r,n,p,o,q){m.setContent({title:r,body:n,buttons:p,extra_buttons:o});m.show({backdrop:true},q)}function g(r,n,p,o,q){m.setContent({title:r,body:n,buttons:p,extra_buttons:o});m.show({backdrop:false},q)}function j(p){var q=p.width||"600";var o=p.height||"400";var n=p.scroll||"auto";d("#overlay-background").bind("click.overlay",function(){a();d("#overlay-background").unbind("click.overlay")});l(null,d("<div style='margin: -5px;'><img id='close_button' style='position:absolute;right:-17px;top:-15px;src='"+galaxy_paths.attributes.image_path+"/closebox.png'><iframe style='margin: 0; padding: 0;' src='"+p.url+"' width='"+q+"' height='"+o+"' scrolling='"+n+"' frameborder='0'></iframe></div>"));d("#close_button").bind("click",function(){a()})}function i(n,o){if(n){d(".loggedin-only").show();d(".loggedout-only").hide();d("#user-email").text(n);if(o){d(".admin-only").show()}}else{d(".loggedin-only").hide();d(".loggedout-only").show();d(".admin-only").hide()}}d(function(){var n=d("#masthead ul.nav > li.dropdown > .dropdown-menu");d("body").on("click.nav_popups",function(p){n.hide();d("#DD-helper").hide();if(d(p.target).closest("#masthead ul.nav > li.dropdown > .dropdown-menu").length){return}var o=d(p.target).closest("#masthead ul.nav > li.dropdown");if(o.length){d("#DD-helper").show();o.children(".dropdown-menu").show();p.preventDefault()}})});c.ensure_dd_helper=e;c.Panel=k;c.Modal=f;c.hide_modal=a;c.show_modal=l;c.show_message=g;c.show_in_overlay=j;c.user_changed=i}(window,window.jQuery);
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -207,8 +207,7 @@ extend( CanvasManager.prototype, {
|
||||
var patterns = this.patterns,
|
||||
dummy_context = this.dummy_context,
|
||||
image = new Image();
|
||||
// FIXME: where does image_path come from? not in browser.mako...
|
||||
image.src = image_path + path;
|
||||
image.src = galaxy_paths.attributes.image_path + path;
|
||||
image.onload = function() {
|
||||
patterns[key] = dummy_context.createPattern( image, "repeat" );
|
||||
}
|
||||
|
||||
@@ -27,6 +27,13 @@
|
||||
## <script type='text/javascript' src="/static/scripts/IE7.js"> </script>
|
||||
## <![endif]-->
|
||||
${h.js( "jquery", "galaxy.base", "libs/underscore", "libs/backbone", "libs/handlebars.runtime", "backbone/ui" )}
|
||||
<script type="text/javascript">
|
||||
// Set up needed paths.
|
||||
var galaxy_paths = new GalaxyPaths({
|
||||
root_path: '${h.url_for( "/" )}',
|
||||
image_path: '${h.url_for( "/static/images" )}'
|
||||
});
|
||||
</script>
|
||||
</%def>
|
||||
|
||||
## Additional metas can be defined by templates inheriting from this one.
|
||||
|
||||
@@ -47,10 +47,14 @@
|
||||
<!--[if lt IE 7]>
|
||||
${h.js( 'IE7', 'ie7-recalc' )}
|
||||
<![endif]-->
|
||||
<script type="text/javascript">
|
||||
var image_path = '${h.url_for("/static/images")}';
|
||||
</script>
|
||||
${h.js( 'jquery', 'libs/underscore', 'libs/backbone', 'libs/handlebars.runtime', 'backbone/ui' )}
|
||||
<script type="text/javascript">
|
||||
// Set up needed paths.
|
||||
var galaxy_paths = new GalaxyPaths({
|
||||
root_path: '${h.url_for( "/" )}',
|
||||
image_path: '${h.url_for( "/static/images" )}'
|
||||
});
|
||||
</script>
|
||||
</%def>
|
||||
|
||||
## Default late-load javascripts
|
||||
|
||||
Reference in New Issue
Block a user