commit/galaxy-central: guerler: Ui: Allow portlet elements without paragraph wrapping
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/dae2fd928357/ Changeset: dae2fd928357 User: guerler Date: 2014-12-10 08:35:36+00:00 Summary: Ui: Allow portlet elements without paragraph wrapping Affected #: 6 files diff -r 9b4153f9ccd58b46e8d98796a675e17ce7f3a1c5 -r dae2fd928357c019b33db953fd840eab8512a1a3 client/galaxy/scripts/mvc/tools/tools-form.js --- a/client/galaxy/scripts/mvc/tools/tools-form.js +++ b/client/galaxy/scripts/mvc/tools/tools-form.js @@ -469,7 +469,7 @@ } // append message - this.portlet.append(this.message.$el); + this.portlet.append(this.message.$el, true); // append tool section this.portlet.append(this.section.$el); diff -r 9b4153f9ccd58b46e8d98796a675e17ce7f3a1c5 -r dae2fd928357c019b33db953fd840eab8512a1a3 client/galaxy/scripts/mvc/ui/ui-portlet.js --- a/client/galaxy/scripts/mvc/ui/ui-portlet.js +++ b/client/galaxy/scripts/mvc/ui/ui-portlet.js @@ -89,10 +89,14 @@ }, // append - append: function($el) { - this.$content.append(Utils.wrap($el)); + append: function($el, unwrapped) { + if (unwrapped) { + this.$content.append($el); + } else { + this.$content.append(Utils.wrap($el)); + } }, - + // content content: function() { return this.$content; diff -r 9b4153f9ccd58b46e8d98796a675e17ce7f3a1c5 -r dae2fd928357c019b33db953fd840eab8512a1a3 static/scripts/mvc/tools/tools-form.js --- a/static/scripts/mvc/tools/tools-form.js +++ b/static/scripts/mvc/tools/tools-form.js @@ -469,7 +469,7 @@ } // append message - this.portlet.append(this.message.$el); + this.portlet.append(this.message.$el, true); // append tool section this.portlet.append(this.section.$el); diff -r 9b4153f9ccd58b46e8d98796a675e17ce7f3a1c5 -r dae2fd928357c019b33db953fd840eab8512a1a3 static/scripts/mvc/ui/ui-portlet.js --- a/static/scripts/mvc/ui/ui-portlet.js +++ b/static/scripts/mvc/ui/ui-portlet.js @@ -89,10 +89,14 @@ }, // append - append: function($el) { - this.$content.append(Utils.wrap($el)); + append: function($el, unwrapped) { + if (unwrapped) { + this.$content.append($el); + } else { + this.$content.append(Utils.wrap($el)); + } }, - + // content content: function() { return this.$content; diff -r 9b4153f9ccd58b46e8d98796a675e17ce7f3a1c5 -r dae2fd928357c019b33db953fd840eab8512a1a3 static/scripts/packed/mvc/tools/tools-form.js --- a/static/scripts/packed/mvc/tools/tools-form.js +++ b/static/scripts/packed/mvc/tools/tools-form.js @@ -1,1 +1,1 @@ -define(["utils/utils","utils/deferred","mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-content","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(i,j,h,m,k,a,e,d,f,l,c,g){var b=Backbone.View.extend({container:"body",initialize:function(o){console.debug(o);var n=this;var p=parent.Galaxy;if(p&&p.modal){this.modal=p.modal}else{this.modal=new m.Modal.View()}if(p&&p.currUser){this.is_admin=p.currUser.get("is_admin")}else{this.is_admin=false}this.options=o;this.deferred=new j();this.setElement("<div/>");$(this.container).append(this.$el);this._buildForm()},reciept:function(n){$(this.container).empty();$(this.container).append(n)},reset:function(){for(var n in this.element_list){this.element_list[n].reset()}},rebuild:function(){this.tree.refresh();console.debug("tools-form::rebuild() - Rebuilding data structures.")},refresh:function(){if(this.is_dynamic){var n=this;this.deferred.reset();this.deferred.execute(function(){n._updateModel()})}},_buildModel:function(){var n=this;var o=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){o+="job_id="+this.options.job_id}else{if(this.options.dataset_id){o+="dataset_id="+this.options.dataset_id}else{o+="tool_version="+this.options.version+"&";var q=top.location.href;var r=q.indexOf("?");if(q.indexOf("tool_id=")!=-1&&r!==-1){o+=q.slice(r+1)}}}var p=this.deferred.register();i.request({type:"GET",url:o,success:function(s){n.options=s;n._buildForm();n.message.update({status:"success",message:"Now you are using using '"+n.options.name+"' version "+n.options.version+".",persistent:false});n.deferred.done(p);console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(s)},error:function(s){n.deferred.done(p);console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(s);var t=s.error||"Uncaught error.";n.modal.show({title:"Tool cannot be executed",body:t,buttons:{Close:function(){n.modal.hide()}}})}})},_updateModel:function(){var n=this;var o=this.tree.finalize({data:function(s){if(s.values.length>0&&s.values[0]&&s.values[0].src==="hda"){return n.content.get({id:s.values[0].id,src:"hda"}).id_uncoded}return null}});console.debug("tools-form::_refreshForm() - Refreshing states.");console.debug(o);function r(v){for(var t in n.input_list){var u=n.field_list[t];var s=n.input_list[t];if(s.is_dynamic&&u.wait&&u.unwait){if(v){u.wait()}else{u.unwait()}}}}r(true);var q=this.deferred.register();var p=galaxy_config.root+"api/tools/"+this.options.id+"/build?tool_version="+this.options.version;i.request({type:"GET",url:p,data:o,success:function(s){n._updateForm(s);r(false);n.deferred.done(q);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(s)},error:function(s){n.deferred.done(q);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(s)}})},_updateForm:function(n){var o=this;this.tree.matchModel(n,function(q,u){var p=o.input_list[q];if(p&&p.options){if(!_.isEqual(p.options,u.options)){p.options=u.options;var v=o.field_list[q];if(v.update){var t=[];if((["data","data_collection","drill_down"]).indexOf(p.type)!=-1){t=p.options}else{for(var s in u.options){var r=u.options[s];if(r.length>2){t.push({label:r[0],value:r[1]})}}}v.update(t);v.trigger("change");console.debug("Updating options for "+q)}}}})},_buildForm:function(){var w=this;this.field_list={};this.input_list={};this.element_list={};this.tree=new c(this);this.job_handler=new g(this);this.content=new f(this);var x=this.options;this.message=new m.Message();var n="This tool requires ";for(var r in x.requirements){var v=x.requirements[r];n+=v.name;if(v.version){n+=" (Version "+v.version+")"}if(r<x.requirements.length-2){n+=", "}if(r==x.requirements.length-2){n+=" and "}}n+=".";var t=new m.ButtonIcon({icon:"fa-info-circle",tooltip:"Click to show/hide the tool requirements.",onclick:function(){if(!this.visible){this.visible=true;w.message.update({persistent:true,message:n,status:"warning"})}else{this.visible=false;w.message.update({message:""})}}});if(!x.requirements||x.requirements.length==0){t.$el.hide()}var p=new m.ButtonMenu({icon:"fa-cubes",title:"Versions",tooltip:"Click to view available versions."});if(x.versions&&x.versions.length>1){for(var r in x.versions){p.addMenu({title:x.versions[r],icon:"fa-cube",onclick:function(){x.id=x.id.replace(x.version,this.title);x.version=this.title;w.deferred.reset();w.deferred.execute(function(){w._buildModel()})}})}}else{p.$el.hide()}var s=new m.ButtonMenu({icon:"fa-gear",tooltip:"Click to view a list of options."});if(x.biostar_url){s.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(x.biostar_url+"/p/new/post/")}});s.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(x.biostar_url+"/t/"+x.id+"/")}})}s.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+galaxy_config.root+"root?tool_id="+x.id)}});if(this.is_admin){s.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+x.id+"/download"}})}this.section=new l.View(w,{inputs:x.inputs,cls:"ui-table-plain"});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new h.View({icon:"fa-wrench",title:"<b>"+x.name+"</b> "+x.description+" (Version "+x.version+")",cls:"ui-portlet-slim",operations:{requirements:t,menu:s,versions:p},buttons:{execute:new m.Button({icon:"fa-check",tooltip:"Execute: "+x.name,title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){w.job_handler.submit()}})}});this.$el.empty();this.$el.append(this.portlet.$el);if(x.help!=""){this.$el.append(d.help(x.help))}if(x.citations){var u=$("<div/>");var o=new k.ToolCitationCollection();o.tool_id=x.id;var q=new a.CitationListView({el:u,collection:o});q.render();o.fetch();this.$el.append(u)}this.portlet.append(this.message.$el);this.portlet.append(this.section.$el);this.rebuild();if(x.message){this.message.update({persistent:true,status:"warning",message:x.message})}}});return{View:b}}); \ No newline at end of file +define(["utils/utils","utils/deferred","mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-content","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(i,j,h,m,k,a,e,d,f,l,c,g){var b=Backbone.View.extend({container:"body",initialize:function(o){console.debug(o);var n=this;var p=parent.Galaxy;if(p&&p.modal){this.modal=p.modal}else{this.modal=new m.Modal.View()}if(p&&p.currUser){this.is_admin=p.currUser.get("is_admin")}else{this.is_admin=false}this.options=o;this.deferred=new j();this.setElement("<div/>");$(this.container).append(this.$el);this._buildForm()},reciept:function(n){$(this.container).empty();$(this.container).append(n)},reset:function(){for(var n in this.element_list){this.element_list[n].reset()}},rebuild:function(){this.tree.refresh();console.debug("tools-form::rebuild() - Rebuilding data structures.")},refresh:function(){if(this.is_dynamic){var n=this;this.deferred.reset();this.deferred.execute(function(){n._updateModel()})}},_buildModel:function(){var n=this;var o=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){o+="job_id="+this.options.job_id}else{if(this.options.dataset_id){o+="dataset_id="+this.options.dataset_id}else{o+="tool_version="+this.options.version+"&";var q=top.location.href;var r=q.indexOf("?");if(q.indexOf("tool_id=")!=-1&&r!==-1){o+=q.slice(r+1)}}}var p=this.deferred.register();i.request({type:"GET",url:o,success:function(s){n.options=s;n._buildForm();n.message.update({status:"success",message:"Now you are using using '"+n.options.name+"' version "+n.options.version+".",persistent:false});n.deferred.done(p);console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(s)},error:function(s){n.deferred.done(p);console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(s);var t=s.error||"Uncaught error.";n.modal.show({title:"Tool cannot be executed",body:t,buttons:{Close:function(){n.modal.hide()}}})}})},_updateModel:function(){var n=this;var o=this.tree.finalize({data:function(s){if(s.values.length>0&&s.values[0]&&s.values[0].src==="hda"){return n.content.get({id:s.values[0].id,src:"hda"}).id_uncoded}return null}});console.debug("tools-form::_refreshForm() - Refreshing states.");console.debug(o);function r(v){for(var t in n.input_list){var u=n.field_list[t];var s=n.input_list[t];if(s.is_dynamic&&u.wait&&u.unwait){if(v){u.wait()}else{u.unwait()}}}}r(true);var q=this.deferred.register();var p=galaxy_config.root+"api/tools/"+this.options.id+"/build?tool_version="+this.options.version;i.request({type:"GET",url:p,data:o,success:function(s){n._updateForm(s);r(false);n.deferred.done(q);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(s)},error:function(s){n.deferred.done(q);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(s)}})},_updateForm:function(n){var o=this;this.tree.matchModel(n,function(q,u){var p=o.input_list[q];if(p&&p.options){if(!_.isEqual(p.options,u.options)){p.options=u.options;var v=o.field_list[q];if(v.update){var t=[];if((["data","data_collection","drill_down"]).indexOf(p.type)!=-1){t=p.options}else{for(var s in u.options){var r=u.options[s];if(r.length>2){t.push({label:r[0],value:r[1]})}}}v.update(t);v.trigger("change");console.debug("Updating options for "+q)}}}})},_buildForm:function(){var w=this;this.field_list={};this.input_list={};this.element_list={};this.tree=new c(this);this.job_handler=new g(this);this.content=new f(this);var x=this.options;this.message=new m.Message();var n="This tool requires ";for(var r in x.requirements){var v=x.requirements[r];n+=v.name;if(v.version){n+=" (Version "+v.version+")"}if(r<x.requirements.length-2){n+=", "}if(r==x.requirements.length-2){n+=" and "}}n+=".";var t=new m.ButtonIcon({icon:"fa-info-circle",tooltip:"Click to show/hide the tool requirements.",onclick:function(){if(!this.visible){this.visible=true;w.message.update({persistent:true,message:n,status:"warning"})}else{this.visible=false;w.message.update({message:""})}}});if(!x.requirements||x.requirements.length==0){t.$el.hide()}var p=new m.ButtonMenu({icon:"fa-cubes",title:"Versions",tooltip:"Click to view available versions."});if(x.versions&&x.versions.length>1){for(var r in x.versions){p.addMenu({title:x.versions[r],icon:"fa-cube",onclick:function(){x.id=x.id.replace(x.version,this.title);x.version=this.title;w.deferred.reset();w.deferred.execute(function(){w._buildModel()})}})}}else{p.$el.hide()}var s=new m.ButtonMenu({icon:"fa-gear",tooltip:"Click to view a list of options."});if(x.biostar_url){s.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(x.biostar_url+"/p/new/post/")}});s.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(x.biostar_url+"/t/"+x.id+"/")}})}s.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+galaxy_config.root+"root?tool_id="+x.id)}});if(this.is_admin){s.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+x.id+"/download"}})}this.section=new l.View(w,{inputs:x.inputs,cls:"ui-table-plain"});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new h.View({icon:"fa-wrench",title:"<b>"+x.name+"</b> "+x.description+" (Version "+x.version+")",cls:"ui-portlet-slim",operations:{requirements:t,menu:s,versions:p},buttons:{execute:new m.Button({icon:"fa-check",tooltip:"Execute: "+x.name,title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){w.job_handler.submit()}})}});this.$el.empty();this.$el.append(this.portlet.$el);if(x.help!=""){this.$el.append(d.help(x.help))}if(x.citations){var u=$("<div/>");var o=new k.ToolCitationCollection();o.tool_id=x.id;var q=new a.CitationListView({el:u,collection:o});q.render();o.fetch();this.$el.append(u)}this.portlet.append(this.message.$el,true);this.portlet.append(this.section.$el);this.rebuild();if(x.message){this.message.update({persistent:true,status:"warning",message:x.message})}}});return{View:b}}); \ No newline at end of file diff -r 9b4153f9ccd58b46e8d98796a675e17ce7f3a1c5 -r dae2fd928357c019b33db953fd840eab8512a1a3 static/scripts/packed/mvc/ui/ui-portlet.js --- a/static/scripts/packed/mvc/ui/ui-portlet.js +++ b/static/scripts/packed/mvc/ui/ui-portlet.js @@ -1,1 +1,1 @@ -define(["utils/utils"],function(a){var b=Backbone.View.extend({visible:false,optionsDefault:{title:"",icon:"",buttons:null,body:null,scrollable:true,nopadding:false,operations:null,placement:"bottom",cls:"ui-portlet",operations_flt:"right"},$title:null,$content:null,$buttons:null,$operations:null,initialize:function(e){this.options=a.merge(e,this.optionsDefault);this.setElement(this._template(this.options));this.$content=this.$el.find("#content");this.$title=this.$el.find("#portlet-title-text");var d=this.$el.find("#portlet-content");if(!this.options.scrollable){if(this.options.title){d.addClass("no-scroll")}else{d.addClass("no-scroll-no-title")}}else{d.addClass("scroll")}if(this.options.nopadding){d.css("padding","0px");this.$content.css("padding","0px")}this.$buttons=$(this.el).find("#buttons");if(this.options.buttons){var c=this;$.each(this.options.buttons,function(f,g){g.$el.prop("id",f);c.$buttons.append(g.$el)})}else{this.$buttons.remove()}this.$operations=$(this.el).find("#operations");if(this.options.operations){var c=this;$.each(this.options.operations,function(f,g){g.$el.prop("id",f);c.$operations.append(g.$el)})}if(this.options.body){this.append(this.options.body)}},append:function(c){this.$content.append(a.wrap(c))},content:function(){return this.$content},show:function(){this.$el.fadeIn("fast");this.visible=true},hide:function(){this.$el.fadeOut("fast");this.visible=false},enableButton:function(c){this.$buttons.find("#"+c).prop("disabled",false)},disableButton:function(c){this.$buttons.find("#"+c).prop("disabled",true)},hideOperation:function(c){this.$operations.find("#"+c).hide()},showOperation:function(c){this.$operations.find("#"+c).show()},setOperation:function(e,d){var c=this.$operations.find("#"+e);c.off("click");c.on("click",d)},title:function(d){var c=this.$title;if(d){c.html(d)}return c.html()},_template:function(d){var c='<div id="'+d.id+'" class="'+d.cls+'">';if(d.title){c+='<div id="portlet-header" class="portlet-header"><div id="operations" style="float: '+d.operations_flt+';"></div><div class="portlet-title">';if(d.icon){c+='<i class="icon fa '+d.icon+'"> </i>'}c+='<span id="portlet-title-text" class="portlet-title-text">'+d.title+"</span></div></div>"}c+='<div id="portlet-content" class="portlet-content">';if(d.placement=="top"){c+='<div id="buttons" class="buttons"></div>'}c+='<div id="content" class="content"></div>';if(d.placement=="bottom"){c+='<div id="buttons" class="buttons"></div>'}c+="</div></div>";return c}});return{View:b}}); \ No newline at end of file +define(["utils/utils"],function(a){var b=Backbone.View.extend({visible:false,optionsDefault:{title:"",icon:"",buttons:null,body:null,scrollable:true,nopadding:false,operations:null,placement:"bottom",cls:"ui-portlet",operations_flt:"right"},$title:null,$content:null,$buttons:null,$operations:null,initialize:function(e){this.options=a.merge(e,this.optionsDefault);this.setElement(this._template(this.options));this.$content=this.$el.find("#content");this.$title=this.$el.find("#portlet-title-text");var d=this.$el.find("#portlet-content");if(!this.options.scrollable){if(this.options.title){d.addClass("no-scroll")}else{d.addClass("no-scroll-no-title")}}else{d.addClass("scroll")}if(this.options.nopadding){d.css("padding","0px");this.$content.css("padding","0px")}this.$buttons=$(this.el).find("#buttons");if(this.options.buttons){var c=this;$.each(this.options.buttons,function(f,g){g.$el.prop("id",f);c.$buttons.append(g.$el)})}else{this.$buttons.remove()}this.$operations=$(this.el).find("#operations");if(this.options.operations){var c=this;$.each(this.options.operations,function(f,g){g.$el.prop("id",f);c.$operations.append(g.$el)})}if(this.options.body){this.append(this.options.body)}},append:function(d,c){if(c){this.$content.append(d)}else{this.$content.append(a.wrap(d))}},content:function(){return this.$content},show:function(){this.$el.fadeIn("fast");this.visible=true},hide:function(){this.$el.fadeOut("fast");this.visible=false},enableButton:function(c){this.$buttons.find("#"+c).prop("disabled",false)},disableButton:function(c){this.$buttons.find("#"+c).prop("disabled",true)},hideOperation:function(c){this.$operations.find("#"+c).hide()},showOperation:function(c){this.$operations.find("#"+c).show()},setOperation:function(e,d){var c=this.$operations.find("#"+e);c.off("click");c.on("click",d)},title:function(d){var c=this.$title;if(d){c.html(d)}return c.html()},_template:function(d){var c='<div id="'+d.id+'" class="'+d.cls+'">';if(d.title){c+='<div id="portlet-header" class="portlet-header"><div id="operations" style="float: '+d.operations_flt+';"></div><div class="portlet-title">';if(d.icon){c+='<i class="icon fa '+d.icon+'"> </i>'}c+='<span id="portlet-title-text" class="portlet-title-text">'+d.title+"</span></div></div>"}c+='<div id="portlet-content" class="portlet-content">';if(d.placement=="top"){c+='<div id="buttons" class="buttons"></div>'}c+='<div id="content" class="content"></div>';if(d.placement=="bottom"){c+='<div id="buttons" class="buttons"></div>'}c+="</div></div>";return c}});return{View:b}}); \ 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