commit/galaxy-central: guerler: ToolForm: Add baseurl, fix dynamic drill down options
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/7b208a4b38f9/ Changeset: 7b208a4b38f9 User: guerler Date: 2014-12-01 06:18:16+00:00 Summary: ToolForm: Add baseurl, fix dynamic drill down options Affected #: 7 files diff -r a1fff5e41925f99d95def300a162e12db0f4b8c7 -r 7b208a4b38f934cdea8f4f331f2721adcc7c1166 client/galaxy/scripts/mvc/tools/tools-section.js --- a/client/galaxy/scripts/mvc/tools/tools-section.js +++ b/client/galaxy/scripts/mvc/tools/tools-section.js @@ -342,6 +342,11 @@ case 'drill_down': field = this._fieldDrilldown(input_def); break; + + // base url field + case 'baseurl': + field = this._fieldHidden(input_def); + break; // field not found default: diff -r a1fff5e41925f99d95def300a162e12db0f4b8c7 -r 7b208a4b38f934cdea8f4f331f2721adcc7c1166 client/galaxy/scripts/mvc/ui/ui-drilldown.js --- a/client/galaxy/scripts/mvc/ui/ui-drilldown.js +++ b/client/galaxy/scripts/mvc/ui/ui-drilldown.js @@ -16,8 +16,7 @@ */ _templateOption: function(name, value, selected) { return '<div>' + - '<input name="' + this.options.id + '" class="ui-option" type="' + this.display + '" value="' + value + '">' + - Utils.sanitize(name) + + '<input name="' + this.options.id + '" class="ui-option" type="' + this.display + '" value="' + value + '">' + name + '<div/>'; }, diff -r a1fff5e41925f99d95def300a162e12db0f4b8c7 -r 7b208a4b38f934cdea8f4f331f2721adcc7c1166 lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -650,6 +650,11 @@ def get_label( self ): # BaseURLToolParameters are ultimately "hidden" parameters return None + + def to_dict( self, trans, view='collection', value_mapper=None ): + d = super( BaseURLToolParameter, self ).to_dict( trans ) + d['value'] = self.get_value( trans ) + return d DEFAULT_VALUE_MAP = lambda x: x @@ -1606,13 +1611,13 @@ """ return self.filtered.keys() - def to_dict( self, trans, view='collection', value_mapper=None, context={} ): + def to_dict( self, trans, view='collection', value_mapper=None, other_values={} ): # skip SelectToolParameter (the immediate parent) bc we need to get options in a different way here d = ToolParameter.to_dict( self, trans ) options = [] try: - options = self.get_options( trans, context ) + options = self.get_options( trans=trans, other_values=other_values ) except KeyError: # will sometimes error if self.is_dynamic and self.filtered # bc we dont/cant fill out other_values above ({}) diff -r a1fff5e41925f99d95def300a162e12db0f4b8c7 -r 7b208a4b38f934cdea8f4f331f2721adcc7c1166 static/scripts/mvc/tools/tools-section.js --- a/static/scripts/mvc/tools/tools-section.js +++ b/static/scripts/mvc/tools/tools-section.js @@ -342,6 +342,11 @@ case 'drill_down': field = this._fieldDrilldown(input_def); break; + + // base url field + case 'baseurl': + field = this._fieldHidden(input_def); + break; // field not found default: diff -r a1fff5e41925f99d95def300a162e12db0f4b8c7 -r 7b208a4b38f934cdea8f4f331f2721adcc7c1166 static/scripts/mvc/ui/ui-drilldown.js --- a/static/scripts/mvc/ui/ui-drilldown.js +++ b/static/scripts/mvc/ui/ui-drilldown.js @@ -16,8 +16,7 @@ */ _templateOption: function(name, value, selected) { return '<div>' + - '<input name="' + this.options.id + '" class="ui-option" type="' + this.display + '" value="' + value + '">' + - Utils.sanitize(name) + + '<input name="' + this.options.id + '" class="ui-option" type="' + this.display + '" value="' + value + '">' + name + '<div/>'; }, diff -r a1fff5e41925f99d95def300a162e12db0f4b8c7 -r 7b208a4b38f934cdea8f4f331f2721adcc7c1166 static/scripts/packed/mvc/tools/tools-section.js --- a/static/scripts/packed/mvc/tools/tools-section.js +++ b/static/scripts/packed/mvc/tools/tools-section.js @@ -1,1 +1,1 @@ -define(["utils/utils","mvc/ui/ui-table","mvc/ui/ui-misc","mvc/tools/tools-repeat","mvc/tools/tools-select-content","mvc/tools/tools-input"],function(d,b,g,c,a,e){var f=Backbone.View.extend({initialize:function(i,h){this.app=i;this.inputs=h.inputs;h.cls_tr="section-row";this.table=new b.View(h);this.setElement(this.table.$el);this.render()},render:function(){this.table.delAll();for(var h in this.inputs){this._add(this.inputs[h])}},_add:function(j){var i=this;var h=jQuery.extend(true,{},j);h.id=j.id=d.uuid();this.app.input_list[h.id]=h;var k=h.type;switch(k){case"conditional":this._addConditional(h);break;case"repeat":this._addRepeat(h);break;default:this._addRow(h)}},_addConditional:function(h){var j=this;h.test_param.id=h.id;var m=this._addRow(h.test_param);m.options.onchange=function(t){var p=j.app.tree.matchCase(h,t);for(var r in h.cases){var w=h.cases[r];var u=h.id+"-section-"+r;var o=j.table.get(u);var v=false;for(var q in w.inputs){var s=w.inputs[q].type;if(s&&s!=="hidden"){v=true;break}}if(r==p&&v){o.fadeIn("fast")}else{o.hide()}}j.app.refresh()};for(var l in h.cases){var k=h.id+"-section-"+l;var n=new f(this.app,{inputs:h.cases[l].inputs,cls:"ui-table-plain"});n.$el.addClass("ui-table-form-section");this.table.add(n.$el);this.table.append(k)}m.trigger("change")},_addRepeat:function(o){var r=this;var p=0;function m(i,t){var s=o.id+"-section-"+(p++);var u=null;if(t){u=function(){k.del(s);k.retitle(o.title);r.app.rebuild();r.app.refresh()}}var v=new f(r.app,{inputs:i,cls:"ui-table-plain"});k.add({id:s,title:o.title,$el:v.$el,ondel:u});k.retitle(o.title)}var k=new c.View({title_new:o.title,max:o.max,onnew:function(){m(o.inputs,true);r.app.rebuild();r.app.refresh()}});var h=o.min;var q=_.size(o.cache);for(var l=0;l<Math.max(q,h);l++){var n=null;if(l<q){n=o.cache[l]}else{n=o.inputs}m(n,l>=h)}var j=new e(this.app,{label:o.title,help:o.help,field:k});j.$el.addClass("ui-table-form-section");this.table.add(j.$el);this.table.append(o.id)},_addRow:function(h){var k=h.id;var i=this._createField(h);if(h.is_dynamic){this.app.is_dynamic=true}this.app.field_list[k]=i;var j=new e(this.app,{label:h.label,optional:h.optional,help:h.help,field:i});this.app.element_list[k]=j;this.table.add(j.$el);this.table.append(k);return i},_createField:function(h){var i=null;switch(h.type){case"text":i=this._fieldText(h);break;case"select":i=this._fieldSelect(h);break;case"data":i=this._fieldData(h);break;case"data_column":i=this._fieldSelect(h);break;case"hidden":i=this._fieldHidden(h);break;case"integer":i=this._fieldSlider(h);break;case"float":i=this._fieldSlider(h);break;case"boolean":i=this._fieldBoolean(h);break;case"genomebuild":h.searchable=true;i=this._fieldSelect(h);break;case"drill_down":i=this._fieldDrilldown(h);break;default:this.app.incompatible=true;if(h.options){i=this._fieldSelect(h)}else{i=this._fieldText(h)}console.debug("tools-form::_addRow() : Auto matched field type ("+h.type+").")}if(h.value!==undefined){i.value(h.value)}return i},_fieldData:function(h){var i=this;return new a.View(this.app,{id:"field-"+h.id,extensions:h.extensions,multiple:h.multiple,data:h.options,onchange:function(){i.app.refresh()}})},_fieldSelect:function(h){var k=[];for(var l in h.options){var m=h.options[l];k.push({label:m[0],value:m[1]})}var n=g.Select;switch(h.display){case"checkboxes":n=g.Checkbox;break;case"radio":n=g.Radio;break}var j=this;return new n.View({id:"field-"+h.id,data:k,multiple:h.multiple,searchable:h.searchable,onchange:function(){j.app.refresh()}})},_fieldDrilldown:function(h){var i=this;return new g.Drilldown.View({id:"field-"+h.id,data:h.options,display:h.display,onchange:function(){i.app.refresh()}})},_fieldText:function(h){var i=this;return new g.Input({id:"field-"+h.id,area:h.area,onchange:function(){i.app.refresh()}})},_fieldSlider:function(h){return new g.Slider.View({id:"field-"+h.id,precise:h.type=="float",min:h.min,max:h.max})},_fieldHidden:function(h){return new g.Hidden({id:"field-"+h.id})},_fieldBoolean:function(h){return new g.RadioButton.View({id:"field-"+h.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]})}});return{View:f}}); \ No newline at end of file +define(["utils/utils","mvc/ui/ui-table","mvc/ui/ui-misc","mvc/tools/tools-repeat","mvc/tools/tools-select-content","mvc/tools/tools-input"],function(d,b,g,c,a,e){var f=Backbone.View.extend({initialize:function(i,h){this.app=i;this.inputs=h.inputs;h.cls_tr="section-row";this.table=new b.View(h);this.setElement(this.table.$el);this.render()},render:function(){this.table.delAll();for(var h in this.inputs){this._add(this.inputs[h])}},_add:function(j){var i=this;var h=jQuery.extend(true,{},j);h.id=j.id=d.uuid();this.app.input_list[h.id]=h;var k=h.type;switch(k){case"conditional":this._addConditional(h);break;case"repeat":this._addRepeat(h);break;default:this._addRow(h)}},_addConditional:function(h){var j=this;h.test_param.id=h.id;var m=this._addRow(h.test_param);m.options.onchange=function(t){var p=j.app.tree.matchCase(h,t);for(var r in h.cases){var w=h.cases[r];var u=h.id+"-section-"+r;var o=j.table.get(u);var v=false;for(var q in w.inputs){var s=w.inputs[q].type;if(s&&s!=="hidden"){v=true;break}}if(r==p&&v){o.fadeIn("fast")}else{o.hide()}}j.app.refresh()};for(var l in h.cases){var k=h.id+"-section-"+l;var n=new f(this.app,{inputs:h.cases[l].inputs,cls:"ui-table-plain"});n.$el.addClass("ui-table-form-section");this.table.add(n.$el);this.table.append(k)}m.trigger("change")},_addRepeat:function(o){var r=this;var p=0;function m(i,t){var s=o.id+"-section-"+(p++);var u=null;if(t){u=function(){k.del(s);k.retitle(o.title);r.app.rebuild();r.app.refresh()}}var v=new f(r.app,{inputs:i,cls:"ui-table-plain"});k.add({id:s,title:o.title,$el:v.$el,ondel:u});k.retitle(o.title)}var k=new c.View({title_new:o.title,max:o.max,onnew:function(){m(o.inputs,true);r.app.rebuild();r.app.refresh()}});var h=o.min;var q=_.size(o.cache);for(var l=0;l<Math.max(q,h);l++){var n=null;if(l<q){n=o.cache[l]}else{n=o.inputs}m(n,l>=h)}var j=new e(this.app,{label:o.title,help:o.help,field:k});j.$el.addClass("ui-table-form-section");this.table.add(j.$el);this.table.append(o.id)},_addRow:function(h){var k=h.id;var i=this._createField(h);if(h.is_dynamic){this.app.is_dynamic=true}this.app.field_list[k]=i;var j=new e(this.app,{label:h.label,optional:h.optional,help:h.help,field:i});this.app.element_list[k]=j;this.table.add(j.$el);this.table.append(k);return i},_createField:function(h){var i=null;switch(h.type){case"text":i=this._fieldText(h);break;case"select":i=this._fieldSelect(h);break;case"data":i=this._fieldData(h);break;case"data_column":i=this._fieldSelect(h);break;case"hidden":i=this._fieldHidden(h);break;case"integer":i=this._fieldSlider(h);break;case"float":i=this._fieldSlider(h);break;case"boolean":i=this._fieldBoolean(h);break;case"genomebuild":h.searchable=true;i=this._fieldSelect(h);break;case"drill_down":i=this._fieldDrilldown(h);break;case"baseurl":i=this._fieldHidden(h);break;default:this.app.incompatible=true;if(h.options){i=this._fieldSelect(h)}else{i=this._fieldText(h)}console.debug("tools-form::_addRow() : Auto matched field type ("+h.type+").")}if(h.value!==undefined){i.value(h.value)}return i},_fieldData:function(h){var i=this;return new a.View(this.app,{id:"field-"+h.id,extensions:h.extensions,multiple:h.multiple,data:h.options,onchange:function(){i.app.refresh()}})},_fieldSelect:function(h){var k=[];for(var l in h.options){var m=h.options[l];k.push({label:m[0],value:m[1]})}var n=g.Select;switch(h.display){case"checkboxes":n=g.Checkbox;break;case"radio":n=g.Radio;break}var j=this;return new n.View({id:"field-"+h.id,data:k,multiple:h.multiple,searchable:h.searchable,onchange:function(){j.app.refresh()}})},_fieldDrilldown:function(h){var i=this;return new g.Drilldown.View({id:"field-"+h.id,data:h.options,display:h.display,onchange:function(){i.app.refresh()}})},_fieldText:function(h){var i=this;return new g.Input({id:"field-"+h.id,area:h.area,onchange:function(){i.app.refresh()}})},_fieldSlider:function(h){return new g.Slider.View({id:"field-"+h.id,precise:h.type=="float",min:h.min,max:h.max})},_fieldHidden:function(h){return new g.Hidden({id:"field-"+h.id})},_fieldBoolean:function(h){return new g.RadioButton.View({id:"field-"+h.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]})}});return{View:f}}); \ No newline at end of file diff -r a1fff5e41925f99d95def300a162e12db0f4b8c7 -r 7b208a4b38f934cdea8f4f331f2721adcc7c1166 static/scripts/packed/mvc/ui/ui-drilldown.js --- a/static/scripts/packed/mvc/ui/ui-drilldown.js +++ b/static/scripts/packed/mvc/ui/ui-drilldown.js @@ -1,1 +1,1 @@ -define(["utils/utils","mvc/ui/ui-options"],function(b,a){var c=a.Base.extend({initialize:function(d){this.display=d.display||"checkbox";d.multiple=(this.display=="checkbox");a.Base.prototype.initialize.call(this,d)},_templateOption:function(d,f,e){return'<div><input name="'+this.options.id+'" class="ui-option" type="'+this.display+'" value="'+f+'">'+b.sanitize(d)+"<div/>"},_templateOptions:function(f){var e=this;function g(k,l){function j(m){if(m){l.fadeIn("fast");k.removeClass("toggle-expand");k.addClass("toggle");k.is_expanded=true}else{l.hide();k.removeClass("toggle");k.addClass("toggle-expand");k.is_expanded=false}}k.on("click",function(){j(!k.is_expanded)})}function d(p,k){for(i in k){var q=k[i];var m=q.options.length>0;var l=$("<div/>");if(m){var n=$('<span class="ui-drilldown-button form-toggle icon-button toggle-expand" style="position: relative; top: 2px;"/>');var j=$("<div/>");j.append(n);j.append(e._templateOption(q.name,q.value));l.append(j);var o=$('<div style="display: none; margin-left: 25px;"/>');d(o,q.options);l.append(o);g(n,o)}else{l.append(e._templateOption(q.name,q.value))}p.append(l)}}var h=$("<div/>");d(h,f);return h},_template:function(d){return'<div class="ui-options drilldown-container" id="'+d.id+'"/>'}});return{View:c}}); \ No newline at end of file +define(["utils/utils","mvc/ui/ui-options"],function(b,a){var c=a.Base.extend({initialize:function(d){this.display=d.display||"checkbox";d.multiple=(this.display=="checkbox");a.Base.prototype.initialize.call(this,d)},_templateOption:function(d,f,e){return'<div><input name="'+this.options.id+'" class="ui-option" type="'+this.display+'" value="'+f+'">'+d+"<div/>"},_templateOptions:function(f){var e=this;function g(k,l){function j(m){if(m){l.fadeIn("fast");k.removeClass("toggle-expand");k.addClass("toggle");k.is_expanded=true}else{l.hide();k.removeClass("toggle");k.addClass("toggle-expand");k.is_expanded=false}}k.on("click",function(){j(!k.is_expanded)})}function d(p,k){for(i in k){var q=k[i];var m=q.options.length>0;var l=$("<div/>");if(m){var n=$('<span class="ui-drilldown-button form-toggle icon-button toggle-expand" style="position: relative; top: 2px;"/>');var j=$("<div/>");j.append(n);j.append(e._templateOption(q.name,q.value));l.append(j);var o=$('<div style="display: none; margin-left: 25px;"/>');d(o,q.options);l.append(o);g(n,o)}else{l.append(e._templateOption(q.name,q.value))}p.append(l)}}var h=$("<div/>");d(h,f);return h},_template:function(d){return'<div class="ui-options drilldown-container" id="'+d.id+'"/>'}});return{View:c}}); \ No newline at end of file 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)
-
commits-noreply@bitbucket.org