commit/galaxy-central: guerler: ToolForm: Add tool requirement details
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/9b4153f9ccd5/ Changeset: 9b4153f9ccd5 User: guerler Date: 2014-12-10 08:22:19+00:00 Summary: ToolForm: Add tool requirement details Affected #: 7 files diff -r 5bdce43378bddc43988616a16b3fdb055c315d52 -r 9b4153f9ccd58b46e8d98796a675e17ce7f3a1c5 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 @@ -119,6 +119,13 @@ // build form self._buildForm(); + // notification + self.message.update({ + status : 'success', + message : 'Now you are using using \'' + self.options.name + '\' version ' + self.options.version + '.', + persistent : false + }); + // process completed self.deferred.done(process_id); @@ -282,11 +289,55 @@ // link model options var options = this.options; + // create message view + this.message = new Ui.Message(); + + // construct tool requirements message content + var requirements_message = 'This tool requires '; + for (var i in options.requirements) { + var req = options.requirements[i]; + requirements_message += req.name; + if (req.version) { + requirements_message += ' (Version ' + req.version + ')'; + } + if (i < options.requirements.length - 2) { + requirements_message += ', '; + } + if (i == options.requirements.length - 2) { + requirements_message += ' and '; + } + } + requirements_message += '.'; + + // button for version selection + var requirements_button = new Ui.ButtonIcon({ + icon : 'fa-info-circle', + tooltip : 'Click to show/hide the tool requirements.', + onclick : function() { + if (!this.visible) { + this.visible = true; + self.message.update({ + persistent : true, + message : requirements_message, + status : 'warning' + }); + } else { + this.visible = false; + self.message.update({ + message : '' + }); + } + } + }); + if (!options.requirements || options.requirements.length == 0) { + requirements_button.$el.hide(); + } + // button for version selection var versions_button = new Ui.ButtonMenu({ icon : 'fa-cubes', title : 'Versions', - tooltip : 'Click to see available versions.' + tooltip : 'Click to view available versions.' }); if (options.versions && options.versions.length > 1) { for (var i in options.versions) { @@ -311,7 +362,7 @@ // button menu var menu_button = new Ui.ButtonMenu({ icon : 'fa-gear', - tooltip : 'Click to see a list of options.' + tooltip : 'Click to view a list of options.' }); // configure button selection @@ -379,8 +430,9 @@ title : '<b>' + options.name + '</b> ' + options.description + ' (Version ' + options.version + ')', cls : 'ui-portlet-slim', operations: { - menu : menu_button, - versions : versions_button + requirements : requirements_button, + menu : menu_button, + versions : versions_button }, buttons: { execute : new Ui.Button({ @@ -417,20 +469,22 @@ } // append message - if (options.message) { - var message = new Ui.Message({ - persistent : true, - status : 'warning', - message : options.message - }); - this.portlet.append(message.$el); - } + this.portlet.append(this.message.$el); // append tool section this.portlet.append(this.section.$el); // rebuild the underlying data structure this.rebuild(); + + // show message if available in model + if (options.message) { + this.message.update({ + persistent : true, + status : 'warning', + message : options.message + }); + } } }); diff -r 5bdce43378bddc43988616a16b3fdb055c315d52 -r 9b4153f9ccd58b46e8d98796a675e17ce7f3a1c5 client/galaxy/scripts/mvc/ui/ui-misc.js --- a/client/galaxy/scripts/mvc/ui/ui-misc.js +++ b/client/galaxy/scripts/mvc/ui/ui-misc.js @@ -278,11 +278,15 @@ this.$el.find('.alert').append(options.message); this.$el.fadeIn(); - // check if message is persistent + // clear previous timeouts + if (this.timeout) { + window.clearTimeout(this.timeout); + } + + // set timeout if message is not persistent if (!options.persistent) { - // set timer var self = this; - window.setTimeout(function() { + this.timeout = window.setTimeout(function() { if (self.$el.is(':visible')) { self.$el.fadeOut(); } else { diff -r 5bdce43378bddc43988616a16b3fdb055c315d52 -r 9b4153f9ccd58b46e8d98796a675e17ce7f3a1c5 lib/galaxy/webapps/galaxy/api/tools.py --- a/lib/galaxy/webapps/galaxy/api/tools.py +++ b/lib/galaxy/webapps/galaxy/api/tools.py @@ -741,13 +741,23 @@ for t in tools: tool_versions.append(t.version) + ## add information with underlying requirements and their versions + tool_requirements = [] + if tool.requirements: + for requirement in tool.requirements: + tool_requirements.append({ + 'name' : requirement.name, + 'version' : requirement.version + }) + # add additional properties tool_model.update({ 'help' : tool_help, 'citations' : tool_citations, 'biostar_url' : trans.app.config.biostar_url, 'message' : tool_message, - 'versions' : tool_versions + 'versions' : tool_versions, + 'requirements' : tool_requirements }) # check for errors diff -r 5bdce43378bddc43988616a16b3fdb055c315d52 -r 9b4153f9ccd58b46e8d98796a675e17ce7f3a1c5 static/scripts/mvc/tools/tools-form.js --- a/static/scripts/mvc/tools/tools-form.js +++ b/static/scripts/mvc/tools/tools-form.js @@ -119,6 +119,13 @@ // build form self._buildForm(); + // notification + self.message.update({ + status : 'success', + message : 'Now you are using using \'' + self.options.name + '\' version ' + self.options.version + '.', + persistent : false + }); + // process completed self.deferred.done(process_id); @@ -282,11 +289,55 @@ // link model options var options = this.options; + // create message view + this.message = new Ui.Message(); + + // construct tool requirements message content + var requirements_message = 'This tool requires '; + for (var i in options.requirements) { + var req = options.requirements[i]; + requirements_message += req.name; + if (req.version) { + requirements_message += ' (Version ' + req.version + ')'; + } + if (i < options.requirements.length - 2) { + requirements_message += ', '; + } + if (i == options.requirements.length - 2) { + requirements_message += ' and '; + } + } + requirements_message += '.'; + + // button for version selection + var requirements_button = new Ui.ButtonIcon({ + icon : 'fa-info-circle', + tooltip : 'Click to show/hide the tool requirements.', + onclick : function() { + if (!this.visible) { + this.visible = true; + self.message.update({ + persistent : true, + message : requirements_message, + status : 'warning' + }); + } else { + this.visible = false; + self.message.update({ + message : '' + }); + } + } + }); + if (!options.requirements || options.requirements.length == 0) { + requirements_button.$el.hide(); + } + // button for version selection var versions_button = new Ui.ButtonMenu({ icon : 'fa-cubes', title : 'Versions', - tooltip : 'Click to see available versions.' + tooltip : 'Click to view available versions.' }); if (options.versions && options.versions.length > 1) { for (var i in options.versions) { @@ -311,7 +362,7 @@ // button menu var menu_button = new Ui.ButtonMenu({ icon : 'fa-gear', - tooltip : 'Click to see a list of options.' + tooltip : 'Click to view a list of options.' }); // configure button selection @@ -379,8 +430,9 @@ title : '<b>' + options.name + '</b> ' + options.description + ' (Version ' + options.version + ')', cls : 'ui-portlet-slim', operations: { - menu : menu_button, - versions : versions_button + requirements : requirements_button, + menu : menu_button, + versions : versions_button }, buttons: { execute : new Ui.Button({ @@ -417,20 +469,22 @@ } // append message - if (options.message) { - var message = new Ui.Message({ - persistent : true, - status : 'warning', - message : options.message - }); - this.portlet.append(message.$el); - } + this.portlet.append(this.message.$el); // append tool section this.portlet.append(this.section.$el); // rebuild the underlying data structure this.rebuild(); + + // show message if available in model + if (options.message) { + this.message.update({ + persistent : true, + status : 'warning', + message : options.message + }); + } } }); diff -r 5bdce43378bddc43988616a16b3fdb055c315d52 -r 9b4153f9ccd58b46e8d98796a675e17ce7f3a1c5 static/scripts/mvc/ui/ui-misc.js --- a/static/scripts/mvc/ui/ui-misc.js +++ b/static/scripts/mvc/ui/ui-misc.js @@ -278,11 +278,15 @@ this.$el.find('.alert').append(options.message); this.$el.fadeIn(); - // check if message is persistent + // clear previous timeouts + if (this.timeout) { + window.clearTimeout(this.timeout); + } + + // set timeout if message is not persistent if (!options.persistent) { - // set timer var self = this; - window.setTimeout(function() { + this.timeout = window.setTimeout(function() { if (self.$el.is(':visible')) { self.$el.fadeOut(); } else { diff -r 5bdce43378bddc43988616a16b3fdb055c315d52 -r 9b4153f9ccd58b46e8d98796a675e17ce7f3a1c5 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.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 t=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 v=this.options;var o=new m.ButtonMenu({icon:"fa-cubes",title:"Versions",tooltip:"Click to see available versions."});if(v.versions&&v.versions.length>1){for(var q in v.versions){o.addMenu({title:v.versions[q],icon:"fa-cube",onclick:function(){v.id=v.id.replace(v.version,this.title);v.version=this.title;t.deferred.reset();t.deferred.execute(function(){t._buildModel()})}})}}else{o.$el.hide()}var r=new m.ButtonMenu({icon:"fa-gear",tooltip:"Click to see a list of options."});if(v.biostar_url){r.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(v.biostar_url+"/p/new/post/")}});r.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(v.biostar_url+"/t/"+v.id+"/")}})}r.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="+v.id)}});if(this.is_admin){r.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+v.id+"/download"}})}this.section=new l.View(t,{inputs:v.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>"+v.name+"</b> "+v.description+" (Version "+v.version+")",cls:"ui-portlet-slim",operations:{menu:r,versions:o},buttons:{execute:new m.Button({icon:"fa-check",tooltip:"Execute: "+v.name,title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){t.job_handler.submit()}})}});this.$el.empty();this.$el.append(this.portlet.$el);if(v.help!=""){this.$el.append(d.help(v.help))}if(v.citations){var s=$("<div/>");var n=new k.ToolCitationCollection();n.tool_id=v.id;var p=new a.CitationListView({el:s,collection:n});p.render();n.fetch();this.$el.append(s)}if(v.message){var u=new m.Message({persistent:true,status:"warning",message:v.message});this.portlet.append(u.$el)}this.portlet.append(this.section.$el);this.rebuild()}});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);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 5bdce43378bddc43988616a16b3fdb055c315d52 -r 9b4153f9ccd58b46e8d98796a675e17ce7f3a1c5 static/scripts/packed/mvc/ui/ui-misc.js --- a/static/scripts/packed/mvc/ui/ui-misc.js +++ b/static/scripts/packed/mvc/ui/ui-misc.js @@ -1,1 +1,1 @@ -define(["utils/utils","mvc/ui/ui-select-default","mvc/ui/ui-slider","mvc/ui/ui-options","mvc/ui/ui-drilldown","mvc/ui/ui-button-menu","mvc/ui/ui-modal"],function(k,b,e,o,l,q,m){var d=Backbone.View.extend({optionsDefault:{url:"",cls:""},initialize:function(r){this.options=k.merge(r,this.optionsDefault);this.setElement(this._template(this.options))},_template:function(r){return'<img class="ui-image '+r.cls+'" src="'+r.url+'"/>'}});var j=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(r){this.options=k.merge(r,this.optionsDefault);this.setElement(this._template(this.options))},title:function(r){this.$el.html(r)},_template:function(r){return'<label class="ui-label '+r.cls+'">'+r.title+"</label>"},value:function(){return options.title}});var c=Backbone.View.extend({optionsDefault:{floating:"right",icon:"",tooltip:"",placement:"bottom",title:"",cls:""},initialize:function(r){this.options=k.merge(r,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).tooltip({title:r.tooltip,placement:"bottom"})},_template:function(r){return'<div><span class="fa '+r.icon+'" class="ui-icon"/> '+r.title+"</div>"}});var g=Backbone.View.extend({optionsDefault:{id:null,title:"",floating:"right",cls:"ui-button btn btn-default",icon:""},initialize:function(r){this.options=k.merge(r,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).on("click",function(){$(".tooltip").hide();if(r.onclick){r.onclick()}});$(this.el).tooltip({title:r.tooltip,placement:"bottom"})},_template:function(r){var s='<button id="'+r.id+'" type="submit" style="float: '+r.floating+';" type="button" class="'+r.cls+'">';if(r.icon){s+='<i class="icon fa '+r.icon+'"></i> '}s+=r.title+"</button>";return s}});var h=Backbone.View.extend({optionsDefault:{id:null,title:"",floating:"right",cls:"ui-button-icon",icon:"",tooltip:"",onclick:null},initialize:function(s){this.options=k.merge(s,this.optionsDefault);this.setElement(this._template(this.options));this.$button=this.$el.find(".button");var r=this;$(this.el).on("click",function(){$(".tooltip").hide();if(s.onclick&&!r.disabled){s.onclick()}});$(this.el).tooltip({title:s.tooltip,placement:"bottom"})},disable:function(){this.$button.addClass("disabled");this.disabled=true},enable:function(){this.$button.removeClass("disabled");this.disabled=false},_template:function(r){var s="";if(r.title){s="width: auto;"}var t='<div id="'+r.id+'" style="float: '+r.floating+"; "+s+'" class="'+r.cls+'">';if(r.title){t+='<div class="button"><i class="icon fa '+r.icon+'"/> <span class="title">'+r.title+"</span></div>"}else{t+='<i class="icon fa '+r.icon+'"/>'}t+="</div>";return t}});var f=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(r){this.options=k.merge(r,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).on("click",r.onclick)},_template:function(r){return'<div><a href="javascript:void(0)" class="ui-anchor '+r.cls+'">'+r.title+"</a></div>"}});var n=Backbone.View.extend({optionsDefault:{message:null,status:"info",persistent:false},initialize:function(r){this.options=k.merge(r,this.optionsDefault);this.setElement("<div></div>");if(this.options.message){this.update(this.options)}},update:function(s){this.options=k.merge(s,this.optionsDefault);if(s.message!=""){this.$el.html(this._template(this.options));this.$el.find(".alert").append(s.message);this.$el.fadeIn();if(!s.persistent){var r=this;window.setTimeout(function(){if(r.$el.is(":visible")){r.$el.fadeOut()}else{r.$el.hide()}},3000)}}else{this.$el.fadeOut()}},_template:function(r){return'<div class="ui-message alert alert-'+r.status+'"/>'}});var a=Backbone.View.extend({optionsDefault:{onclick:null,searchword:""},initialize:function(s){this.options=k.merge(s,this.optionsDefault);this.setElement(this._template(this.options));var r=this;if(this.options.onclick){this.$el.on("submit",function(u){var t=r.$el.find("#search");r.options.onclick(t.val())})}},_template:function(r){return'<div class="ui-search"><form onsubmit="return false;"><input id="search" class="form-control input-sm" type="text" name="search" placeholder="Search..." value="'+r.searchword+'"><button type="submit" class="btn search-btn"><i class="fa fa-search"></i></button></form></div>'}});var i=Backbone.View.extend({optionsDefault:{type:"text",placeholder:"",disabled:false,visible:true,cls:"",area:false},initialize:function(s){this.options=k.merge(s,this.optionsDefault);this.setElement(this._template(this.options));if(this.options.value!==undefined){this.value(this.options.value)}if(this.options.disabled){this.$el.prop("disabled",true)}if(!this.options.visible){this.$el.hide()}var r=this;this.$el.on("input",function(){if(r.options.onchange){r.options.onchange(r.$el.val())}})},value:function(r){if(r!==undefined){this.$el.val(r)}return this.$el.val()},_template:function(r){if(r.area){return'<textarea id="'+r.id+'" class="ui-textarea '+r.cls+'"></textarea>'}else{return'<input id="'+r.id+'" type="'+r.type+'" value="'+r.value+'" placeholder="'+r.placeholder+'" class="ui-input '+r.cls+'">'}}});var p=Backbone.View.extend({initialize:function(r){this.options=r;this.setElement(this._template(this.options));if(this.options.value!==undefined){this.value(this.options.value)}},value:function(r){if(r!==undefined){this.$el.val(r)}return this.$el.val()},_template:function(r){return'<hidden id="'+r.id+'" value="'+r.value+'"/>'}});return{Anchor:f,Button:g,ButtonIcon:h,ButtonMenu:q,Icon:c,Image:d,Input:i,Label:j,Message:n,Modal:m,RadioButton:o.RadioButton,Checkbox:o.Checkbox,Radio:o.Radio,Searchbox:a,Select:b,Hidden:p,Slider:e,Drilldown:l}}); \ No newline at end of file +define(["utils/utils","mvc/ui/ui-select-default","mvc/ui/ui-slider","mvc/ui/ui-options","mvc/ui/ui-drilldown","mvc/ui/ui-button-menu","mvc/ui/ui-modal"],function(k,b,e,o,l,q,m){var d=Backbone.View.extend({optionsDefault:{url:"",cls:""},initialize:function(r){this.options=k.merge(r,this.optionsDefault);this.setElement(this._template(this.options))},_template:function(r){return'<img class="ui-image '+r.cls+'" src="'+r.url+'"/>'}});var j=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(r){this.options=k.merge(r,this.optionsDefault);this.setElement(this._template(this.options))},title:function(r){this.$el.html(r)},_template:function(r){return'<label class="ui-label '+r.cls+'">'+r.title+"</label>"},value:function(){return options.title}});var c=Backbone.View.extend({optionsDefault:{floating:"right",icon:"",tooltip:"",placement:"bottom",title:"",cls:""},initialize:function(r){this.options=k.merge(r,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).tooltip({title:r.tooltip,placement:"bottom"})},_template:function(r){return'<div><span class="fa '+r.icon+'" class="ui-icon"/> '+r.title+"</div>"}});var g=Backbone.View.extend({optionsDefault:{id:null,title:"",floating:"right",cls:"ui-button btn btn-default",icon:""},initialize:function(r){this.options=k.merge(r,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).on("click",function(){$(".tooltip").hide();if(r.onclick){r.onclick()}});$(this.el).tooltip({title:r.tooltip,placement:"bottom"})},_template:function(r){var s='<button id="'+r.id+'" type="submit" style="float: '+r.floating+';" type="button" class="'+r.cls+'">';if(r.icon){s+='<i class="icon fa '+r.icon+'"></i> '}s+=r.title+"</button>";return s}});var h=Backbone.View.extend({optionsDefault:{id:null,title:"",floating:"right",cls:"ui-button-icon",icon:"",tooltip:"",onclick:null},initialize:function(s){this.options=k.merge(s,this.optionsDefault);this.setElement(this._template(this.options));this.$button=this.$el.find(".button");var r=this;$(this.el).on("click",function(){$(".tooltip").hide();if(s.onclick&&!r.disabled){s.onclick()}});$(this.el).tooltip({title:s.tooltip,placement:"bottom"})},disable:function(){this.$button.addClass("disabled");this.disabled=true},enable:function(){this.$button.removeClass("disabled");this.disabled=false},_template:function(r){var s="";if(r.title){s="width: auto;"}var t='<div id="'+r.id+'" style="float: '+r.floating+"; "+s+'" class="'+r.cls+'">';if(r.title){t+='<div class="button"><i class="icon fa '+r.icon+'"/> <span class="title">'+r.title+"</span></div>"}else{t+='<i class="icon fa '+r.icon+'"/>'}t+="</div>";return t}});var f=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(r){this.options=k.merge(r,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).on("click",r.onclick)},_template:function(r){return'<div><a href="javascript:void(0)" class="ui-anchor '+r.cls+'">'+r.title+"</a></div>"}});var n=Backbone.View.extend({optionsDefault:{message:null,status:"info",persistent:false},initialize:function(r){this.options=k.merge(r,this.optionsDefault);this.setElement("<div></div>");if(this.options.message){this.update(this.options)}},update:function(s){this.options=k.merge(s,this.optionsDefault);if(s.message!=""){this.$el.html(this._template(this.options));this.$el.find(".alert").append(s.message);this.$el.fadeIn();if(this.timeout){window.clearTimeout(this.timeout)}if(!s.persistent){var r=this;this.timeout=window.setTimeout(function(){if(r.$el.is(":visible")){r.$el.fadeOut()}else{r.$el.hide()}},3000)}}else{this.$el.fadeOut()}},_template:function(r){return'<div class="ui-message alert alert-'+r.status+'"/>'}});var a=Backbone.View.extend({optionsDefault:{onclick:null,searchword:""},initialize:function(s){this.options=k.merge(s,this.optionsDefault);this.setElement(this._template(this.options));var r=this;if(this.options.onclick){this.$el.on("submit",function(u){var t=r.$el.find("#search");r.options.onclick(t.val())})}},_template:function(r){return'<div class="ui-search"><form onsubmit="return false;"><input id="search" class="form-control input-sm" type="text" name="search" placeholder="Search..." value="'+r.searchword+'"><button type="submit" class="btn search-btn"><i class="fa fa-search"></i></button></form></div>'}});var i=Backbone.View.extend({optionsDefault:{type:"text",placeholder:"",disabled:false,visible:true,cls:"",area:false},initialize:function(s){this.options=k.merge(s,this.optionsDefault);this.setElement(this._template(this.options));if(this.options.value!==undefined){this.value(this.options.value)}if(this.options.disabled){this.$el.prop("disabled",true)}if(!this.options.visible){this.$el.hide()}var r=this;this.$el.on("input",function(){if(r.options.onchange){r.options.onchange(r.$el.val())}})},value:function(r){if(r!==undefined){this.$el.val(r)}return this.$el.val()},_template:function(r){if(r.area){return'<textarea id="'+r.id+'" class="ui-textarea '+r.cls+'"></textarea>'}else{return'<input id="'+r.id+'" type="'+r.type+'" value="'+r.value+'" placeholder="'+r.placeholder+'" class="ui-input '+r.cls+'">'}}});var p=Backbone.View.extend({initialize:function(r){this.options=r;this.setElement(this._template(this.options));if(this.options.value!==undefined){this.value(this.options.value)}},value:function(r){if(r!==undefined){this.$el.val(r)}return this.$el.val()},_template:function(r){return'<hidden id="'+r.id+'" value="'+r.value+'"/>'}});return{Anchor:f,Button:g,ButtonIcon:h,ButtonMenu:q,Icon:c,Image:d,Input:i,Label:j,Message:n,Modal:m,RadioButton:o.RadioButton,Checkbox:o.Checkbox,Radio:o.Radio,Searchbox:a,Select:b,Hidden:p,Slider:e,Drilldown:l}}); \ 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