commit/galaxy-central: 7 new changesets
7 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/f11e8aa26fcc/ changeset: f11e8aa26fcc user: jgoecks date: 2012-04-12 20:14:00 summary: More client-side support for tools: (a) include different attributes in dict depending on params; (b) framework for dictifying inputs; (c) support for getting tool description by id via API. affected #: 2 files diff -r 84d49e39069d965a45097ade1b71a57cdc0a0386 -r f11e8aa26fcc88b9fa92e752000b092cfefce88c lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -598,7 +598,7 @@ """ Return a dict that includes section's attributes. """ section_elts = [] for key, val in self.elems.items(): - section_elts.append( val.to_dict( trans ) ) + section_elts.append( val.to_dict( trans, for_link=True ) ) return { 'type': 'section', 'id': self.id, 'name': self.name, 'version': self.version, 'elems': section_elts } class ToolSectionLabel( object ): @@ -611,7 +611,7 @@ self.id = elem.get( "id" ) self.version = elem.get( "version" ) or '' - def to_dict( self, trans ): + def to_dict( self, trans, **kwargs ): """ Return a dict that includes label's attributes. """ return { 'type': 'label', 'id': self.id, 'name': self.text, 'version': self.version } @@ -691,6 +691,14 @@ def __iter__( self ): return iter( ( self.format, self.metadata_source, self.parent ) ) + + def to_dict( self ): + return { + 'name': self.name, + 'format': self.format, + 'label': self.label, + 'hidden': self.hidden + } class ToolRequirement( object ): """ @@ -2392,20 +2400,48 @@ return True return False - def to_dict( self, trans ): - """ Return dict of tool attributes. """ + def to_dict( self, trans, for_link=False, for_display=False ): + """ Returns dict of tool. """ - # Create tool link. - if not self.tool_type.startswith( 'data_source' ): - link = url_for( controller='tool_runner', tool_id=self.id ) - else: - link = url_for( self.action, **self.get_static_param_values( trans ) ) + # Basic information + tool_dict = { 'id': self.id, 'name': self.name, + 'version': self.version, 'description': self.description } + + if for_link: + # Create tool link. + if not self.tool_type.startswith( 'data_source' ): + link = url_for( controller='tool_runner', tool_id=self.id ) + else: + link = url_for( self.action, **self.get_static_param_values( trans ) ) - return { 'type': 'tool', 'id': self.id, 'name': self.name, 'link': link, - 'version': self.version, 'description': self.description, - 'min_width': self.uihints.get( 'minwidth', -1 ), - 'target': self.target, - 'hidden': self._is_hidden_for_user( trans.user ) } + # Basic information + tool_dict.update( { 'type': 'tool', 'link': link, + 'min_width': self.uihints.get( 'minwidth', -1 ), + 'target': self.target } ) + + if for_display: + # Dictify inputs. + inputs = [] + for name, input in self.inputs.items(): + param_dict = { 'name' : name, 'label' : input.label } + if isinstance( input, DataToolParameter ): + param_dict.update( { 'type' : 'data', 'html' : urllib.quote( input.get_html( trans ) ) } ) + elif isinstance( input, SelectToolParameter ): + param_dict.update( { 'type' : 'select', 'html' : urllib.quote( input.get_html( trans ) ) } ) + elif isinstance( input, Conditional ): + # TODO. + pass + else: + param_dict.update( { 'type' : '??', 'init_value' : input.value, \ + 'html' : urllib.quote( input.get_html( trans ) ) } ) + inputs.append( param_dict ) + + tool_dict[ 'inputs' ] = inputs + + # Dictify outputs. + pass + + return tool_dict class DataSourceTool( Tool ): """ diff -r 84d49e39069d965a45097ade1b71a57cdc0a0386 -r f11e8aa26fcc88b9fa92e752000b092cfefce88c lib/galaxy/web/api/tools.py --- a/lib/galaxy/web/api/tools.py +++ b/lib/galaxy/web/api/tools.py @@ -6,7 +6,7 @@ RESTful controller for interactions with tools. """ - @web.json + @web.expose_api def index( self, trans, **kwds ): """ GET /api/tools: returns a list of tools defined by parameters @@ -22,11 +22,11 @@ # Create return value. return self.app.toolbox.to_dict( trans, in_panel=in_panel, trackster=trackster ) - @web.expose_api + @web.json def show( self, trans, id, **kwd ): """ GET /api/tools/{tool_id} Returns tool information, including parameters and inputs. """ - return self.app.toolbox.tools_by_id[ id ].to_dict( trans, all=True ) + return self.app.toolbox.tools_by_id[ id ].to_dict( trans, for_display=True ) \ No newline at end of file https://bitbucket.org/galaxy/galaxy-central/changeset/272506e479f5/ changeset: 272506e479f5 user: jgoecks date: 2012-04-12 20:18:44 summary: Basic support for dynamically displaying tool forms. affected #: 7 files diff -r f11e8aa26fcc88b9fa92e752000b092cfefce88c -r 272506e479f54d41b345c373786c23cab57cc153 static/june_2007_style/base.less --- a/static/june_2007_style/base.less +++ b/static/june_2007_style/base.less @@ -1632,7 +1632,7 @@ margin-top: 5px; } -.unified-panel-body > .toolMenu { +.unified-panel-body .toolMenu { padding: 10px; } @@ -1717,5 +1717,13 @@ padding:2px 10px; } +// ==== Integrated tool form styles + +.toolMenuAndView .toolForm +{ + float: left; + background-color: white; + margin: 10px; +} @import "base_sprites"; diff -r f11e8aa26fcc88b9fa92e752000b092cfefce88c -r 272506e479f54d41b345c373786c23cab57cc153 static/june_2007_style/blue/base.css --- a/static/june_2007_style/blue/base.css +++ b/static/june_2007_style/blue/base.css @@ -713,7 +713,7 @@ 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;} -.unified-panel-body>.toolMenu{padding:10px;} +.unified-panel-body .toolMenu{padding:10px;} div.toolSectionPad{margin:0;padding:0;height:5px;font-size:0px;} div.toolSectionWrapper{margin-bottom:5px;} div.toolSectionDetailsInner{margin-left:5px;margin-right:5px;} @@ -725,6 +725,7 @@ #tool-search{padding-top:5px;padding-bottom:10px;position:relative;} #loading_indicator{position:fixed;right:10px;top:10px;height:32px;width:32px;background:url(largespinner.gif);} #content_table td{text-align:right;white-space:nowrap;padding:2px 10px;} +.toolMenuAndView .toolForm{float:left;background-color:white;margin:10px;} .icon-button.display{background:url(history-buttons.png) no-repeat 0px 0px;} .icon-button.display:hover{background:url(history-buttons.png) no-repeat 0px -26px;} .icon-button.display_disabled{background:url(history-buttons.png) no-repeat 0px -52px;} diff -r f11e8aa26fcc88b9fa92e752000b092cfefce88c -r 272506e479f54d41b345c373786c23cab57cc153 static/scripts/backbone/tools.js --- a/static/scripts/backbone/tools.js +++ b/static/scripts/backbone/tools.js @@ -8,7 +8,7 @@ * Simple base model for any visible element. Includes useful attributes and ability * to set and track visibility. */ -var BaseModel = Backbone.Model.extend({ +var BaseModel = Backbone.RelationalModel.extend({ defaults: { name: null, hidden: false @@ -35,9 +35,22 @@ defaults: { description: null, target: null, - params: [] + inputs: [] }, + relations: [ + { + type: Backbone.HasMany, + key: 'inputs', + relatedModel: 'ToolInput', + reverseRelation: { + key: 'tool' + } + } + ], + + urlRoot: galaxy_paths.attributes.root_path + 'api/tools', + apply_search_results: function(results) { ( _.indexOf(results, this.attributes.id) !== -1 ? this.show() : this.hide() ); return this.is_visible(); @@ -45,6 +58,17 @@ }); /** + * A tool input. + */ +var ToolInput = Backbone.RelationalModel.extend({ + + initialize: function() { + this.attributes.html = unescape(this.attributes.html); + } + +}); + +/** * Wrap collection of tools for fast access/manipulation. */ var ToolCollection = Backbone.Collection.extend({ @@ -379,6 +403,10 @@ } }); +/** + * Tool panel view. Events triggered include: + * tool_link_click(click event, tool_model) + */ var ToolPanelView = Backbone.View.extend({ tagName: 'div', className: 'toolMenu', @@ -386,13 +414,8 @@ /** * Waits for collection to load and then renders. */ - initialize: function(options) { + initialize: function() { this.collection.tool_search.on("change:results", this.handle_search_results, this); - - this.tool_link_click_fn = null; - if (options && 'tool_link_click_fn' in options) { - this.tool_link_click_fn = options.tool_link_click_fn; - } }, render: function() { @@ -422,16 +445,15 @@ } }); - // Setup tool link click handling. - if (self.tool_link_click_fn) { - self.$el.find("a.tool-link").click(function() { - // Tool id is always the first class. - var tool_id = $(this).attr('class').split(/\s+/)[0]; + // Setup tool link click eventing. + self.$el.find("a.tool-link").click(function(e) { + // Tool id is always the first class. + var + tool_id = $(this).attr('class').split(/\s+/)[0], + tool = self.collection.tools.get(tool_id); - self.tool_link_click_fn(self.collection.tools.get(tool_id)); - return false; - }); - } + self.trigger("tool_link_click", e, tool); + }); return this; }, @@ -446,3 +468,62 @@ } } }); + +/** + * View for working with a tool: setting parameters and inputs and executing the tool. + */ +var ToolFormView = Backbone.View.extend({ + className: 'toolForm', + template: Handlebars.templates.tool_form, + + render: function() { + this.$el.children().remove(); + this.$el.append( this.template(this.model.toJSON()) ); + } +}); + + +/** + * Integrated tool menu + tool execution. + */ +var IntegratedToolMenuAndView = Backbone.View.extend({ + className: 'toolMenuAndView', + + initialize: function() { + this.tool_panel_view = new ToolPanelView({collection: this.collection}); + this.tool_form_view = new ToolFormView(); + }, + + render: function() { + // Render and append tool panel. + this.tool_panel_view.render(); + this.tool_panel_view.$el.css("float", "left"); + this.$el.append(this.tool_panel_view.$el); + + // Append tool form view. + this.tool_form_view.$el.hide(); + this.$el.append(this.tool_form_view.$el); + + // On tool link click, show tool. + var self = this; + this.tool_panel_view.on("tool_link_click", function(e, tool) { + // Prevents click from activating link: + e.preventDefault(); + // Show tool that was clicked on: + self.show_tool(tool); + }); + }, + + /** + * Fetch and display tool. + */ + show_tool: function(tool) { + var self = this; + tool.fetch().done( function() { + self.tool_form_view.model = tool; + self.tool_form_view.render(); + self.tool_form_view.$el.show(); + $('#left').width("650px"); + }); + } +}); \ No newline at end of file diff -r f11e8aa26fcc88b9fa92e752000b092cfefce88c -r 272506e479f54d41b345c373786c23cab57cc153 static/scripts/handlebars/compiled/tool_form.js --- /dev/null +++ b/static/scripts/handlebars/compiled/tool_form.js @@ -0,0 +1,61 @@ +(function() { + var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; +templates['tool_form'] = template(function (Handlebars,depth0,helpers,partials,data) { + helpers = helpers || Handlebars.helpers; + var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression; + +function program1(depth0,data) { + + var buffer = "", stack1; + buffer += "\n <div class=\"form-row\">\n <label for=\""; + foundHelper = helpers.name; + stack1 = foundHelper || depth0.name; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } + buffer += escapeExpression(stack1) + "\">"; + foundHelper = helpers.label; + stack1 = foundHelper || depth0.label; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "label", { hash: {} }); } + buffer += escapeExpression(stack1) + ":</label>\n <div class=\"form-row-input\">\n "; + foundHelper = helpers.html; + stack1 = foundHelper || depth0.html; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "html", { hash: {} }); } + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\n </div>\n <div class=\"toolParamHelp\" style=\"clear: both;\">\n "; + foundHelper = helpers.help; + stack1 = foundHelper || depth0.help; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "help", { hash: {} }); } + buffer += escapeExpression(stack1) + "\n </div>\n <div style=\"clear: both;\"></div>\n </div>\n "; + return buffer;} + + buffer += "<div class=\"toolFormTitle\">"; + foundHelper = helpers.name; + stack1 = foundHelper || depth0.name; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } + buffer += escapeExpression(stack1) + " (version "; + foundHelper = helpers.version; + stack1 = foundHelper || depth0.version; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "version", { hash: {} }); } + buffer += escapeExpression(stack1) + ")</div>\n <div class=\"toolFormBody\">\n "; + foundHelper = helpers.inputs; + stack1 = foundHelper || depth0.inputs; + stack2 = helpers.each; + tmp1 = self.program(1, program1, data); + tmp1.hash = {}; + tmp1.fn = tmp1; + tmp1.inverse = self.noop; + stack1 = stack2.call(depth0, stack1, tmp1); + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\n </div>\n <div class=\"form-row form-actions\">\n <input type=\"submit\" class=\"btn btn-primary\" name=\"runtool_btn\" value=\"Execute\">\n</div>\n<div class=\"toolHelp\">\n <div class=\"toolHelpBody\">"; + foundHelper = helpers.help; + stack1 = foundHelper || depth0.help; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "help", { hash: {} }); } + buffer += escapeExpression(stack1) + "</div>\n</div>"; + return buffer;}); +})(); \ No newline at end of file diff -r f11e8aa26fcc88b9fa92e752000b092cfefce88c -r 272506e479f54d41b345c373786c23cab57cc153 static/scripts/handlebars/tool_form.handlebars --- /dev/null +++ b/static/scripts/handlebars/tool_form.handlebars @@ -0,0 +1,21 @@ +<div class="toolFormTitle">{{name}} (version {{version}})</div> + <div class="toolFormBody"> + {{#each inputs}} + <div class="form-row"> + <label for="{{name}}">{{label}}:</label> + <div class="form-row-input"> + {{{html}}} + </div> + <div class="toolParamHelp" style="clear: both;"> + {{help}} + </div> + <div style="clear: both;"></div> + </div> + {{/each}} + </div> + <div class="form-row form-actions"> + <input type="submit" class="btn btn-primary" name="runtool_btn" value="Execute"> +</div> +<div class="toolHelp"> + <div class="toolHelpBody">{{help}}</div> +</div> \ No newline at end of file diff -r f11e8aa26fcc88b9fa92e752000b092cfefce88c -r 272506e479f54d41b345c373786c23cab57cc153 static/scripts/packed/backbone/tools.js --- a/static/scripts/packed/backbone/tools.js +++ b/static/scripts/packed/backbone/tools.js @@ -1,1 +1,1 @@ -var BaseModel=Backbone.Model.extend({defaults:{name:null,hidden:false},show:function(){this.set("hidden",false)},hide:function(){this.set("hidden",true)},is_visible:function(){return !this.attributes.hidden}});var Tool=BaseModel.extend({defaults:{description:null,target:null,params:[]},apply_search_results:function(a){(_.indexOf(a,this.attributes.id)!==-1?this.show():this.hide());return this.is_visible()}});var ToolPanelLabel=BaseModel.extend({});var ToolPanelSection=BaseModel.extend({defaults:{elems:[],open:false},clear_search_results:function(){_.each(this.attributes.elems,function(a){a.show()});this.show();this.set("open",false)},apply_search_results:function(b){var c=true,a;_.each(this.attributes.elems,function(d){if(d instanceof ToolPanelLabel){a=d;a.hide()}else{if(d instanceof Tool){if(d.apply_search_results(b)){c=false;if(a){a.show()}}}}});if(c){this.hide()}else{this.show();this.set("open",true)}}});var ToolSearch=BaseModel.extend({defaults:{spinner_url:"",search_url:"",visible:true,query:"",results:null},initialize:function(){this.on("change:query",this.do_search)},do_search:function(){var c=this.attributes.query;if(c.length<3){this.set("results",null);return}var b=c+"*";if(this.timer){clearTimeout(this.timer)}$("#search-spinner").show();var a=this;this.timer=setTimeout(function(){$.get(a.attributes.search_url,{query:b},function(d){a.set("results",d);$("#search-spinner").hide()},"json")},200)}});var ToolPanel=Backbone.Collection.extend({url:"/tools",parse:function(a){var b=function(e){var d=e.type;if(d==="tool"){return new Tool(e)}else{if(d==="section"){var c=_.map(e.elems,b);e.elems=c;return new ToolPanelSection(e)}else{if(d==="label"){return new ToolPanelLabel(e)}}}};return _.map(a,b)},initialize:function(a){this.tool_search=a.tool_search;this.tool_search.on("change:results",this.apply_search_results,this)},clear_search_results:function(){this.each(function(a){if(a instanceof ToolPanelSection){a.clear_search_results()}else{a.show()}})},apply_search_results:function(){var b=this.tool_search.attributes.results;if(b===null){this.clear_search_results();return}var a=null;this.each(function(c){if(c instanceof ToolPanelLabel){a=c;a.hide()}else{if(c instanceof Tool){if(c.apply_search_results(b)){if(a){a.show()}}}else{a=null;c.apply_search_results(b)}}})}});var BaseView=Backbone.View.extend({initialize:function(){this.model.on("change:hidden",this.update_visible,this);this.update_visible()},update_visible:function(){(this.model.attributes.hidden?this.$el.hide():this.$el.show())}});var ToolLinkView=BaseView.extend({tagName:"div",template:Handlebars.templates.tool_link,render:function(){this.$el.append(this.template(this.model.toJSON()));return this}});var ToolPanelLabelView=BaseView.extend({tagName:"div",className:"toolPanelLabel",template:Handlebars.templates.panel_label,render:function(){this.$el.append(this.template(this.model.toJSON()));return this},});var ToolPanelSectionView=BaseView.extend({tagName:"div",className:"toolSectionWrapper",template:Handlebars.templates.panel_section,initialize:function(){BaseView.prototype.initialize.call(this);this.model.on("change:open",this.update_open,this)},render:function(){this.$el.append(this.template(this.model.toJSON()));var a=this.$el.find(".toolSectionBody");_.each(this.model.attributes.elems,function(b){if(b instanceof Tool){var c=new ToolLinkView({model:b,className:"toolTitle"});c.render();a.append(c.$el)}else{if(b instanceof ToolPanelLabel){var d=new ToolPanelLabelView({model:b});d.render();a.append(d.$el)}else{}}});return this},events:{"click .toolSectionTitle > a":"toggle"},toggle:function(){this.model.set("open",!this.model.attributes.open)},update_open:function(){(this.model.attributes.open?this.$el.children(".toolSectionBody").slideDown("fast"):this.$el.children(".toolSectionBody").slideUp("fast"))}});var ToolSearchView=Backbone.View.extend({tagName:"div",id:"tool-search",className:"bar",template:Handlebars.templates.tool_search,events:{click:"focus_and_select","keyup :input":"query_changed"},render:function(){this.$el.append(this.template(this.model.toJSON()));if(!this.model.is_visible()){this.$el.hide()}return this},focus_and_select:function(){this.$el.find(":input").focus().select()},query_changed:function(){this.model.set("query",this.$el.find(":input").val())}});var ToolPanelView=Backbone.View.extend({tagName:"div",className:"toolMenu",initialize:function(a){this.collection.tool_search.on("change:results",this.handle_search_results,this)},render:function(){var b=this.$el;var a=new ToolSearchView({model:this.collection.tool_search});a.render();b.append(a.$el);this.collection.each(function(d){if(d instanceof ToolPanelSection){var c=new ToolPanelSectionView({model:d});c.render();b.append(c.$el)}else{if(d instanceof Tool){var e=new ToolLinkView({model:d,className:"toolTitleNoSection"});e.render();b.append(e.$el)}else{if(d instanceof ToolPanelLabel){var f=new ToolPanelLabelView({model:d});f.render();b.append(f.$el)}}}});return this},handle_search_results:function(){var a=this.collection.tool_search.attributes.results;if(a&&a.length===0){$("#search-no-results").show()}else{$("#search-no-results").hide()}}}); \ No newline at end of file +var BaseModel=Backbone.RelationalModel.extend({defaults:{name:null,hidden:false},show:function(){this.set("hidden",false)},hide:function(){this.set("hidden",true)},is_visible:function(){return !this.attributes.hidden}});var Tool=BaseModel.extend({defaults:{description:null,target:null,inputs:[]},relations:[{type:Backbone.HasMany,key:"inputs",relatedModel:"ToolInput",reverseRelation:{key:"tool"}}],url:function(){return galaxy_paths.attributes.root_path+"tools/show?id="+this.id},apply_search_results:function(a){(_.indexOf(a,this.attributes.id)!==-1?this.show():this.hide());return this.is_visible()}});var ToolInput=Backbone.RelationalModel.extend({});var ToolCollection=Backbone.Collection.extend({model:Tool});var ToolPanelLabel=BaseModel.extend({});var ToolPanelSection=BaseModel.extend({defaults:{elems:[],open:false},clear_search_results:function(){_.each(this.attributes.elems,function(a){a.show()});this.show();this.set("open",false)},apply_search_results:function(b){var c=true,a;_.each(this.attributes.elems,function(d){if(d instanceof ToolPanelLabel){a=d;a.hide()}else{if(d instanceof Tool){if(d.apply_search_results(b)){c=false;if(a){a.show()}}}}});if(c){this.hide()}else{this.show();this.set("open",true)}}});var ToolSearch=BaseModel.extend({defaults:{spinner_url:"",search_url:"",visible:true,query:"",results:null},initialize:function(){this.on("change:query",this.do_search)},do_search:function(){var c=this.attributes.query;if(c.length<3){this.set("results",null);return}var b=c+"*";if(this.timer){clearTimeout(this.timer)}$("#search-spinner").show();var a=this;this.timer=setTimeout(function(){$.get(a.attributes.search_url,{query:b},function(d){a.set("results",d);$("#search-spinner").hide()},"json")},200)}});var ToolPanel=Backbone.Collection.extend({url:"/tools",tools:new ToolCollection(),parse:function(a){var b=function(e){var d=e.type;if(d==="tool"){return new Tool(e)}else{if(d==="section"){var c=_.map(e.elems,b);e.elems=c;return new ToolPanelSection(e)}else{if(d==="label"){return new ToolPanelLabel(e)}}}};return _.map(a,b)},initialize:function(a){this.tool_search=a.tool_search;this.tool_search.on("change:results",this.apply_search_results,this);this.on("reset",this.populate_tools,this)},populate_tools:function(){var a=this;a.tools=new ToolCollection();this.each(function(b){if(b instanceof ToolPanelSection){_.each(b.attributes.elems,function(c){if(c instanceof Tool){a.tools.push(c)}})}else{if(b instanceof Tool){a.tools.push(b)}}})},clear_search_results:function(){this.each(function(a){if(a instanceof ToolPanelSection){a.clear_search_results()}else{a.show()}})},apply_search_results:function(){var b=this.tool_search.attributes.results;if(b===null){this.clear_search_results();return}var a=null;this.each(function(c){if(c instanceof ToolPanelLabel){a=c;a.hide()}else{if(c instanceof Tool){if(c.apply_search_results(b)){if(a){a.show()}}}else{a=null;c.apply_search_results(b)}}})}});var BaseView=Backbone.View.extend({initialize:function(){this.model.on("change:hidden",this.update_visible,this);this.update_visible()},update_visible:function(){(this.model.attributes.hidden?this.$el.hide():this.$el.show())}});var ToolLinkView=BaseView.extend({tagName:"div",template:Handlebars.templates.tool_link,render:function(){this.$el.append(this.template(this.model.toJSON()));return this}});var ToolPanelLabelView=BaseView.extend({tagName:"div",className:"toolPanelLabel",template:Handlebars.templates.panel_label,render:function(){this.$el.append(this.template(this.model.toJSON()));return this},});var ToolPanelSectionView=BaseView.extend({tagName:"div",className:"toolSectionWrapper",template:Handlebars.templates.panel_section,initialize:function(){BaseView.prototype.initialize.call(this);this.model.on("change:open",this.update_open,this)},render:function(){this.$el.append(this.template(this.model.toJSON()));var a=this.$el.find(".toolSectionBody");_.each(this.model.attributes.elems,function(b){if(b instanceof Tool){var c=new ToolLinkView({model:b,className:"toolTitle"});c.render();a.append(c.$el)}else{if(b instanceof ToolPanelLabel){var d=new ToolPanelLabelView({model:b});d.render();a.append(d.$el)}else{}}});return this},events:{"click .toolSectionTitle > a":"toggle"},toggle:function(){this.model.set("open",!this.model.attributes.open)},update_open:function(){(this.model.attributes.open?this.$el.children(".toolSectionBody").slideDown("fast"):this.$el.children(".toolSectionBody").slideUp("fast"))}});var ToolSearchView=Backbone.View.extend({tagName:"div",id:"tool-search",className:"bar",template:Handlebars.templates.tool_search,events:{click:"focus_and_select","keyup :input":"query_changed"},render:function(){this.$el.append(this.template(this.model.toJSON()));if(!this.model.is_visible()){this.$el.hide()}return this},focus_and_select:function(){this.$el.find(":input").focus().select()},query_changed:function(){this.model.set("query",this.$el.find(":input").val())}});var ToolPanelView=Backbone.View.extend({tagName:"div",className:"toolMenu",initialize:function(){this.collection.tool_search.on("change:results",this.handle_search_results,this)},render:function(){var a=this;var b=new ToolSearchView({model:this.collection.tool_search});b.render();a.$el.append(b.$el);this.collection.each(function(d){if(d instanceof ToolPanelSection){var c=new ToolPanelSectionView({model:d});c.render();a.$el.append(c.$el)}else{if(d instanceof Tool){var e=new ToolLinkView({model:d,className:"toolTitleNoSection"});e.render();a.$el.append(e.$el)}else{if(d instanceof ToolPanelLabel){var f=new ToolPanelLabelView({model:d});f.render();a.$el.append(f.$el)}}}});a.$el.find("a.tool-link").click(function(f){var d=$(this).attr("class").split(/\s+/)[0],c=a.collection.tools.get(d);a.trigger("tool_link_click",f,c)});return this},handle_search_results:function(){var a=this.collection.tool_search.attributes.results;if(a&&a.length===0){$("#search-no-results").show()}else{$("#search-no-results").hide()}}});var ToolView=Backbone.View.extend({className:"toolForm",render:function(){var a=this}});var IntegratedToolMenuAndView=Backbone.View.extend({className:"toolMenuAndView",initialize:function(){this.tool_panel_view=new ToolPanelView({collection:this.collection})},render:function(){this.tool_panel_view.render();this.tool_panel_view.$el.css("float","left");this.$el.append(this.tool_panel_view.$el);var a=this;this.tool_panel_view.on("tool_link_click",function(c,b){c.preventDefault();a.show_tool(b)})},show_tool:function(a){a.fetch().done(function(){console.log(a);var b=new ToolView({model:a});b.render();b.$el.css("float","left");this.$el.append(b.$el);$("#left").width("500px")})}}); \ No newline at end of file diff -r f11e8aa26fcc88b9fa92e752000b092cfefce88c -r 272506e479f54d41b345c373786c23cab57cc153 static/scripts/packed/handlebars/compiled/tool_form.js --- /dev/null +++ b/static/scripts/packed/handlebars/compiled/tool_form.js @@ -0,0 +1,1 @@ +(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.tool_form=b(function(f,p,e,n,m){e=e||f.helpers;var k="",c,r,j,i,q=this,g="function",o=e.helperMissing,h=void 0,l=this.escapeExpression;function d(v,u){var s="",t;s+='\n <div class="form-row">\n <label for="';j=e.name;t=j||v.name;if(typeof t===g){t=t.call(v,{hash:{}})}else{if(t===h){t=o.call(v,"name",{hash:{}})}}s+=l(t)+'">';j=e.label;t=j||v.label;if(typeof t===g){t=t.call(v,{hash:{}})}else{if(t===h){t=o.call(v,"label",{hash:{}})}}s+=l(t)+':</label>\n <div class="form-row-input">\n ';j=e.html;t=j||v.html;if(typeof t===g){t=t.call(v,{hash:{}})}else{if(t===h){t=o.call(v,"html",{hash:{}})}}if(t||t===0){s+=t}s+='\n </div>\n <div class="toolParamHelp" style="clear: both;">\n ';j=e.help;t=j||v.help;if(typeof t===g){t=t.call(v,{hash:{}})}else{if(t===h){t=o.call(v,"help",{hash:{}})}}s+=l(t)+'\n </div>\n <div style="clear: both;"></div>\n </div>\n ';return s}k+='<div class="toolFormTitle">';j=e.name;c=j||p.name;if(typeof c===g){c=c.call(p,{hash:{}})}else{if(c===h){c=o.call(p,"name",{hash:{}})}}k+=l(c)+" (version ";j=e.version;c=j||p.version;if(typeof c===g){c=c.call(p,{hash:{}})}else{if(c===h){c=o.call(p,"version",{hash:{}})}}k+=l(c)+')</div>\n <div class="toolFormBody">\n ';j=e.inputs;c=j||p.inputs;r=e.each;i=q.program(1,d,m);i.hash={};i.fn=i;i.inverse=q.noop;c=r.call(p,c,i);if(c||c===0){k+=c}k+='\n </div>\n <div class="form-row form-actions">\n <input type="submit" class="btn btn-primary" name="runtool_btn" value="Execute">\n</div>\n<div class="toolHelp">\n <div class="toolHelpBody">';j=e.help;c=j||p.help;if(typeof c===g){c=c.call(p,{hash:{}})}else{if(c===h){c=o.call(p,"help",{hash:{}})}}k+=l(c)+"</div>\n</div>";return k})})(); \ No newline at end of file https://bitbucket.org/galaxy/galaxy-central/changeset/98c2b1689ab3/ changeset: 98c2b1689ab3 user: jgoecks date: 2012-04-12 20:21:35 summary: Change handlebars directory name to templates. affected #: 32 files diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/handlebars/compile_templates.py --- a/static/scripts/handlebars/compile_templates.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python - -# Script requires handlebars compiler be installed; use node package manager -# to install handlebars. - -import sys - -from glob import glob -from subprocess import call -from shutil import copyfile -from os import path - -cmd = "handlebars %s -f compiled/%s.js" - -# If specific scripts specified on command line, just pack them, otherwise pack -# all. - -if len( sys.argv ) > 1: - to_pack = sys.argv[1:] -else: - to_pack = glob( "*.handlebars" ) - -for fname in to_pack: - fname_base = path.splitext( path.split( fname )[1] )[0] - print "%s --> compiled/%s.js" % ( fname, fname_base ) - out = call( cmd % ( fname, fname_base ), shell=True ) diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/handlebars/compiled/panel_label.js --- a/static/scripts/handlebars/compiled/panel_label.js +++ /dev/null @@ -1,15 +0,0 @@ -(function() { - var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; -templates['panel_label'] = template(function (Handlebars,depth0,helpers,partials,data) { - helpers = helpers || Handlebars.helpers; - var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression; - - - buffer += "<span>"; - foundHelper = helpers.name; - stack1 = foundHelper || depth0.name; - if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } - else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } - buffer += escapeExpression(stack1) + "</span>"; - return buffer;}); -})(); \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/handlebars/compiled/panel_section.js --- a/static/scripts/handlebars/compiled/panel_section.js +++ /dev/null @@ -1,25 +0,0 @@ -(function() { - var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; -templates['panel_section'] = template(function (Handlebars,depth0,helpers,partials,data) { - helpers = helpers || Handlebars.helpers; - var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression; - - - buffer += "<div class=\"toolSectionTitle\" id=\"title_"; - foundHelper = helpers.id; - stack1 = foundHelper || depth0.id; - if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } - else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "id", { hash: {} }); } - buffer += escapeExpression(stack1) + "\">\n <a href=\"#\"><span>"; - foundHelper = helpers.name; - stack1 = foundHelper || depth0.name; - if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } - else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } - buffer += escapeExpression(stack1) + "</span></a>\n</div>\n<div id=\""; - foundHelper = helpers.id; - stack1 = foundHelper || depth0.id; - if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } - else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "id", { hash: {} }); } - buffer += escapeExpression(stack1) + "\" class=\"toolSectionBody\" style=\"display: none; \">\n <div class=\"toolSectionBg\"></div>\n<div>"; - return buffer;}); -})(); \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/handlebars/compiled/tool_form.js --- a/static/scripts/handlebars/compiled/tool_form.js +++ /dev/null @@ -1,61 +0,0 @@ -(function() { - var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; -templates['tool_form'] = template(function (Handlebars,depth0,helpers,partials,data) { - helpers = helpers || Handlebars.helpers; - var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression; - -function program1(depth0,data) { - - var buffer = "", stack1; - buffer += "\n <div class=\"form-row\">\n <label for=\""; - foundHelper = helpers.name; - stack1 = foundHelper || depth0.name; - if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } - else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } - buffer += escapeExpression(stack1) + "\">"; - foundHelper = helpers.label; - stack1 = foundHelper || depth0.label; - if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } - else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "label", { hash: {} }); } - buffer += escapeExpression(stack1) + ":</label>\n <div class=\"form-row-input\">\n "; - foundHelper = helpers.html; - stack1 = foundHelper || depth0.html; - if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } - else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "html", { hash: {} }); } - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n </div>\n <div class=\"toolParamHelp\" style=\"clear: both;\">\n "; - foundHelper = helpers.help; - stack1 = foundHelper || depth0.help; - if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } - else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "help", { hash: {} }); } - buffer += escapeExpression(stack1) + "\n </div>\n <div style=\"clear: both;\"></div>\n </div>\n "; - return buffer;} - - buffer += "<div class=\"toolFormTitle\">"; - foundHelper = helpers.name; - stack1 = foundHelper || depth0.name; - if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } - else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } - buffer += escapeExpression(stack1) + " (version "; - foundHelper = helpers.version; - stack1 = foundHelper || depth0.version; - if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } - else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "version", { hash: {} }); } - buffer += escapeExpression(stack1) + ")</div>\n <div class=\"toolFormBody\">\n "; - foundHelper = helpers.inputs; - stack1 = foundHelper || depth0.inputs; - stack2 = helpers.each; - tmp1 = self.program(1, program1, data); - tmp1.hash = {}; - tmp1.fn = tmp1; - tmp1.inverse = self.noop; - stack1 = stack2.call(depth0, stack1, tmp1); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n </div>\n <div class=\"form-row form-actions\">\n <input type=\"submit\" class=\"btn btn-primary\" name=\"runtool_btn\" value=\"Execute\">\n</div>\n<div class=\"toolHelp\">\n <div class=\"toolHelpBody\">"; - foundHelper = helpers.help; - stack1 = foundHelper || depth0.help; - if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } - else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "help", { hash: {} }); } - buffer += escapeExpression(stack1) + "</div>\n</div>"; - return buffer;}); -})(); \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/handlebars/compiled/tool_link.js --- a/static/scripts/handlebars/compiled/tool_link.js +++ /dev/null @@ -1,40 +0,0 @@ -(function() { - var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; -templates['tool_link'] = template(function (Handlebars,depth0,helpers,partials,data) { - helpers = helpers || Handlebars.helpers; - var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression; - - - buffer += "<a class=\""; - foundHelper = helpers.id; - stack1 = foundHelper || depth0.id; - if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } - else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "id", { hash: {} }); } - buffer += escapeExpression(stack1) + " tool-link\" href=\""; - foundHelper = helpers.link; - stack1 = foundHelper || depth0.link; - if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } - else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "link", { hash: {} }); } - buffer += escapeExpression(stack1) + "\" target=\""; - foundHelper = helpers.target; - stack1 = foundHelper || depth0.target; - if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } - else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "target", { hash: {} }); } - buffer += escapeExpression(stack1) + "\" minsizehint=\""; - foundHelper = helpers.min_width; - stack1 = foundHelper || depth0.min_width; - if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } - else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "min_width", { hash: {} }); } - buffer += escapeExpression(stack1) + "\">"; - foundHelper = helpers.name; - stack1 = foundHelper || depth0.name; - if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } - else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } - buffer += escapeExpression(stack1) + "</a> "; - foundHelper = helpers.description; - stack1 = foundHelper || depth0.description; - if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } - else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); } - buffer += escapeExpression(stack1); - return buffer;}); -})(); \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/handlebars/compiled/tool_search.js --- a/static/scripts/handlebars/compiled/tool_search.js +++ /dev/null @@ -1,15 +0,0 @@ -(function() { - var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; -templates['tool_search'] = template(function (Handlebars,depth0,helpers,partials,data) { - helpers = helpers || Handlebars.helpers; - var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression; - - - buffer += "<input type=\"text\" name=\"query\" value=\"search tools\" id=\"tool-search-query\" autocomplete=\"off\" class=\"search-query parent-width\" />\n<img src=\""; - foundHelper = helpers.spinner_url; - stack1 = foundHelper || depth0.spinner_url; - if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } - else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "spinner_url", { hash: {} }); } - buffer += escapeExpression(stack1) + "\" id=\"search-spinner\" class=\"search-spinner\"/>\n"; - return buffer;}); -})(); \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/handlebars/panel_label.handlebars --- a/static/scripts/handlebars/panel_label.handlebars +++ /dev/null @@ -1,1 +0,0 @@ -<span>{{name}}</span> \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/handlebars/panel_section.handlebars --- a/static/scripts/handlebars/panel_section.handlebars +++ /dev/null @@ -1,6 +0,0 @@ -<div class="toolSectionTitle" id="title_{{id}}"> - <a href="#"><span>{{name}}</span></a> -</div> -<div id="{{id}}" class="toolSectionBody" style="display: none; "> - <div class="toolSectionBg"></div> -<div> \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/handlebars/tool_form.handlebars --- a/static/scripts/handlebars/tool_form.handlebars +++ /dev/null @@ -1,21 +0,0 @@ -<div class="toolFormTitle">{{name}} (version {{version}})</div> - <div class="toolFormBody"> - {{#each inputs}} - <div class="form-row"> - <label for="{{name}}">{{label}}:</label> - <div class="form-row-input"> - {{{html}}} - </div> - <div class="toolParamHelp" style="clear: both;"> - {{help}} - </div> - <div style="clear: both;"></div> - </div> - {{/each}} - </div> - <div class="form-row form-actions"> - <input type="submit" class="btn btn-primary" name="runtool_btn" value="Execute"> -</div> -<div class="toolHelp"> - <div class="toolHelpBody">{{help}}</div> -</div> \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/handlebars/tool_link.handlebars --- a/static/scripts/handlebars/tool_link.handlebars +++ /dev/null @@ -1,1 +0,0 @@ -<a class="{{id}} tool-link" href="{{link}}" target="{{target}}" minsizehint="{{min_width}}">{{name}}</a> {{description}} \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/handlebars/tool_search.handlebars --- a/static/scripts/handlebars/tool_search.handlebars +++ /dev/null @@ -1,2 +0,0 @@ -<input type="text" name="query" value="search tools" id="tool-search-query" autocomplete="off" class="search-query parent-width" /> -<img src="{{spinner_url}}" id="search-spinner" class="search-spinner"/> diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/packed/handlebars/compiled/panel_label.js --- a/static/scripts/packed/handlebars/compiled/panel_label.js +++ /dev/null @@ -1,1 +0,0 @@ -(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.panel_label=b(function(e,n,d,l,k){d=d||e.helpers;var i="",c,h,o=this,f="function",m=d.helperMissing,g=void 0,j=this.escapeExpression;i+="<span>";h=d.name;c=h||n.name;if(typeof c===f){c=c.call(n,{hash:{}})}else{if(c===g){c=m.call(n,"name",{hash:{}})}}i+=j(c)+"</span>";return i})})(); \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/packed/handlebars/compiled/panel_section.js --- a/static/scripts/packed/handlebars/compiled/panel_section.js +++ /dev/null @@ -1,1 +0,0 @@ -(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.panel_section=b(function(e,n,d,l,k){d=d||e.helpers;var i="",c,h,o=this,f="function",m=d.helperMissing,g=void 0,j=this.escapeExpression;i+='<div class="toolSectionTitle" id="title_';h=d.id;c=h||n.id;if(typeof c===f){c=c.call(n,{hash:{}})}else{if(c===g){c=m.call(n,"id",{hash:{}})}}i+=j(c)+'">\n <a href="#"><span>';h=d.name;c=h||n.name;if(typeof c===f){c=c.call(n,{hash:{}})}else{if(c===g){c=m.call(n,"name",{hash:{}})}}i+=j(c)+'</span></a>\n</div>\n<div id="';h=d.id;c=h||n.id;if(typeof c===f){c=c.call(n,{hash:{}})}else{if(c===g){c=m.call(n,"id",{hash:{}})}}i+=j(c)+'" class="toolSectionBody" style="display: none; ">\n <div class="toolSectionBg"></div>\n<div>';return i})})(); \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/packed/handlebars/compiled/tool_form.js --- a/static/scripts/packed/handlebars/compiled/tool_form.js +++ /dev/null @@ -1,1 +0,0 @@ -(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.tool_form=b(function(f,p,e,n,m){e=e||f.helpers;var k="",c,r,j,i,q=this,g="function",o=e.helperMissing,h=void 0,l=this.escapeExpression;function d(v,u){var s="",t;s+='\n <div class="form-row">\n <label for="';j=e.name;t=j||v.name;if(typeof t===g){t=t.call(v,{hash:{}})}else{if(t===h){t=o.call(v,"name",{hash:{}})}}s+=l(t)+'">';j=e.label;t=j||v.label;if(typeof t===g){t=t.call(v,{hash:{}})}else{if(t===h){t=o.call(v,"label",{hash:{}})}}s+=l(t)+':</label>\n <div class="form-row-input">\n ';j=e.html;t=j||v.html;if(typeof t===g){t=t.call(v,{hash:{}})}else{if(t===h){t=o.call(v,"html",{hash:{}})}}if(t||t===0){s+=t}s+='\n </div>\n <div class="toolParamHelp" style="clear: both;">\n ';j=e.help;t=j||v.help;if(typeof t===g){t=t.call(v,{hash:{}})}else{if(t===h){t=o.call(v,"help",{hash:{}})}}s+=l(t)+'\n </div>\n <div style="clear: both;"></div>\n </div>\n ';return s}k+='<div class="toolFormTitle">';j=e.name;c=j||p.name;if(typeof c===g){c=c.call(p,{hash:{}})}else{if(c===h){c=o.call(p,"name",{hash:{}})}}k+=l(c)+" (version ";j=e.version;c=j||p.version;if(typeof c===g){c=c.call(p,{hash:{}})}else{if(c===h){c=o.call(p,"version",{hash:{}})}}k+=l(c)+')</div>\n <div class="toolFormBody">\n ';j=e.inputs;c=j||p.inputs;r=e.each;i=q.program(1,d,m);i.hash={};i.fn=i;i.inverse=q.noop;c=r.call(p,c,i);if(c||c===0){k+=c}k+='\n </div>\n <div class="form-row form-actions">\n <input type="submit" class="btn btn-primary" name="runtool_btn" value="Execute">\n</div>\n<div class="toolHelp">\n <div class="toolHelpBody">';j=e.help;c=j||p.help;if(typeof c===g){c=c.call(p,{hash:{}})}else{if(c===h){c=o.call(p,"help",{hash:{}})}}k+=l(c)+"</div>\n</div>";return k})})(); \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/packed/handlebars/compiled/tool_link.js --- a/static/scripts/packed/handlebars/compiled/tool_link.js +++ /dev/null @@ -1,1 +0,0 @@ -(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.tool_link=b(function(e,n,d,l,k){d=d||e.helpers;var i="",c,h,o=this,f="function",m=d.helperMissing,g=void 0,j=this.escapeExpression;i+='<a class="';h=d.id;c=h||n.id;if(typeof c===f){c=c.call(n,{hash:{}})}else{if(c===g){c=m.call(n,"id",{hash:{}})}}i+=j(c)+' tool-link" href="';h=d.link;c=h||n.link;if(typeof c===f){c=c.call(n,{hash:{}})}else{if(c===g){c=m.call(n,"link",{hash:{}})}}i+=j(c)+'" target="';h=d.target;c=h||n.target;if(typeof c===f){c=c.call(n,{hash:{}})}else{if(c===g){c=m.call(n,"target",{hash:{}})}}i+=j(c)+'" minsizehint="';h=d.min_width;c=h||n.min_width;if(typeof c===f){c=c.call(n,{hash:{}})}else{if(c===g){c=m.call(n,"min_width",{hash:{}})}}i+=j(c)+'">';h=d.name;c=h||n.name;if(typeof c===f){c=c.call(n,{hash:{}})}else{if(c===g){c=m.call(n,"name",{hash:{}})}}i+=j(c)+"</a> ";h=d.description;c=h||n.description;if(typeof c===f){c=c.call(n,{hash:{}})}else{if(c===g){c=m.call(n,"description",{hash:{}})}}i+=j(c);return i})})(); \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/packed/handlebars/compiled/tool_search.js --- a/static/scripts/packed/handlebars/compiled/tool_search.js +++ /dev/null @@ -1,1 +0,0 @@ -(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.tool_search=b(function(e,n,d,l,k){d=d||e.helpers;var i="",c,h,o=this,f="function",m=d.helperMissing,g=void 0,j=this.escapeExpression;i+='<input type="text" name="query" value="search tools" id="tool-search-query" autocomplete="off" class="search-query parent-width" />\n<img src="';h=d.spinner_url;c=h||n.spinner_url;if(typeof c===f){c=c.call(n,{hash:{}})}else{if(c===g){c=m.call(n,"spinner_url",{hash:{}})}}i+=j(c)+'" id="search-spinner" class="search-spinner"/>\n';return i})})(); \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/packed/templates/compiled/panel_label.js --- /dev/null +++ b/static/scripts/packed/templates/compiled/panel_label.js @@ -0,0 +1,1 @@ +(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.panel_label=b(function(e,n,d,l,k){d=d||e.helpers;var i="",c,h,o=this,f="function",m=d.helperMissing,g=void 0,j=this.escapeExpression;i+="<span>";h=d.name;c=h||n.name;if(typeof c===f){c=c.call(n,{hash:{}})}else{if(c===g){c=m.call(n,"name",{hash:{}})}}i+=j(c)+"</span>";return i})})(); \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/packed/templates/compiled/panel_section.js --- /dev/null +++ b/static/scripts/packed/templates/compiled/panel_section.js @@ -0,0 +1,1 @@ +(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.panel_section=b(function(e,n,d,l,k){d=d||e.helpers;var i="",c,h,o=this,f="function",m=d.helperMissing,g=void 0,j=this.escapeExpression;i+='<div class="toolSectionTitle" id="title_';h=d.id;c=h||n.id;if(typeof c===f){c=c.call(n,{hash:{}})}else{if(c===g){c=m.call(n,"id",{hash:{}})}}i+=j(c)+'">\n <a href="#"><span>';h=d.name;c=h||n.name;if(typeof c===f){c=c.call(n,{hash:{}})}else{if(c===g){c=m.call(n,"name",{hash:{}})}}i+=j(c)+'</span></a>\n</div>\n<div id="';h=d.id;c=h||n.id;if(typeof c===f){c=c.call(n,{hash:{}})}else{if(c===g){c=m.call(n,"id",{hash:{}})}}i+=j(c)+'" class="toolSectionBody" style="display: none; ">\n <div class="toolSectionBg"></div>\n<div>';return i})})(); \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/packed/templates/compiled/tool_form.js --- /dev/null +++ b/static/scripts/packed/templates/compiled/tool_form.js @@ -0,0 +1,1 @@ +(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.tool_form=b(function(f,p,e,n,m){e=e||f.helpers;var k="",c,r,j,i,q=this,g="function",o=e.helperMissing,h=void 0,l=this.escapeExpression;function d(v,u){var s="",t;s+='\n <div class="form-row">\n <label for="';j=e.name;t=j||v.name;if(typeof t===g){t=t.call(v,{hash:{}})}else{if(t===h){t=o.call(v,"name",{hash:{}})}}s+=l(t)+'">';j=e.label;t=j||v.label;if(typeof t===g){t=t.call(v,{hash:{}})}else{if(t===h){t=o.call(v,"label",{hash:{}})}}s+=l(t)+':</label>\n <div class="form-row-input">\n ';j=e.html;t=j||v.html;if(typeof t===g){t=t.call(v,{hash:{}})}else{if(t===h){t=o.call(v,"html",{hash:{}})}}if(t||t===0){s+=t}s+='\n </div>\n <div class="toolParamHelp" style="clear: both;">\n ';j=e.help;t=j||v.help;if(typeof t===g){t=t.call(v,{hash:{}})}else{if(t===h){t=o.call(v,"help",{hash:{}})}}s+=l(t)+'\n </div>\n <div style="clear: both;"></div>\n </div>\n ';return s}k+='<div class="toolFormTitle">';j=e.name;c=j||p.name;if(typeof c===g){c=c.call(p,{hash:{}})}else{if(c===h){c=o.call(p,"name",{hash:{}})}}k+=l(c)+" (version ";j=e.version;c=j||p.version;if(typeof c===g){c=c.call(p,{hash:{}})}else{if(c===h){c=o.call(p,"version",{hash:{}})}}k+=l(c)+')</div>\n <div class="toolFormBody">\n ';j=e.inputs;c=j||p.inputs;r=e.each;i=q.program(1,d,m);i.hash={};i.fn=i;i.inverse=q.noop;c=r.call(p,c,i);if(c||c===0){k+=c}k+='\n </div>\n <div class="form-row form-actions">\n <input type="submit" class="btn btn-primary" name="runtool_btn" value="Execute">\n</div>\n<div class="toolHelp">\n <div class="toolHelpBody">';j=e.help;c=j||p.help;if(typeof c===g){c=c.call(p,{hash:{}})}else{if(c===h){c=o.call(p,"help",{hash:{}})}}k+=l(c)+"</div>\n</div>";return k})})(); \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/packed/templates/compiled/tool_link.js --- /dev/null +++ b/static/scripts/packed/templates/compiled/tool_link.js @@ -0,0 +1,1 @@ +(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.tool_link=b(function(e,n,d,l,k){d=d||e.helpers;var i="",c,h,o=this,f="function",m=d.helperMissing,g=void 0,j=this.escapeExpression;i+='<a class="';h=d.id;c=h||n.id;if(typeof c===f){c=c.call(n,{hash:{}})}else{if(c===g){c=m.call(n,"id",{hash:{}})}}i+=j(c)+' tool-link" href="';h=d.link;c=h||n.link;if(typeof c===f){c=c.call(n,{hash:{}})}else{if(c===g){c=m.call(n,"link",{hash:{}})}}i+=j(c)+'" target="';h=d.target;c=h||n.target;if(typeof c===f){c=c.call(n,{hash:{}})}else{if(c===g){c=m.call(n,"target",{hash:{}})}}i+=j(c)+'" minsizehint="';h=d.min_width;c=h||n.min_width;if(typeof c===f){c=c.call(n,{hash:{}})}else{if(c===g){c=m.call(n,"min_width",{hash:{}})}}i+=j(c)+'">';h=d.name;c=h||n.name;if(typeof c===f){c=c.call(n,{hash:{}})}else{if(c===g){c=m.call(n,"name",{hash:{}})}}i+=j(c)+"</a> ";h=d.description;c=h||n.description;if(typeof c===f){c=c.call(n,{hash:{}})}else{if(c===g){c=m.call(n,"description",{hash:{}})}}i+=j(c);return i})})(); \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/packed/templates/compiled/tool_search.js --- /dev/null +++ b/static/scripts/packed/templates/compiled/tool_search.js @@ -0,0 +1,1 @@ +(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.tool_search=b(function(e,n,d,l,k){d=d||e.helpers;var i="",c,h,o=this,f="function",m=d.helperMissing,g=void 0,j=this.escapeExpression;i+='<input type="text" name="query" value="search tools" id="tool-search-query" autocomplete="off" class="search-query parent-width" />\n<img src="';h=d.spinner_url;c=h||n.spinner_url;if(typeof c===f){c=c.call(n,{hash:{}})}else{if(c===g){c=m.call(n,"spinner_url",{hash:{}})}}i+=j(c)+'" id="search-spinner" class="search-spinner"/>\n';return i})})(); \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/templates/compile_templates.py --- /dev/null +++ b/static/scripts/templates/compile_templates.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +# Script requires handlebars compiler be installed; use node package manager +# to install handlebars. + +import sys + +from glob import glob +from subprocess import call +from shutil import copyfile +from os import path + +cmd = "handlebars %s -f compiled/%s.js" + +# If specific scripts specified on command line, just pack them, otherwise pack +# all. + +if len( sys.argv ) > 1: + to_pack = sys.argv[1:] +else: + to_pack = glob( "*.handlebars" ) + +for fname in to_pack: + fname_base = path.splitext( path.split( fname )[1] )[0] + print "%s --> compiled/%s.js" % ( fname, fname_base ) + out = call( cmd % ( fname, fname_base ), shell=True ) diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/templates/compiled/panel_label.js --- /dev/null +++ b/static/scripts/templates/compiled/panel_label.js @@ -0,0 +1,15 @@ +(function() { + var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; +templates['panel_label'] = template(function (Handlebars,depth0,helpers,partials,data) { + helpers = helpers || Handlebars.helpers; + var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression; + + + buffer += "<span>"; + foundHelper = helpers.name; + stack1 = foundHelper || depth0.name; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } + buffer += escapeExpression(stack1) + "</span>"; + return buffer;}); +})(); \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/templates/compiled/panel_section.js --- /dev/null +++ b/static/scripts/templates/compiled/panel_section.js @@ -0,0 +1,25 @@ +(function() { + var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; +templates['panel_section'] = template(function (Handlebars,depth0,helpers,partials,data) { + helpers = helpers || Handlebars.helpers; + var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression; + + + buffer += "<div class=\"toolSectionTitle\" id=\"title_"; + foundHelper = helpers.id; + stack1 = foundHelper || depth0.id; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "id", { hash: {} }); } + buffer += escapeExpression(stack1) + "\">\n <a href=\"#\"><span>"; + foundHelper = helpers.name; + stack1 = foundHelper || depth0.name; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } + buffer += escapeExpression(stack1) + "</span></a>\n</div>\n<div id=\""; + foundHelper = helpers.id; + stack1 = foundHelper || depth0.id; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "id", { hash: {} }); } + buffer += escapeExpression(stack1) + "\" class=\"toolSectionBody\" style=\"display: none; \">\n <div class=\"toolSectionBg\"></div>\n<div>"; + return buffer;}); +})(); \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/templates/compiled/tool_form.js --- /dev/null +++ b/static/scripts/templates/compiled/tool_form.js @@ -0,0 +1,61 @@ +(function() { + var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; +templates['tool_form'] = template(function (Handlebars,depth0,helpers,partials,data) { + helpers = helpers || Handlebars.helpers; + var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression; + +function program1(depth0,data) { + + var buffer = "", stack1; + buffer += "\n <div class=\"form-row\">\n <label for=\""; + foundHelper = helpers.name; + stack1 = foundHelper || depth0.name; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } + buffer += escapeExpression(stack1) + "\">"; + foundHelper = helpers.label; + stack1 = foundHelper || depth0.label; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "label", { hash: {} }); } + buffer += escapeExpression(stack1) + ":</label>\n <div class=\"form-row-input\">\n "; + foundHelper = helpers.html; + stack1 = foundHelper || depth0.html; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "html", { hash: {} }); } + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\n </div>\n <div class=\"toolParamHelp\" style=\"clear: both;\">\n "; + foundHelper = helpers.help; + stack1 = foundHelper || depth0.help; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "help", { hash: {} }); } + buffer += escapeExpression(stack1) + "\n </div>\n <div style=\"clear: both;\"></div>\n </div>\n "; + return buffer;} + + buffer += "<div class=\"toolFormTitle\">"; + foundHelper = helpers.name; + stack1 = foundHelper || depth0.name; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } + buffer += escapeExpression(stack1) + " (version "; + foundHelper = helpers.version; + stack1 = foundHelper || depth0.version; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "version", { hash: {} }); } + buffer += escapeExpression(stack1) + ")</div>\n <div class=\"toolFormBody\">\n "; + foundHelper = helpers.inputs; + stack1 = foundHelper || depth0.inputs; + stack2 = helpers.each; + tmp1 = self.program(1, program1, data); + tmp1.hash = {}; + tmp1.fn = tmp1; + tmp1.inverse = self.noop; + stack1 = stack2.call(depth0, stack1, tmp1); + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\n </div>\n <div class=\"form-row form-actions\">\n <input type=\"submit\" class=\"btn btn-primary\" name=\"runtool_btn\" value=\"Execute\">\n</div>\n<div class=\"toolHelp\">\n <div class=\"toolHelpBody\">"; + foundHelper = helpers.help; + stack1 = foundHelper || depth0.help; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "help", { hash: {} }); } + buffer += escapeExpression(stack1) + "</div>\n</div>"; + return buffer;}); +})(); \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/templates/compiled/tool_link.js --- /dev/null +++ b/static/scripts/templates/compiled/tool_link.js @@ -0,0 +1,40 @@ +(function() { + var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; +templates['tool_link'] = template(function (Handlebars,depth0,helpers,partials,data) { + helpers = helpers || Handlebars.helpers; + var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression; + + + buffer += "<a class=\""; + foundHelper = helpers.id; + stack1 = foundHelper || depth0.id; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "id", { hash: {} }); } + buffer += escapeExpression(stack1) + " tool-link\" href=\""; + foundHelper = helpers.link; + stack1 = foundHelper || depth0.link; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "link", { hash: {} }); } + buffer += escapeExpression(stack1) + "\" target=\""; + foundHelper = helpers.target; + stack1 = foundHelper || depth0.target; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "target", { hash: {} }); } + buffer += escapeExpression(stack1) + "\" minsizehint=\""; + foundHelper = helpers.min_width; + stack1 = foundHelper || depth0.min_width; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "min_width", { hash: {} }); } + buffer += escapeExpression(stack1) + "\">"; + foundHelper = helpers.name; + stack1 = foundHelper || depth0.name; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } + buffer += escapeExpression(stack1) + "</a> "; + foundHelper = helpers.description; + stack1 = foundHelper || depth0.description; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); } + buffer += escapeExpression(stack1); + return buffer;}); +})(); \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/templates/compiled/tool_search.js --- /dev/null +++ b/static/scripts/templates/compiled/tool_search.js @@ -0,0 +1,15 @@ +(function() { + var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; +templates['tool_search'] = template(function (Handlebars,depth0,helpers,partials,data) { + helpers = helpers || Handlebars.helpers; + var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression; + + + buffer += "<input type=\"text\" name=\"query\" value=\"search tools\" id=\"tool-search-query\" autocomplete=\"off\" class=\"search-query parent-width\" />\n<img src=\""; + foundHelper = helpers.spinner_url; + stack1 = foundHelper || depth0.spinner_url; + if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } + else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "spinner_url", { hash: {} }); } + buffer += escapeExpression(stack1) + "\" id=\"search-spinner\" class=\"search-spinner\"/>\n"; + return buffer;}); +})(); \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/templates/panel_label.handlebars --- /dev/null +++ b/static/scripts/templates/panel_label.handlebars @@ -0,0 +1,1 @@ +<span>{{name}}</span> \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/templates/panel_section.handlebars --- /dev/null +++ b/static/scripts/templates/panel_section.handlebars @@ -0,0 +1,6 @@ +<div class="toolSectionTitle" id="title_{{id}}"> + <a href="#"><span>{{name}}</span></a> +</div> +<div id="{{id}}" class="toolSectionBody" style="display: none; "> + <div class="toolSectionBg"></div> +<div> \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/templates/tool_form.handlebars --- /dev/null +++ b/static/scripts/templates/tool_form.handlebars @@ -0,0 +1,21 @@ +<div class="toolFormTitle">{{name}} (version {{version}})</div> + <div class="toolFormBody"> + {{#each inputs}} + <div class="form-row"> + <label for="{{name}}">{{label}}:</label> + <div class="form-row-input"> + {{{html}}} + </div> + <div class="toolParamHelp" style="clear: both;"> + {{help}} + </div> + <div style="clear: both;"></div> + </div> + {{/each}} + </div> + <div class="form-row form-actions"> + <input type="submit" class="btn btn-primary" name="runtool_btn" value="Execute"> +</div> +<div class="toolHelp"> + <div class="toolHelpBody">{{help}}</div> +</div> \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/templates/tool_link.handlebars --- /dev/null +++ b/static/scripts/templates/tool_link.handlebars @@ -0,0 +1,1 @@ +<a class="{{id}} tool-link" href="{{link}}" target="{{target}}" minsizehint="{{min_width}}">{{name}}</a> {{description}} \ No newline at end of file diff -r 272506e479f54d41b345c373786c23cab57cc153 -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d static/scripts/templates/tool_search.handlebars --- /dev/null +++ b/static/scripts/templates/tool_search.handlebars @@ -0,0 +1,2 @@ +<input type="text" name="query" value="search tools" id="tool-search-query" autocomplete="off" class="search-query parent-width" /> +<img src="{{spinner_url}}" id="search-spinner" class="search-spinner"/> https://bitbucket.org/galaxy/galaxy-central/changeset/e7dc2ec85d1b/ changeset: e7dc2ec85d1b user: jgoecks date: 2012-04-12 20:29:36 summary: Change name of directory with backbone code to mvc. affected #: 8 files diff -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d -r e7dc2ec85d1ba124bd7f4558b3c5c89b56d55a0f static/scripts/backbone/tools.js --- a/static/scripts/backbone/tools.js +++ /dev/null @@ -1,529 +0,0 @@ -/** - * Model classes for Galaxy tools and tool panel. Models have no references to views, - * instead using events to indicate state changes; this is advantageous because - * multiple views can use the same object and models can be used without views. - */ - -/** - * Simple base model for any visible element. Includes useful attributes and ability - * to set and track visibility. - */ -var BaseModel = Backbone.RelationalModel.extend({ - defaults: { - name: null, - hidden: false - }, - - show: function() { - this.set("hidden", false); - }, - - hide: function() { - this.set("hidden", true); - }, - - is_visible: function() { - return !this.attributes.hidden; - } -}); - -/** - * A Galaxy tool. - */ -var Tool = BaseModel.extend({ - // Default attributes. - defaults: { - description: null, - target: null, - inputs: [] - }, - - relations: [ - { - type: Backbone.HasMany, - key: 'inputs', - relatedModel: 'ToolInput', - reverseRelation: { - key: 'tool' - } - } - ], - - urlRoot: galaxy_paths.attributes.root_path + 'api/tools', - - apply_search_results: function(results) { - ( _.indexOf(results, this.attributes.id) !== -1 ? this.show() : this.hide() ); - return this.is_visible(); - } -}); - -/** - * A tool input. - */ -var ToolInput = Backbone.RelationalModel.extend({ - - initialize: function() { - this.attributes.html = unescape(this.attributes.html); - } - -}); - -/** - * Wrap collection of tools for fast access/manipulation. - */ -var ToolCollection = Backbone.Collection.extend({ - model: Tool -}); - -/** - * Label or section header in tool panel. - */ -var ToolPanelLabel = BaseModel.extend({}); - -/** - * Section of tool panel with elements (labels and tools). - */ -var ToolPanelSection = BaseModel.extend({ - defaults: { - elems: [], - open: false - }, - - clear_search_results: function() { - _.each(this.attributes.elems, function(elt) { - elt.show(); - }); - - this.show(); - this.set("open", false); - }, - - apply_search_results: function(results) { - var all_hidden = true, - cur_label; - _.each(this.attributes.elems, function(elt) { - if (elt instanceof ToolPanelLabel) { - cur_label = elt; - cur_label.hide(); - } - else if (elt instanceof Tool) { - if (elt.apply_search_results(results)) { - all_hidden = false; - if (cur_label) { - cur_label.show(); - } - } - } - }); - - if (all_hidden) { - this.hide(); - } - else { - this.show(); - this.set("open", true); - } - } -}); - -/** - * Tool search that updates results when query is changed. Result value of null - * indicates that query was not run; if not null, results are from search using - * query. - */ -var ToolSearch = BaseModel.extend({ - defaults: { - spinner_url: "", - search_url: "", - visible: true, - query: "", - results: null - }, - - initialize: function() { - this.on("change:query", this.do_search); - }, - - /** - * Do the search and update the results. - */ - do_search: function() { - var query = this.attributes.query; - - // If query is too short, do not search. - if (query.length < 3) { - this.set("results", null); - return; - } - - // Do search via AJAX. - var q = query + '*'; - // Stop previous ajax-request - if (this.timer) { - clearTimeout(this.timer); - } - // Start a new ajax-request in X ms - $("#search-spinner").show(); - var self = this; - this.timer = setTimeout(function () { - $.get(self.attributes.search_url, { query: q }, function (data) { - self.set("results", data); - $("#search-spinner").hide(); - }, "json" ); - }, 200 ); - } -}); - -/** - * A collection of ToolPanelSections, Tools, and ToolPanelLabels. Collection - * applies search results as they become available. - */ -var ToolPanel = Backbone.Collection.extend({ - url: "/tools", - tools: new ToolCollection(), - - parse: function(response) { - // Recursive function to parse tool panel elements. - var parse_elt = function(elt_dict) { - var type = elt_dict.type; - if (type === 'tool') { - return new Tool(elt_dict); - } - else if (type === 'section') { - // Parse elements. - var elems = _.map(elt_dict.elems, parse_elt); - elt_dict.elems = elems; - return new ToolPanelSection(elt_dict); - } - else if (type === 'label') { - return new ToolPanelLabel(elt_dict); - } - }; - - return _.map(response, parse_elt); - }, - - initialize: function(options) { - this.tool_search = options.tool_search; - this.tool_search.on("change:results", this.apply_search_results, this); - this.on("reset", this.populate_tools, this); - }, - - /** - * Populate tool collection from panel elements. - */ - populate_tools: function() { - var self = this; - self.tools = new ToolCollection(); - this.each(function(panel_elt) { - if (panel_elt instanceof ToolPanelSection) { - _.each(panel_elt.attributes.elems, function (section_elt) { - if (section_elt instanceof Tool) { - self.tools.push(section_elt); - } - }); - } - else if (panel_elt instanceof Tool) { - self.tools.push(panel_elt); - } - }); - }, - - clear_search_results: function() { - this.each(function(panel_elt) { - if (panel_elt instanceof ToolPanelSection) { - panel_elt.clear_search_results(); - } - else { - // Label or tool, so just show. - panel_elt.show(); - } - }); - }, - - apply_search_results: function() { - var results = this.tool_search.attributes.results; - if (results === null) { - this.clear_search_results(); - return; - } - - var cur_label = null; - this.each(function(panel_elt) { - if (panel_elt instanceof ToolPanelLabel) { - cur_label = panel_elt; - cur_label.hide(); - } - else if (panel_elt instanceof Tool) { - if (panel_elt.apply_search_results(results)) { - if (cur_label) { - cur_label.show(); - } - } - } - else { - // Starting new section, so clear current label. - cur_label = null; - panel_elt.apply_search_results(results); - } - }); - } -}); - -/** - * View classes for Galaxy tools and tool panel. - * - * Views use precompiled Handlebars templates for rendering. Views update as needed - * based on (a) model/collection events and (b) user interactions; in this sense, - * they are controllers are well and the HTML is the real view in the MVC architecture. - */ - -/** - * Base view that handles visibility based on model's hidden attribute. - */ -var BaseView = Backbone.View.extend({ - initialize: function() { - this.model.on("change:hidden", this.update_visible, this); - this.update_visible(); - }, - update_visible: function() { - ( this.model.attributes.hidden ? this.$el.hide() : this.$el.show() ); - } -}); - -/** - * Link to a tool. - */ -var ToolLinkView = BaseView.extend({ - tagName: 'div', - template: Handlebars.templates.tool_link, - - render: function() { - this.$el.append( this.template(this.model.toJSON()) ); - return this; - } -}); - -/** - * Panel label/section header. - */ -var ToolPanelLabelView = BaseView.extend({ - tagName: 'div', - className: 'toolPanelLabel', - template: Handlebars.templates.panel_label, - - render: function() { - this.$el.append( this.template(this.model.toJSON()) ); - return this; - }, -}); - -/** - * Panel section. - */ -var ToolPanelSectionView = BaseView.extend({ - tagName: 'div', - className: 'toolSectionWrapper', - template: Handlebars.templates.panel_section, - initialize: function() { - BaseView.prototype.initialize.call(this); - this.model.on("change:open", this.update_open, this); - }, - render: function() { - // Build using template. - this.$el.append( this.template(this.model.toJSON()) ); - - // Add tools to section. - var section_body = this.$el.find(".toolSectionBody"); - _.each(this.model.attributes.elems, function(elt) { - if (elt instanceof Tool) { - var tool_view = new ToolLinkView({model: elt, className: "toolTitle"}); - tool_view.render(); - section_body.append(tool_view.$el); - } - else if (elt instanceof ToolPanelLabel) { - var label_view = new ToolPanelLabelView({model: elt}); - label_view.render(); - section_body.append(label_view.$el); - } - else { - // TODO: handle nested section bodies? - } - }); - return this; - }, - - events: { - 'click .toolSectionTitle > a': 'toggle' - }, - - /** - * Toggle visibility of tool section. - */ - toggle: function() { - this.model.set("open", !this.model.attributes.open); - }, - - /** - * Update whether section is open or close. - */ - update_open: function() { - (this.model.attributes.open ? - this.$el.children(".toolSectionBody").slideDown("fast") : - this.$el.children(".toolSectionBody").slideUp("fast") - ); - } -}); - -var ToolSearchView = Backbone.View.extend({ - tagName: 'div', - id: 'tool-search', - className: 'bar', - template: Handlebars.templates.tool_search, - - events: { - 'click': 'focus_and_select', - 'keyup :input': 'query_changed' - }, - - render: function() { - this.$el.append( this.template(this.model.toJSON()) ); - if (!this.model.is_visible()) { - this.$el.hide(); - } - return this; - }, - - focus_and_select: function() { - this.$el.find(":input").focus().select(); - }, - - query_changed: function() { - this.model.set("query", this.$el.find(":input").val()); - } -}); - -/** - * Tool panel view. Events triggered include: - * tool_link_click(click event, tool_model) - */ -var ToolPanelView = Backbone.View.extend({ - tagName: 'div', - className: 'toolMenu', - - /** - * Waits for collection to load and then renders. - */ - initialize: function() { - this.collection.tool_search.on("change:results", this.handle_search_results, this); - }, - - render: function() { - var self = this; - - // Render search. - var search_view = new ToolSearchView( {model: this.collection.tool_search} ); - search_view.render(); - self.$el.append(search_view.$el); - - // Render panel. - this.collection.each(function(panel_elt) { - if (panel_elt instanceof ToolPanelSection) { - var section_title_view = new ToolPanelSectionView({model: panel_elt}); - section_title_view.render(); - self.$el.append(section_title_view.$el); - } - else if (panel_elt instanceof Tool) { - var tool_view = new ToolLinkView({model: panel_elt, className: "toolTitleNoSection"}); - tool_view.render(); - self.$el.append(tool_view.$el); - } - else if (panel_elt instanceof ToolPanelLabel) { - var label_view = new ToolPanelLabelView({model: panel_elt}); - label_view.render(); - self.$el.append(label_view.$el); - } - }); - - // Setup tool link click eventing. - self.$el.find("a.tool-link").click(function(e) { - // Tool id is always the first class. - var - tool_id = $(this).attr('class').split(/\s+/)[0], - tool = self.collection.tools.get(tool_id); - - self.trigger("tool_link_click", e, tool); - }); - - return this; - }, - - handle_search_results: function() { - var results = this.collection.tool_search.attributes.results; - if (results && results.length === 0) { - $("#search-no-results").show(); - } - else { - $("#search-no-results").hide(); - } - } -}); - -/** - * View for working with a tool: setting parameters and inputs and executing the tool. - */ -var ToolFormView = Backbone.View.extend({ - className: 'toolForm', - template: Handlebars.templates.tool_form, - - render: function() { - this.$el.children().remove(); - this.$el.append( this.template(this.model.toJSON()) ); - } -}); - - -/** - * Integrated tool menu + tool execution. - */ -var IntegratedToolMenuAndView = Backbone.View.extend({ - className: 'toolMenuAndView', - - initialize: function() { - this.tool_panel_view = new ToolPanelView({collection: this.collection}); - this.tool_form_view = new ToolFormView(); - }, - - render: function() { - // Render and append tool panel. - this.tool_panel_view.render(); - this.tool_panel_view.$el.css("float", "left"); - this.$el.append(this.tool_panel_view.$el); - - // Append tool form view. - this.tool_form_view.$el.hide(); - this.$el.append(this.tool_form_view.$el); - - // On tool link click, show tool. - var self = this; - this.tool_panel_view.on("tool_link_click", function(e, tool) { - // Prevents click from activating link: - e.preventDefault(); - // Show tool that was clicked on: - self.show_tool(tool); - }); - }, - - /** - * Fetch and display tool. - */ - show_tool: function(tool) { - var self = this; - tool.fetch().done( function() { - self.tool_form_view.model = tool; - self.tool_form_view.render(); - self.tool_form_view.$el.show(); - $('#left').width("650px"); - }); - } -}); \ No newline at end of file diff -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d -r e7dc2ec85d1ba124bd7f4558b3c5c89b56d55a0f static/scripts/backbone/ui.js --- a/static/scripts/backbone/ui.js +++ /dev/null @@ -1,65 +0,0 @@ -/** - * 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. - */ -var IconButton = Backbone.Model.extend({ - defaults: { - title: "", - icon_class: "", - on_click: null - } -}); - -var IconButtonCollection = Backbone.Collection.extend({ - model: IconButton -}); - -/** - * Menu with multiple icon buttons. Views are not needed nor used for individual buttons. - */ -var IconButtonMenuView = Backbone.View.extend({ - tagName: 'div', - - render: function() { - var self = this; - this.collection.each(function(button) { - // Create and add icon button to menu. - $("<a/>").attr('href', 'javascript:void(0)') - .attr('title', button.attributes.title) - .addClass('icon-button menu-button') - .addClass(button.attributes.icon_class) - .appendTo(self.$el) - .click(button.attributes.on_click); - }); - return this; - } -}); - -/** - * - */ -var Grid = Backbone.Collection.extend({ - -}); - -/** - * - */ -var GridView = Backbone.View.extend({ - -}); - - diff -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d -r e7dc2ec85d1ba124bd7f4558b3c5c89b56d55a0f static/scripts/mvc/tools.js --- /dev/null +++ b/static/scripts/mvc/tools.js @@ -0,0 +1,529 @@ +/** + * Model classes for Galaxy tools and tool panel. Models have no references to views, + * instead using events to indicate state changes; this is advantageous because + * multiple views can use the same object and models can be used without views. + */ + +/** + * Simple base model for any visible element. Includes useful attributes and ability + * to set and track visibility. + */ +var BaseModel = Backbone.RelationalModel.extend({ + defaults: { + name: null, + hidden: false + }, + + show: function() { + this.set("hidden", false); + }, + + hide: function() { + this.set("hidden", true); + }, + + is_visible: function() { + return !this.attributes.hidden; + } +}); + +/** + * A Galaxy tool. + */ +var Tool = BaseModel.extend({ + // Default attributes. + defaults: { + description: null, + target: null, + inputs: [] + }, + + relations: [ + { + type: Backbone.HasMany, + key: 'inputs', + relatedModel: 'ToolInput', + reverseRelation: { + key: 'tool' + } + } + ], + + urlRoot: galaxy_paths.attributes.root_path + 'api/tools', + + apply_search_results: function(results) { + ( _.indexOf(results, this.attributes.id) !== -1 ? this.show() : this.hide() ); + return this.is_visible(); + } +}); + +/** + * A tool input. + */ +var ToolInput = Backbone.RelationalModel.extend({ + + initialize: function() { + this.attributes.html = unescape(this.attributes.html); + } + +}); + +/** + * Wrap collection of tools for fast access/manipulation. + */ +var ToolCollection = Backbone.Collection.extend({ + model: Tool +}); + +/** + * Label or section header in tool panel. + */ +var ToolPanelLabel = BaseModel.extend({}); + +/** + * Section of tool panel with elements (labels and tools). + */ +var ToolPanelSection = BaseModel.extend({ + defaults: { + elems: [], + open: false + }, + + clear_search_results: function() { + _.each(this.attributes.elems, function(elt) { + elt.show(); + }); + + this.show(); + this.set("open", false); + }, + + apply_search_results: function(results) { + var all_hidden = true, + cur_label; + _.each(this.attributes.elems, function(elt) { + if (elt instanceof ToolPanelLabel) { + cur_label = elt; + cur_label.hide(); + } + else if (elt instanceof Tool) { + if (elt.apply_search_results(results)) { + all_hidden = false; + if (cur_label) { + cur_label.show(); + } + } + } + }); + + if (all_hidden) { + this.hide(); + } + else { + this.show(); + this.set("open", true); + } + } +}); + +/** + * Tool search that updates results when query is changed. Result value of null + * indicates that query was not run; if not null, results are from search using + * query. + */ +var ToolSearch = BaseModel.extend({ + defaults: { + spinner_url: "", + search_url: "", + visible: true, + query: "", + results: null + }, + + initialize: function() { + this.on("change:query", this.do_search); + }, + + /** + * Do the search and update the results. + */ + do_search: function() { + var query = this.attributes.query; + + // If query is too short, do not search. + if (query.length < 3) { + this.set("results", null); + return; + } + + // Do search via AJAX. + var q = query + '*'; + // Stop previous ajax-request + if (this.timer) { + clearTimeout(this.timer); + } + // Start a new ajax-request in X ms + $("#search-spinner").show(); + var self = this; + this.timer = setTimeout(function () { + $.get(self.attributes.search_url, { query: q }, function (data) { + self.set("results", data); + $("#search-spinner").hide(); + }, "json" ); + }, 200 ); + } +}); + +/** + * A collection of ToolPanelSections, Tools, and ToolPanelLabels. Collection + * applies search results as they become available. + */ +var ToolPanel = Backbone.Collection.extend({ + url: "/tools", + tools: new ToolCollection(), + + parse: function(response) { + // Recursive function to parse tool panel elements. + var parse_elt = function(elt_dict) { + var type = elt_dict.type; + if (type === 'tool') { + return new Tool(elt_dict); + } + else if (type === 'section') { + // Parse elements. + var elems = _.map(elt_dict.elems, parse_elt); + elt_dict.elems = elems; + return new ToolPanelSection(elt_dict); + } + else if (type === 'label') { + return new ToolPanelLabel(elt_dict); + } + }; + + return _.map(response, parse_elt); + }, + + initialize: function(options) { + this.tool_search = options.tool_search; + this.tool_search.on("change:results", this.apply_search_results, this); + this.on("reset", this.populate_tools, this); + }, + + /** + * Populate tool collection from panel elements. + */ + populate_tools: function() { + var self = this; + self.tools = new ToolCollection(); + this.each(function(panel_elt) { + if (panel_elt instanceof ToolPanelSection) { + _.each(panel_elt.attributes.elems, function (section_elt) { + if (section_elt instanceof Tool) { + self.tools.push(section_elt); + } + }); + } + else if (panel_elt instanceof Tool) { + self.tools.push(panel_elt); + } + }); + }, + + clear_search_results: function() { + this.each(function(panel_elt) { + if (panel_elt instanceof ToolPanelSection) { + panel_elt.clear_search_results(); + } + else { + // Label or tool, so just show. + panel_elt.show(); + } + }); + }, + + apply_search_results: function() { + var results = this.tool_search.attributes.results; + if (results === null) { + this.clear_search_results(); + return; + } + + var cur_label = null; + this.each(function(panel_elt) { + if (panel_elt instanceof ToolPanelLabel) { + cur_label = panel_elt; + cur_label.hide(); + } + else if (panel_elt instanceof Tool) { + if (panel_elt.apply_search_results(results)) { + if (cur_label) { + cur_label.show(); + } + } + } + else { + // Starting new section, so clear current label. + cur_label = null; + panel_elt.apply_search_results(results); + } + }); + } +}); + +/** + * View classes for Galaxy tools and tool panel. + * + * Views use precompiled Handlebars templates for rendering. Views update as needed + * based on (a) model/collection events and (b) user interactions; in this sense, + * they are controllers are well and the HTML is the real view in the MVC architecture. + */ + +/** + * Base view that handles visibility based on model's hidden attribute. + */ +var BaseView = Backbone.View.extend({ + initialize: function() { + this.model.on("change:hidden", this.update_visible, this); + this.update_visible(); + }, + update_visible: function() { + ( this.model.attributes.hidden ? this.$el.hide() : this.$el.show() ); + } +}); + +/** + * Link to a tool. + */ +var ToolLinkView = BaseView.extend({ + tagName: 'div', + template: Handlebars.templates.tool_link, + + render: function() { + this.$el.append( this.template(this.model.toJSON()) ); + return this; + } +}); + +/** + * Panel label/section header. + */ +var ToolPanelLabelView = BaseView.extend({ + tagName: 'div', + className: 'toolPanelLabel', + template: Handlebars.templates.panel_label, + + render: function() { + this.$el.append( this.template(this.model.toJSON()) ); + return this; + }, +}); + +/** + * Panel section. + */ +var ToolPanelSectionView = BaseView.extend({ + tagName: 'div', + className: 'toolSectionWrapper', + template: Handlebars.templates.panel_section, + initialize: function() { + BaseView.prototype.initialize.call(this); + this.model.on("change:open", this.update_open, this); + }, + render: function() { + // Build using template. + this.$el.append( this.template(this.model.toJSON()) ); + + // Add tools to section. + var section_body = this.$el.find(".toolSectionBody"); + _.each(this.model.attributes.elems, function(elt) { + if (elt instanceof Tool) { + var tool_view = new ToolLinkView({model: elt, className: "toolTitle"}); + tool_view.render(); + section_body.append(tool_view.$el); + } + else if (elt instanceof ToolPanelLabel) { + var label_view = new ToolPanelLabelView({model: elt}); + label_view.render(); + section_body.append(label_view.$el); + } + else { + // TODO: handle nested section bodies? + } + }); + return this; + }, + + events: { + 'click .toolSectionTitle > a': 'toggle' + }, + + /** + * Toggle visibility of tool section. + */ + toggle: function() { + this.model.set("open", !this.model.attributes.open); + }, + + /** + * Update whether section is open or close. + */ + update_open: function() { + (this.model.attributes.open ? + this.$el.children(".toolSectionBody").slideDown("fast") : + this.$el.children(".toolSectionBody").slideUp("fast") + ); + } +}); + +var ToolSearchView = Backbone.View.extend({ + tagName: 'div', + id: 'tool-search', + className: 'bar', + template: Handlebars.templates.tool_search, + + events: { + 'click': 'focus_and_select', + 'keyup :input': 'query_changed' + }, + + render: function() { + this.$el.append( this.template(this.model.toJSON()) ); + if (!this.model.is_visible()) { + this.$el.hide(); + } + return this; + }, + + focus_and_select: function() { + this.$el.find(":input").focus().select(); + }, + + query_changed: function() { + this.model.set("query", this.$el.find(":input").val()); + } +}); + +/** + * Tool panel view. Events triggered include: + * tool_link_click(click event, tool_model) + */ +var ToolPanelView = Backbone.View.extend({ + tagName: 'div', + className: 'toolMenu', + + /** + * Waits for collection to load and then renders. + */ + initialize: function() { + this.collection.tool_search.on("change:results", this.handle_search_results, this); + }, + + render: function() { + var self = this; + + // Render search. + var search_view = new ToolSearchView( {model: this.collection.tool_search} ); + search_view.render(); + self.$el.append(search_view.$el); + + // Render panel. + this.collection.each(function(panel_elt) { + if (panel_elt instanceof ToolPanelSection) { + var section_title_view = new ToolPanelSectionView({model: panel_elt}); + section_title_view.render(); + self.$el.append(section_title_view.$el); + } + else if (panel_elt instanceof Tool) { + var tool_view = new ToolLinkView({model: panel_elt, className: "toolTitleNoSection"}); + tool_view.render(); + self.$el.append(tool_view.$el); + } + else if (panel_elt instanceof ToolPanelLabel) { + var label_view = new ToolPanelLabelView({model: panel_elt}); + label_view.render(); + self.$el.append(label_view.$el); + } + }); + + // Setup tool link click eventing. + self.$el.find("a.tool-link").click(function(e) { + // Tool id is always the first class. + var + tool_id = $(this).attr('class').split(/\s+/)[0], + tool = self.collection.tools.get(tool_id); + + self.trigger("tool_link_click", e, tool); + }); + + return this; + }, + + handle_search_results: function() { + var results = this.collection.tool_search.attributes.results; + if (results && results.length === 0) { + $("#search-no-results").show(); + } + else { + $("#search-no-results").hide(); + } + } +}); + +/** + * View for working with a tool: setting parameters and inputs and executing the tool. + */ +var ToolFormView = Backbone.View.extend({ + className: 'toolForm', + template: Handlebars.templates.tool_form, + + render: function() { + this.$el.children().remove(); + this.$el.append( this.template(this.model.toJSON()) ); + } +}); + + +/** + * Integrated tool menu + tool execution. + */ +var IntegratedToolMenuAndView = Backbone.View.extend({ + className: 'toolMenuAndView', + + initialize: function() { + this.tool_panel_view = new ToolPanelView({collection: this.collection}); + this.tool_form_view = new ToolFormView(); + }, + + render: function() { + // Render and append tool panel. + this.tool_panel_view.render(); + this.tool_panel_view.$el.css("float", "left"); + this.$el.append(this.tool_panel_view.$el); + + // Append tool form view. + this.tool_form_view.$el.hide(); + this.$el.append(this.tool_form_view.$el); + + // On tool link click, show tool. + var self = this; + this.tool_panel_view.on("tool_link_click", function(e, tool) { + // Prevents click from activating link: + e.preventDefault(); + // Show tool that was clicked on: + self.show_tool(tool); + }); + }, + + /** + * Fetch and display tool. + */ + show_tool: function(tool) { + var self = this; + tool.fetch().done( function() { + self.tool_form_view.model = tool; + self.tool_form_view.render(); + self.tool_form_view.$el.show(); + $('#left').width("650px"); + }); + } +}); \ No newline at end of file diff -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d -r e7dc2ec85d1ba124bd7f4558b3c5c89b56d55a0f static/scripts/mvc/ui.js --- /dev/null +++ b/static/scripts/mvc/ui.js @@ -0,0 +1,65 @@ +/** + * 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. + */ +var IconButton = Backbone.Model.extend({ + defaults: { + title: "", + icon_class: "", + on_click: null + } +}); + +var IconButtonCollection = Backbone.Collection.extend({ + model: IconButton +}); + +/** + * Menu with multiple icon buttons. Views are not needed nor used for individual buttons. + */ +var IconButtonMenuView = Backbone.View.extend({ + tagName: 'div', + + render: function() { + var self = this; + this.collection.each(function(button) { + // Create and add icon button to menu. + $("<a/>").attr('href', 'javascript:void(0)') + .attr('title', button.attributes.title) + .addClass('icon-button menu-button') + .addClass(button.attributes.icon_class) + .appendTo(self.$el) + .click(button.attributes.on_click); + }); + return this; + } +}); + +/** + * + */ +var Grid = Backbone.Collection.extend({ + +}); + +/** + * + */ +var GridView = Backbone.View.extend({ + +}); + + diff -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d -r e7dc2ec85d1ba124bd7f4558b3c5c89b56d55a0f static/scripts/packed/backbone/tools.js --- a/static/scripts/packed/backbone/tools.js +++ /dev/null @@ -1,1 +0,0 @@ -var BaseModel=Backbone.RelationalModel.extend({defaults:{name:null,hidden:false},show:function(){this.set("hidden",false)},hide:function(){this.set("hidden",true)},is_visible:function(){return !this.attributes.hidden}});var Tool=BaseModel.extend({defaults:{description:null,target:null,inputs:[]},relations:[{type:Backbone.HasMany,key:"inputs",relatedModel:"ToolInput",reverseRelation:{key:"tool"}}],url:function(){return galaxy_paths.attributes.root_path+"tools/show?id="+this.id},apply_search_results:function(a){(_.indexOf(a,this.attributes.id)!==-1?this.show():this.hide());return this.is_visible()}});var ToolInput=Backbone.RelationalModel.extend({});var ToolCollection=Backbone.Collection.extend({model:Tool});var ToolPanelLabel=BaseModel.extend({});var ToolPanelSection=BaseModel.extend({defaults:{elems:[],open:false},clear_search_results:function(){_.each(this.attributes.elems,function(a){a.show()});this.show();this.set("open",false)},apply_search_results:function(b){var c=true,a;_.each(this.attributes.elems,function(d){if(d instanceof ToolPanelLabel){a=d;a.hide()}else{if(d instanceof Tool){if(d.apply_search_results(b)){c=false;if(a){a.show()}}}}});if(c){this.hide()}else{this.show();this.set("open",true)}}});var ToolSearch=BaseModel.extend({defaults:{spinner_url:"",search_url:"",visible:true,query:"",results:null},initialize:function(){this.on("change:query",this.do_search)},do_search:function(){var c=this.attributes.query;if(c.length<3){this.set("results",null);return}var b=c+"*";if(this.timer){clearTimeout(this.timer)}$("#search-spinner").show();var a=this;this.timer=setTimeout(function(){$.get(a.attributes.search_url,{query:b},function(d){a.set("results",d);$("#search-spinner").hide()},"json")},200)}});var ToolPanel=Backbone.Collection.extend({url:"/tools",tools:new ToolCollection(),parse:function(a){var b=function(e){var d=e.type;if(d==="tool"){return new Tool(e)}else{if(d==="section"){var c=_.map(e.elems,b);e.elems=c;return new ToolPanelSection(e)}else{if(d==="label"){return new ToolPanelLabel(e)}}}};return _.map(a,b)},initialize:function(a){this.tool_search=a.tool_search;this.tool_search.on("change:results",this.apply_search_results,this);this.on("reset",this.populate_tools,this)},populate_tools:function(){var a=this;a.tools=new ToolCollection();this.each(function(b){if(b instanceof ToolPanelSection){_.each(b.attributes.elems,function(c){if(c instanceof Tool){a.tools.push(c)}})}else{if(b instanceof Tool){a.tools.push(b)}}})},clear_search_results:function(){this.each(function(a){if(a instanceof ToolPanelSection){a.clear_search_results()}else{a.show()}})},apply_search_results:function(){var b=this.tool_search.attributes.results;if(b===null){this.clear_search_results();return}var a=null;this.each(function(c){if(c instanceof ToolPanelLabel){a=c;a.hide()}else{if(c instanceof Tool){if(c.apply_search_results(b)){if(a){a.show()}}}else{a=null;c.apply_search_results(b)}}})}});var BaseView=Backbone.View.extend({initialize:function(){this.model.on("change:hidden",this.update_visible,this);this.update_visible()},update_visible:function(){(this.model.attributes.hidden?this.$el.hide():this.$el.show())}});var ToolLinkView=BaseView.extend({tagName:"div",template:Handlebars.templates.tool_link,render:function(){this.$el.append(this.template(this.model.toJSON()));return this}});var ToolPanelLabelView=BaseView.extend({tagName:"div",className:"toolPanelLabel",template:Handlebars.templates.panel_label,render:function(){this.$el.append(this.template(this.model.toJSON()));return this},});var ToolPanelSectionView=BaseView.extend({tagName:"div",className:"toolSectionWrapper",template:Handlebars.templates.panel_section,initialize:function(){BaseView.prototype.initialize.call(this);this.model.on("change:open",this.update_open,this)},render:function(){this.$el.append(this.template(this.model.toJSON()));var a=this.$el.find(".toolSectionBody");_.each(this.model.attributes.elems,function(b){if(b instanceof Tool){var c=new ToolLinkView({model:b,className:"toolTitle"});c.render();a.append(c.$el)}else{if(b instanceof ToolPanelLabel){var d=new ToolPanelLabelView({model:b});d.render();a.append(d.$el)}else{}}});return this},events:{"click .toolSectionTitle > a":"toggle"},toggle:function(){this.model.set("open",!this.model.attributes.open)},update_open:function(){(this.model.attributes.open?this.$el.children(".toolSectionBody").slideDown("fast"):this.$el.children(".toolSectionBody").slideUp("fast"))}});var ToolSearchView=Backbone.View.extend({tagName:"div",id:"tool-search",className:"bar",template:Handlebars.templates.tool_search,events:{click:"focus_and_select","keyup :input":"query_changed"},render:function(){this.$el.append(this.template(this.model.toJSON()));if(!this.model.is_visible()){this.$el.hide()}return this},focus_and_select:function(){this.$el.find(":input").focus().select()},query_changed:function(){this.model.set("query",this.$el.find(":input").val())}});var ToolPanelView=Backbone.View.extend({tagName:"div",className:"toolMenu",initialize:function(){this.collection.tool_search.on("change:results",this.handle_search_results,this)},render:function(){var a=this;var b=new ToolSearchView({model:this.collection.tool_search});b.render();a.$el.append(b.$el);this.collection.each(function(d){if(d instanceof ToolPanelSection){var c=new ToolPanelSectionView({model:d});c.render();a.$el.append(c.$el)}else{if(d instanceof Tool){var e=new ToolLinkView({model:d,className:"toolTitleNoSection"});e.render();a.$el.append(e.$el)}else{if(d instanceof ToolPanelLabel){var f=new ToolPanelLabelView({model:d});f.render();a.$el.append(f.$el)}}}});a.$el.find("a.tool-link").click(function(f){var d=$(this).attr("class").split(/\s+/)[0],c=a.collection.tools.get(d);a.trigger("tool_link_click",f,c)});return this},handle_search_results:function(){var a=this.collection.tool_search.attributes.results;if(a&&a.length===0){$("#search-no-results").show()}else{$("#search-no-results").hide()}}});var ToolView=Backbone.View.extend({className:"toolForm",render:function(){var a=this}});var IntegratedToolMenuAndView=Backbone.View.extend({className:"toolMenuAndView",initialize:function(){this.tool_panel_view=new ToolPanelView({collection:this.collection})},render:function(){this.tool_panel_view.render();this.tool_panel_view.$el.css("float","left");this.$el.append(this.tool_panel_view.$el);var a=this;this.tool_panel_view.on("tool_link_click",function(c,b){c.preventDefault();a.show_tool(b)})},show_tool:function(a){a.fetch().done(function(){console.log(a);var b=new ToolView({model:a});b.render();b.$el.css("float","left");this.$el.append(b.$el);$("#left").width("500px")})}}); \ No newline at end of file diff -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d -r e7dc2ec85d1ba124bd7f4558b3c5c89b56d55a0f static/scripts/packed/backbone/ui.js --- a/static/scripts/packed/backbone/ui.js +++ /dev/null @@ -1,1 +0,0 @@ -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({}); \ No newline at end of file diff -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d -r e7dc2ec85d1ba124bd7f4558b3c5c89b56d55a0f static/scripts/packed/mvc/tools.js --- /dev/null +++ b/static/scripts/packed/mvc/tools.js @@ -0,0 +1,1 @@ +var BaseModel=Backbone.RelationalModel.extend({defaults:{name:null,hidden:false},show:function(){this.set("hidden",false)},hide:function(){this.set("hidden",true)},is_visible:function(){return !this.attributes.hidden}});var Tool=BaseModel.extend({defaults:{description:null,target:null,inputs:[]},relations:[{type:Backbone.HasMany,key:"inputs",relatedModel:"ToolInput",reverseRelation:{key:"tool"}}],url:function(){return galaxy_paths.attributes.root_path+"tools/show?id="+this.id},apply_search_results:function(a){(_.indexOf(a,this.attributes.id)!==-1?this.show():this.hide());return this.is_visible()}});var ToolInput=Backbone.RelationalModel.extend({});var ToolCollection=Backbone.Collection.extend({model:Tool});var ToolPanelLabel=BaseModel.extend({});var ToolPanelSection=BaseModel.extend({defaults:{elems:[],open:false},clear_search_results:function(){_.each(this.attributes.elems,function(a){a.show()});this.show();this.set("open",false)},apply_search_results:function(b){var c=true,a;_.each(this.attributes.elems,function(d){if(d instanceof ToolPanelLabel){a=d;a.hide()}else{if(d instanceof Tool){if(d.apply_search_results(b)){c=false;if(a){a.show()}}}}});if(c){this.hide()}else{this.show();this.set("open",true)}}});var ToolSearch=BaseModel.extend({defaults:{spinner_url:"",search_url:"",visible:true,query:"",results:null},initialize:function(){this.on("change:query",this.do_search)},do_search:function(){var c=this.attributes.query;if(c.length<3){this.set("results",null);return}var b=c+"*";if(this.timer){clearTimeout(this.timer)}$("#search-spinner").show();var a=this;this.timer=setTimeout(function(){$.get(a.attributes.search_url,{query:b},function(d){a.set("results",d);$("#search-spinner").hide()},"json")},200)}});var ToolPanel=Backbone.Collection.extend({url:"/tools",tools:new ToolCollection(),parse:function(a){var b=function(e){var d=e.type;if(d==="tool"){return new Tool(e)}else{if(d==="section"){var c=_.map(e.elems,b);e.elems=c;return new ToolPanelSection(e)}else{if(d==="label"){return new ToolPanelLabel(e)}}}};return _.map(a,b)},initialize:function(a){this.tool_search=a.tool_search;this.tool_search.on("change:results",this.apply_search_results,this);this.on("reset",this.populate_tools,this)},populate_tools:function(){var a=this;a.tools=new ToolCollection();this.each(function(b){if(b instanceof ToolPanelSection){_.each(b.attributes.elems,function(c){if(c instanceof Tool){a.tools.push(c)}})}else{if(b instanceof Tool){a.tools.push(b)}}})},clear_search_results:function(){this.each(function(a){if(a instanceof ToolPanelSection){a.clear_search_results()}else{a.show()}})},apply_search_results:function(){var b=this.tool_search.attributes.results;if(b===null){this.clear_search_results();return}var a=null;this.each(function(c){if(c instanceof ToolPanelLabel){a=c;a.hide()}else{if(c instanceof Tool){if(c.apply_search_results(b)){if(a){a.show()}}}else{a=null;c.apply_search_results(b)}}})}});var BaseView=Backbone.View.extend({initialize:function(){this.model.on("change:hidden",this.update_visible,this);this.update_visible()},update_visible:function(){(this.model.attributes.hidden?this.$el.hide():this.$el.show())}});var ToolLinkView=BaseView.extend({tagName:"div",template:Handlebars.templates.tool_link,render:function(){this.$el.append(this.template(this.model.toJSON()));return this}});var ToolPanelLabelView=BaseView.extend({tagName:"div",className:"toolPanelLabel",template:Handlebars.templates.panel_label,render:function(){this.$el.append(this.template(this.model.toJSON()));return this},});var ToolPanelSectionView=BaseView.extend({tagName:"div",className:"toolSectionWrapper",template:Handlebars.templates.panel_section,initialize:function(){BaseView.prototype.initialize.call(this);this.model.on("change:open",this.update_open,this)},render:function(){this.$el.append(this.template(this.model.toJSON()));var a=this.$el.find(".toolSectionBody");_.each(this.model.attributes.elems,function(b){if(b instanceof Tool){var c=new ToolLinkView({model:b,className:"toolTitle"});c.render();a.append(c.$el)}else{if(b instanceof ToolPanelLabel){var d=new ToolPanelLabelView({model:b});d.render();a.append(d.$el)}else{}}});return this},events:{"click .toolSectionTitle > a":"toggle"},toggle:function(){this.model.set("open",!this.model.attributes.open)},update_open:function(){(this.model.attributes.open?this.$el.children(".toolSectionBody").slideDown("fast"):this.$el.children(".toolSectionBody").slideUp("fast"))}});var ToolSearchView=Backbone.View.extend({tagName:"div",id:"tool-search",className:"bar",template:Handlebars.templates.tool_search,events:{click:"focus_and_select","keyup :input":"query_changed"},render:function(){this.$el.append(this.template(this.model.toJSON()));if(!this.model.is_visible()){this.$el.hide()}return this},focus_and_select:function(){this.$el.find(":input").focus().select()},query_changed:function(){this.model.set("query",this.$el.find(":input").val())}});var ToolPanelView=Backbone.View.extend({tagName:"div",className:"toolMenu",initialize:function(){this.collection.tool_search.on("change:results",this.handle_search_results,this)},render:function(){var a=this;var b=new ToolSearchView({model:this.collection.tool_search});b.render();a.$el.append(b.$el);this.collection.each(function(d){if(d instanceof ToolPanelSection){var c=new ToolPanelSectionView({model:d});c.render();a.$el.append(c.$el)}else{if(d instanceof Tool){var e=new ToolLinkView({model:d,className:"toolTitleNoSection"});e.render();a.$el.append(e.$el)}else{if(d instanceof ToolPanelLabel){var f=new ToolPanelLabelView({model:d});f.render();a.$el.append(f.$el)}}}});a.$el.find("a.tool-link").click(function(f){var d=$(this).attr("class").split(/\s+/)[0],c=a.collection.tools.get(d);a.trigger("tool_link_click",f,c)});return this},handle_search_results:function(){var a=this.collection.tool_search.attributes.results;if(a&&a.length===0){$("#search-no-results").show()}else{$("#search-no-results").hide()}}});var ToolView=Backbone.View.extend({className:"toolForm",render:function(){var a=this}});var IntegratedToolMenuAndView=Backbone.View.extend({className:"toolMenuAndView",initialize:function(){this.tool_panel_view=new ToolPanelView({collection:this.collection})},render:function(){this.tool_panel_view.render();this.tool_panel_view.$el.css("float","left");this.$el.append(this.tool_panel_view.$el);var a=this;this.tool_panel_view.on("tool_link_click",function(c,b){c.preventDefault();a.show_tool(b)})},show_tool:function(a){a.fetch().done(function(){console.log(a);var b=new ToolView({model:a});b.render();b.$el.css("float","left");this.$el.append(b.$el);$("#left").width("500px")})}}); \ No newline at end of file diff -r 98c2b1689ab32e5f15aa57906d95f1753c593c3d -r e7dc2ec85d1ba124bd7f4558b3c5c89b56d55a0f static/scripts/packed/mvc/ui.js --- /dev/null +++ b/static/scripts/packed/mvc/ui.js @@ -0,0 +1,1 @@ +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({}); \ No newline at end of file https://bitbucket.org/galaxy/galaxy-central/changeset/98213ceeac03/ changeset: 98213ceeac03 user: jgoecks date: 2012-04-12 21:44:12 summary: Automated merge with https://bitbucket.org/galaxy/galaxy-central affected #: 4 files diff -r e7dc2ec85d1ba124bd7f4558b3c5c89b56d55a0f -r 98213ceeac03f0089b23ba64500802d69f3e77bb lib/galaxy/web/controllers/root.py --- a/lib/galaxy/web/controllers/root.py +++ b/lib/galaxy/web/controllers/root.py @@ -250,7 +250,7 @@ valid_chars = '.,^_-()[]0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' fname = data.name fname = ''.join(c in valid_chars and c or '_' for c in fname)[0:150] - trans.response.headers["Content-Disposition"] = "attachment; filename=GalaxyHistoryItem-%s-[%s]%s" % (data.hid, fname, toext) + trans.response.headers["Content-Disposition"] = 'attachment; filename="GalaxyHistoryItem-%s-[%s]%s"' % (data.hid, fname, toext) trans.log_event( "Display dataset id: %s" % str(id) ) try: return open( data.file_name ) diff -r e7dc2ec85d1ba124bd7f4558b3c5c89b56d55a0f -r 98213ceeac03f0089b23ba64500802d69f3e77bb lib/galaxy/web/controllers/workflow.py --- a/lib/galaxy/web/controllers/workflow.py +++ b/lib/galaxy/web/controllers/workflow.py @@ -1109,7 +1109,7 @@ valid_chars = '.,^_-()[]0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' sname = stored.name sname = ''.join(c in valid_chars and c or '_' for c in sname)[0:150] - trans.response.headers["Content-Disposition"] = "attachment; filename=Galaxy-Workflow-%s.ga" % ( sname ) + trans.response.headers["Content-Disposition"] = 'attachment; filename="Galaxy-Workflow-%s.ga"' % ( sname ) trans.response.set_content_type( 'application/galaxy-archive' ) return stored_dict @web.expose diff -r e7dc2ec85d1ba124bd7f4558b3c5c89b56d55a0f -r 98213ceeac03f0089b23ba64500802d69f3e77bb static/scripts/templates/compiled/panel_section.js --- a/static/scripts/templates/compiled/panel_section.js +++ b/static/scripts/templates/compiled/panel_section.js @@ -10,7 +10,7 @@ stack1 = foundHelper || depth0.id; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "id", { hash: {} }); } - buffer += escapeExpression(stack1) + "\">\n <a href=\"#\"><span>"; + buffer += escapeExpression(stack1) + "\">\n <a href=\"javascript:void(0)\"><span>"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } diff -r e7dc2ec85d1ba124bd7f4558b3c5c89b56d55a0f -r 98213ceeac03f0089b23ba64500802d69f3e77bb static/scripts/templates/panel_section.handlebars --- a/static/scripts/templates/panel_section.handlebars +++ b/static/scripts/templates/panel_section.handlebars @@ -1,5 +1,5 @@ <div class="toolSectionTitle" id="title_{{id}}"> - <a href="#"><span>{{name}}</span></a> + <a href="javascript:void(0)"><span>{{name}}</span></a></div><div id="{{id}}" class="toolSectionBody" style="display: none; "><div class="toolSectionBg"></div> https://bitbucket.org/galaxy/galaxy-central/changeset/398905e25268/ changeset: 398905e25268 user: jgoecks date: 2012-04-13 16:04:42 summary: Update templates to reflect changes in javascript directories organization. affected #: 4 files diff -r 98213ceeac03f0089b23ba64500802d69f3e77bb -r 398905e25268a18e53eb2a01f9eb504020ece352 lib/galaxy/web/framework/helpers/__init__.py --- a/lib/galaxy/web/framework/helpers/__init__.py +++ b/lib/galaxy/web/framework/helpers/__init__.py @@ -61,12 +61,12 @@ """ return js_helper( '/static/scripts/', *args ) -def handlebars( *args ): +def templates( *args ): """ Take a list of template names (no extension) and return appropriate string of script tags. """ - return js_helper( '/static/scripts/handlebars/compiled/', *args ) + return js_helper( '/static/scripts/templates/compiled/', *args ) # Hashes diff -r 98213ceeac03f0089b23ba64500802d69f3e77bb -r 398905e25268a18e53eb2a01f9eb504020ece352 templates/base.mako --- a/templates/base.mako +++ b/templates/base.mako @@ -26,7 +26,7 @@ ## <!--[if lt IE 7]> ## <script type='text/javascript' src="/static/scripts/IE7.js"></script> ## <![endif]--> - ${h.js( "jquery", "galaxy.base", "libs/underscore", "libs/backbone", "libs/backbone-relational", "libs/handlebars.runtime", "backbone/ui" )} + ${h.js( "jquery", "galaxy.base", "libs/underscore", "libs/backbone", "libs/backbone-relational", "libs/handlebars.runtime", "mvc/ui" )} <script type="text/javascript"> // Set up needed paths. var galaxy_paths = new GalaxyPaths({ diff -r 98213ceeac03f0089b23ba64500802d69f3e77bb -r 398905e25268a18e53eb2a01f9eb504020ece352 templates/base_panels.mako --- a/templates/base_panels.mako +++ b/templates/base_panels.mako @@ -47,7 +47,7 @@ <!--[if lt IE 7]> ${h.js( 'IE7', 'ie7-recalc' )} <![endif]--> - ${h.js( 'jquery', 'libs/underscore', 'libs/backbone', 'libs/backbone-relational', 'libs/handlebars.runtime', 'backbone/ui' )} + ${h.js( 'jquery', 'libs/underscore', 'libs/backbone', 'libs/backbone-relational', 'libs/handlebars.runtime', 'mvc/ui' )} <script type="text/javascript"> // Set up needed paths. var galaxy_paths = new GalaxyPaths({ diff -r 98213ceeac03f0089b23ba64500802d69f3e77bb -r 398905e25268a18e53eb2a01f9eb504020ece352 templates/root/tool_menu.mako --- a/templates/root/tool_menu.mako +++ b/templates/root/tool_menu.mako @@ -16,8 +16,8 @@ <%def name="javascripts()"> ${parent.javascripts()} - ${h.handlebars( "tool_link", "panel_label", "panel_section", "tool_search" )} - ${h.js( "galaxy.base", "json2", "autocomplete_tagging", "backbone/tools" )} + ${h.templates( "tool_link", "panel_label", "panel_section", "tool_search" )} + ${h.js( "galaxy.base", "json2", "autocomplete_tagging", "mvc/tools" )} <% # Set up for creating tool panel. https://bitbucket.org/galaxy/galaxy-central/changeset/afd1b16d7ec5/ changeset: afd1b16d7ec5 user: jgoecks date: 2012-04-13 16:05:24 summary: Merge affected #: 1 file diff -r 398905e25268a18e53eb2a01f9eb504020ece352 -r afd1b16d7ec5d86dbe4f4a8d8636ec1d82d49f98 lib/galaxy/web/controllers/user.py --- a/lib/galaxy/web/controllers/user.py +++ b/lib/galaxy/web/controllers/user.py @@ -60,8 +60,6 @@ auto_associate = util.string_as_bool( kwd.get( 'auto_associate', False ) ) use_panels = util.string_as_bool( kwd.get( 'use_panels', False ) ) action = 'login' - if not redirect: - redirect = url_for( '/' ) consumer = trans.app.openid_manager.get_consumer( trans ) if openid_url: openid_provider_obj = trans.app.openid_providers.new_provider_from_identifier( openid_url ) @@ -113,7 +111,7 @@ consumer = trans.app.openid_manager.get_consumer( trans ) info = consumer.complete( kwd, trans.request.url ) display_identifier = info.getDisplayIdentifier() - redirect = kwd.get( 'redirect', url_for( '/' ) ) + redirect = kwd.get( 'redirect', '' ) openid_provider = kwd.get( 'openid_provider', None ) if info.status == trans.app.openid_manager.FAILURE and display_identifier: message = "Login via OpenID failed. The technical reason for this follows, please include this message in your email if you need to %s to resolve this problem: %s" % ( contact, info.message ) @@ -163,6 +161,8 @@ openid_provider_obj.post_authentication( trans, trans.app.openid_manager, info ) if redirect: message = '%s<br>Click <a href="%s"><strong>here</strong></a> to return to the page you were previously viewing.' % ( message, redirect ) + if redirect and status != "error": + return trans.response.send_redirect( redirect ) return trans.response.send_redirect( url_for( controller='user', action='openid_manage', use_panels=True, @@ -173,6 +173,8 @@ trans.handle_user_login( user_openid.user, webapp ) trans.log_event( "User logged in via OpenID: %s" % display_identifier ) openid_provider_obj.post_authentication( trans, trans.app.openid_manager, info ) + if not redirect: + redirect = url_for( '/' ) return trans.response.send_redirect( redirect ) trans.sa_session.add( user_openid ) trans.sa_session.flush() @@ -252,14 +254,19 @@ message = '%s<li><a href="%s" target="_blank">%s</a></li>' % ( message, url_for( controller='user', action='openid_auth', openid_provider=openid.id, redirect=redirect, auto_associate=True ), openid.name ) message = "%s</ul>" % ( message ) return trans.response.send_redirect( url_for( controller='user', - action='openid_manage', - use_panels=True, - redirect=redirect, - message=message, - status='info' ) ) - if not redirect: - redirect = url_for( '/' ) - return trans.response.send_redirect( redirect ) + action='openid_manage', + use_panels=use_panels, + redirect=redirect, + message=message, + status='info' ) ) + if redirect: + return trans.response.send_redirect( redirect ) + return trans.response.send_redirect( url_for( controller='user', + action='openid_manage', + use_panels=use_panels, + redirect=redirect, + message=message, + status='info' ) ) if kwd.get( 'create_user_button', False ): password = kwd.get( 'password', '' ) confirm = kwd.get( 'confirm', '' ) @@ -304,9 +311,14 @@ redirect=redirect, message=message, status='info' ) ) - if not redirect: - redirect = url_for( '/' ) - return trans.response.send_redirect( redirect ) + if redirect: + return trans.response.send_redirect( redirect ) + return trans.response.send_redirect( url_for( controller='user', + action='openid_manage', + use_panels=use_panels, + redirect=redirect, + message=message, + status='info' ) ) else: message = error status = 'error' 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)
-
Bitbucket