mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-16 15:45:04 +08:00
Use floating instead of float as member id, pack code
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -10,7 +10,7 @@ define(['mvc/tools', 'mvc/ui/ui-portlet', 'mvc/ui/ui-table', 'mvc/ui/ui-misc'],
|
||||
// create form view
|
||||
var View = Backbone.View.extend({
|
||||
// base element
|
||||
body: 'body',
|
||||
main_el: 'body',
|
||||
|
||||
// initialize
|
||||
initialize: function(options) {
|
||||
@@ -31,13 +31,13 @@ define(['mvc/tools', 'mvc/ui/ui-portlet', 'mvc/ui/ui-table', 'mvc/ui/ui-misc'],
|
||||
title: '<b>' + self.model.get('name') + '</b> ' + self.model.get('description'),
|
||||
buttons: {
|
||||
execute: new Ui.ButtonIcon({
|
||||
icon : 'fa-check',
|
||||
tooltip : 'Execute the tool',
|
||||
title : 'Execute',
|
||||
float :'clear',
|
||||
onclick : function() {
|
||||
icon : 'fa-check',
|
||||
tooltip : 'Execute the tool',
|
||||
title : 'Execute',
|
||||
floating : 'clear',
|
||||
onclick : function() {
|
||||
}
|
||||
}),
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
@@ -49,7 +49,7 @@ define(['mvc/tools', 'mvc/ui/ui-portlet', 'mvc/ui/ui-table', 'mvc/ui/ui-misc'],
|
||||
self.portlet.append(self.message.$el);
|
||||
|
||||
// append portlet
|
||||
$(self.body).append(self.portlet.$el);
|
||||
$(self.main_el).append(self.portlet.$el);
|
||||
self.setElement(self.portlet.content());
|
||||
self.portlet.append(self.table.$el);
|
||||
self.render();
|
||||
|
||||
@@ -10,7 +10,7 @@ return Backbone.View.extend({
|
||||
// same as Ui.ButtonIcon
|
||||
id : '',
|
||||
title : '',
|
||||
float : 'right',
|
||||
floating : 'right',
|
||||
icon : null,
|
||||
onclick : null,
|
||||
cls : 'icon-btn',
|
||||
@@ -150,7 +150,7 @@ return Backbone.View.extend({
|
||||
}
|
||||
|
||||
// string
|
||||
var str = '<div id="' + options.id + '" style="float: ' + options.float + '; ' + width + '" class="ui-button-icon dropdown ' + options.cls + '">';
|
||||
var str = '<div id="' + options.id + '" style="float: ' + options.floating + '; ' + width + '" class="ui-button-icon dropdown ' + options.cls + '">';
|
||||
|
||||
// title
|
||||
if (options.title) {
|
||||
|
||||
@@ -66,7 +66,7 @@ var Label = Backbone.View.extend({
|
||||
var Icon = Backbone.View.extend({
|
||||
// options
|
||||
optionsDefault: {
|
||||
float : 'right',
|
||||
floating : 'right',
|
||||
icon : '',
|
||||
tooltip : '',
|
||||
placement : 'bottom',
|
||||
@@ -99,11 +99,11 @@ var Icon = Backbone.View.extend({
|
||||
var Button = Backbone.View.extend({
|
||||
// options
|
||||
optionsDefault: {
|
||||
id : null,
|
||||
title : '',
|
||||
float : 'right',
|
||||
cls : 'btn btn-default',
|
||||
icon : ''
|
||||
id : null,
|
||||
title : '',
|
||||
floating : 'right',
|
||||
cls : 'btn btn-default',
|
||||
icon : ''
|
||||
},
|
||||
|
||||
// initialize
|
||||
@@ -123,7 +123,7 @@ var Button = Backbone.View.extend({
|
||||
|
||||
// element
|
||||
_template: function(options) {
|
||||
var str = '<button id="' + options.id + '" type="submit" style="float: ' + options.float + ';" type="button" class="ui-button ' + options.cls + '">';
|
||||
var str = '<button id="' + options.id + '" type="submit" style="float: ' + options.floating + ';" type="button" class="ui-button ' + options.cls + '">';
|
||||
if (options.icon) {
|
||||
str += '<i class="icon fa ' + options.icon + '"></i> ' ;
|
||||
}
|
||||
@@ -137,13 +137,13 @@ var Button = Backbone.View.extend({
|
||||
var ButtonIcon = Backbone.View.extend({
|
||||
// options
|
||||
optionsDefault: {
|
||||
id : null,
|
||||
title : '',
|
||||
float : 'right',
|
||||
cls : 'icon-btn',
|
||||
icon : '',
|
||||
tooltip : '',
|
||||
onclick : null
|
||||
id : null,
|
||||
title : '',
|
||||
floating : 'right',
|
||||
cls : 'icon-btn',
|
||||
icon : '',
|
||||
tooltip : '',
|
||||
onclick : null
|
||||
},
|
||||
|
||||
// initialize
|
||||
@@ -170,7 +170,7 @@ var ButtonIcon = Backbone.View.extend({
|
||||
}
|
||||
|
||||
// string
|
||||
var str = '<div id="' + options.id + '" style="float: ' + options.float + '; ' + width + '" class="ui-button-icon ' + options.cls + '">';
|
||||
var str = '<div id="' + options.id + '" style="float: ' + options.floating + '; ' + width + '" class="ui-button-icon ' + options.cls + '">';
|
||||
|
||||
// title
|
||||
if (options.title) {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
define(["mvc/tools","mvc/ui/ui-portlet","mvc/ui/ui-table","mvc/ui/ui-misc"],function(b,c,a,f){var e=Backbone.Model.extend({initialize:function(g){this.url=galaxy_config.root+"api/tools/"+g.id+"?io_details=true"}});var d=Backbone.View.extend({main_el:"body",initialize:function(h){var g=this;this.model=new e({id:h.id});this.model.fetch({success:function(){g.portlet=new c.View({icon:"fa-wrench",title:"<b>"+g.model.get("name")+"</b> "+g.model.get("description"),buttons:{execute:new f.ButtonIcon({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",floating:"clear",onclick:function(){}})}});g.table=new a.View();g.message=new f.Message();g.portlet.append(g.message.$el);$(g.main_el).append(g.portlet.$el);g.setElement(g.portlet.content());g.portlet.append(g.table.$el);g.render()}})},render:function(){var g=this.model.get("inputs");this.table.delAll();this.list=[];var h=new Backbone.Model();for(var i in g){this._add(g[i],h)}for(var i in this.list){this.list[i].trigger("change")}},_add:function(g,j){var h=this;var m=g.name;console.debug(g);var k=null;var i=g.type;switch(i){case"text":k=this.field_text(g,j);break;case"select":k=this.field_select(g,j);break;case"radiobutton":k=this.field_radio(g,j);break;case"data":k=this.field_select(g,j);break;case"textarea":k=this.field_textarea(g,j);break;default:k=new f.Input({id:"field-"+m,placeholder:g.placeholder,type:g.type,onchange:function(){j.set(m,k.value())}})}if(!j.get(m)){j.set(m,g.value)}k.value(j.get(m));this.list[m]=k;var l=$("<div/>");l.append(k.$el);if(g.info){l.append('<div class="ui-table-form-info">'+g.info+"</div>")}if(this.options.style=="bold"){this.table.add(new f.Label({title:g.title,cls:"form-label"}).$el);this.table.add(l)}else{this.table.add('<span class="ui-table-form-title">'+g.label+"</span>","25%");this.table.add(l)}this.table.append(m);if(g.hide){this.table.get(m).hide()}},field_text:function(g,h){var i=g.name;return new f.Input({id:"field-"+i,value:h.get(i),onchange:function(j){h.set(i,j)}})},field_textarea:function(g,h){var i=g.name;return new f.Textarea({id:"field-"+i,onchange:function(){h.set(i,field.value())}})},field_select:function(g,l){var h=[];for(var j in g.options){var k=g.options[j];h.push({label:k[0],value:k[1]})}var m=g.name;return new f.Select.View({id:"field-"+m,data:h,value:l.get(m),onchange:function(p){l.set(m,p);var r=_.findWhere(h,{value:p});if(r&&r.operations){var n=r.operations;for(var o in n.show){var q=n.show[o];self.table.get(q).show()}for(var o in n.hide){var q=n.hide[o];self.table.get(q).hide()}}}})},field_radio:function(g,h){var i=g.name;return new f.RadioButton({id:"field-"+i,data:g.data,value:h.get(i),onchange:function(l){h.set(i,l);var n=_.findWhere(g.data,{value:l});if(n&&n.operations){var j=n.operations;for(var k in j.show){var m=j.show[k];self.table.get(m).show()}for(var k in j.hide){var m=j.hide[k];self.table.get(m).hide()}}}})}});return{View:d}});
|
||||
@@ -0,0 +1 @@
|
||||
define(["utils/utils"],function(a){return Backbone.View.extend({optionsDefault:{id:"",title:"",floating:"right",icon:null,onclick:null,cls:"icon-btn",tooltip:"",target:"",href:"",onunload:null,visible:true,tag:""},$menu:null,initialize:function(c){this.options=a.merge(c,this.optionsDefault);this.setElement($(this._template(this.options)));var d=$(this.el).find(".root");var b=this;d.on("click",function(f){$(".tooltip").hide();f.preventDefault();if(b.options.onclick){b.options.onclick()}});if(!this.options.visible){this.hide()}d.tooltip({title:c.tooltip,placement:"bottom"})},show:function(){$(this.el).show()},hide:function(){$(this.el).hide()},addMenu:function(c){var d={title:"",target:"",href:"",onclick:null,divider:false,icon:null,cls:"button-menu btn-group"};d=a.merge(c,d);if(!this.$menu){$(this.el).append(this._templateMenu());this.$menu=$(this.el).find(".menu")}var b=$(this._templateMenuItem(d));b.on("click",function(f){f.preventDefault();if(d.onclick){d.onclick()}});this.$menu.append(b);if(d.divider){this.$menu.append($(this._templateDivider()))}},_templateMenuItem:function(c){var b='<li><a href="'+c.href+'" target="'+c.target+'">';if(c.icon){b+='<i class="fa '+c.icon+'"></i>'}b+=" "+c.title+"</a></li>";return b},_templateMenu:function(){return'<ul class="menu dropdown-menu pull-right" role="menu"></ul>'},_templateDivider:function(){return'<li class="divider"></li>'},_template:function(b){var c="";if(b.title){c="width: auto;"}var d='<div id="'+b.id+'" style="float: '+b.floating+"; "+c+'" class="ui-button-icon dropdown '+b.cls+'">';if(b.title){d+='<div class="root button dropdown-toggle" data-toggle="dropdown"><i class="icon fa '+b.icon+'"/> <span class="title">'+b.title+"</span></div>"}else{d+='<i class="icon fa '+b.icon+'"/>'}d+="</div>";return d}})});
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
define(["utils/utils"],function(a){var b=Backbone.View.extend({optionsDefault:{id:"",cls:"",empty:"No data available",visible:true,wait:false},selected:null,initialize:function(d){this.options=a.merge(d,this.optionsDefault);this.selected=this.options.value;this.setElement(this._template(this.options));this.$select=this.$el.find("#select");this.$icon=this.$el.find("#icon");var c=this;this.$select.on("change",function(){c.value(c.$select.val())});this.on("change",function(){if(c.options.onchange){c.options.onchange(c.value())}});this._refresh();if(!this.options.visible){this.hide()}if(this.options.wait){this.wait()}else{this.show()}},value:function(c){var d=this.selected;if(c!==undefined){this.selected=c;this.$select.val(c)}var e=this.selected;if(e){if(e!=d&&this.options.onchange){this.options.onchange(e)}}return e},first:function(){var c=this.$select.find("option");if(c.length>0){return c.val()}else{return undefined}},text:function(){return this.$select.find("option:selected").text()},show:function(){this.$icon.removeClass();this.$icon.addClass("fa fa-caret-down");this.$select.show();this.$el.show()},hide:function(){this.$el.hide()},wait:function(){this.$icon.removeClass();this.$icon.addClass("fa fa-spinner fa-spin");this.$select.hide()},disabled:function(){return this.$select.is(":disabled")},enable:function(){this.$select.prop("disabled",false)},disable:function(){this.$select.prop("disabled",true)},add:function(c){this.$select.append(this._templateOption(c));this._refresh()},del:function(c){this.$select.find("option[value="+c+"]").remove();this.$select.trigger("change");this._refresh()},update:function(c){this.$select.find("option").remove();for(var d in c){this.$select.append(this._templateOption(c[d]))}this._refresh()},setOnChange:function(c){this.options.onchange=c},exists:function(c){return this.$select.find("option[value="+c+"]").length>0},_refresh:function(){this.$select.find("option[value=null]").remove();var c=this.$select.find("option").length;if(c==0){this.disable();this.$select.append(this._templateOption({value:"null",label:this.options.empty}))}else{this.enable()}if(this.selected){this.$select.val(this.selected)}},_templateOption:function(c){return'<option value="'+c.value+'">'+c.label+"</option>"},_template:function(e){var d='<div id="'+e.id+'" class="ui-select"><div class="button"><i id="icon"/></div><select id="select" class="select '+e.cls+" "+e.id+'">';for(key in e.data){var f=e.data[key];var c="";if(f.value==e.value||f.value==""){c="selected"}d+='<option value="'+f.value+'" '+c+">"+f.label+"</option>"}d+="</select></div>";return d}});return{View:b}});
|
||||
@@ -0,0 +1 @@
|
||||
define(["utils/utils"],function(a){var b=Backbone.View.extend({row:null,row_count:0,optionsDefault:{content:"No content available.",onchange:null,ondblclick:null,onconfirm:null,cls:""},events:{click:"_onclick",dblclick:"_ondblclick"},initialize:function(c){this.options=a.merge(c,this.optionsDefault);var d=$(this._template(this.options));this.$thead=d.find("thead");this.$tbody=d.find("tbody");this.$tmessage=d.find("tmessage");this.setElement(d);this.row=$("<tr></tr>")},addHeader:function(c){var d=$("<th></th>");d.append(c);this.row.append(d)},appendHeader:function(){this.$thead.append(this.row);this.row=$("<tr></tr>")},add:function(c,d,f){var e=$("<td></td>");if(d){e.css("width",d)}if(f){e.css("text-align",f)}e.append(c);this.row.append(e)},append:function(c){this._commit(c)},prepend:function(c){this._commit(c,true)},get:function(c){return this.$el.find("#"+c)},del:function(d){var c=this.$tbody.find("#"+d);if(c.length>0){c.remove();this.row_count--;this._refresh()}},delAll:function(){this.$tbody.empty();this.row_count=0;this._refresh()},value:function(c){this.before=this.$tbody.find(".current").attr("id");if(c!==undefined){this.$tbody.find("tr").removeClass("current");if(c){this.$tbody.find("#"+c).addClass("current")}}var d=this.$tbody.find(".current").attr("id");if(d===undefined){return null}else{if(d!=this.before&&this.options.onchange){this.options.onchange(c)}return d}},size:function(){return this.$tbody.find("tr").length},_commit:function(d,c){this.del(d);this.row.attr("id",d);if(c){this.$tbody.prepend(this.row)}else{this.$tbody.append(this.row)}this.row=$("<tr></tr>");this.row_count++;this._refresh()},_onclick:function(f){var c=this.value();var d=$(f.target).closest("tr").attr("id");if(d!=""){if(d&&c!=d){if(this.options.onconfirm){this.options.onconfirm(d)}else{this.value(d)}}}},_ondblclick:function(d){var c=this.value();if(c&&this.options.ondblclick){this.options.ondblclick(c)}},_refresh:function(){if(this.row_count==0){this.$tmessage.show()}else{this.$tmessage.hide()}},_template:function(c){return'<div><table class="ui-table '+c.cls+'"><thead></thead><tbody style="cursor: pointer;"></tbody></table><tmessage>'+c.content+"</tmessage><div>"}});return{View:b}});
|
||||
Reference in New Issue
Block a user