mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #2770 from guerler/revise_repeats
Revise repeat block view, remove unecessary table wrapper
This commit is contained in:
@@ -1,133 +1,96 @@
|
||||
/** This class creates a ui component which enables the dynamic creation of portlets */
|
||||
define(['utils/utils', 'mvc/ui/ui-table', 'mvc/ui/ui-portlet', 'mvc/ui/ui-misc'],
|
||||
function(Utils, Table, Portlet, Ui) {
|
||||
var View = Backbone.View.extend({
|
||||
initialize : function(options) {
|
||||
var self = this;
|
||||
this.options = Utils.merge(options, {
|
||||
title : 'Section',
|
||||
empty_text : 'Not available.',
|
||||
max : null,
|
||||
min : null
|
||||
});
|
||||
this.setElement('<div/>');
|
||||
define( [ 'utils/utils', 'mvc/ui/ui-portlet', 'mvc/ui/ui-misc' ],
|
||||
function( Utils, Portlet, Ui ) {
|
||||
var View = Backbone.View.extend({
|
||||
initialize: function( options ) {
|
||||
this.list = {};
|
||||
this.options = Utils.merge( options, {
|
||||
title : 'Repeat',
|
||||
empty_text : 'Not available.',
|
||||
max : null,
|
||||
min : null
|
||||
});
|
||||
this.button_new = new Ui.ButtonIcon({
|
||||
icon : 'fa-plus',
|
||||
title : 'Insert ' + this.options.title,
|
||||
tooltip : 'Add new ' + this.options.title + ' block',
|
||||
floating: 'clear',
|
||||
cls : 'ui-button-icon form-repeat-add',
|
||||
onclick : function() { options.onnew && options.onnew() }
|
||||
});
|
||||
this.setElement( $( '<div/>' ).append( this.$list = $( '<div/>' ) )
|
||||
.append( $( '<div/>' ).append( this.button_new.$el ) ) );
|
||||
},
|
||||
|
||||
// create button
|
||||
this.button_new = new Ui.ButtonIcon({
|
||||
icon : 'fa-plus',
|
||||
title : 'Insert ' + this.options.title_new,
|
||||
tooltip : 'Add new ' + this.options.title_new + ' block',
|
||||
floating: 'clear',
|
||||
onclick : function() {
|
||||
if (options.onnew) {
|
||||
options.onnew();
|
||||
}
|
||||
/** Number of repeat blocks */
|
||||
size: function() {
|
||||
return _.size( this.list );
|
||||
},
|
||||
|
||||
/** Add new repeat block */
|
||||
add: function( options ) {
|
||||
if ( !options.id || this.list[ options.id ] ) {
|
||||
Galaxy.emit.debug( 'form-repeat::add()', 'Duplicate or invalid repeat block id.' );
|
||||
return;
|
||||
}
|
||||
});
|
||||
var button_delete = new Ui.ButtonIcon({
|
||||
icon : 'fa-trash-o',
|
||||
tooltip : 'Delete this repeat block',
|
||||
cls : 'ui-button-icon-plain form-repeat-delete',
|
||||
onclick : function() { options.ondel && options.ondel() }
|
||||
});
|
||||
var portlet = new Portlet.View({
|
||||
id : options.id,
|
||||
title : 'placeholder',
|
||||
cls : options.cls || 'ui-portlet-repeat',
|
||||
operations : { button_delete: button_delete }
|
||||
});
|
||||
portlet.append( options.$el );
|
||||
portlet.$el.addClass( 'section-row' ).hide();
|
||||
this.list[ options.id ] = portlet;
|
||||
this.$list.append( portlet.$el.fadeIn( 'fast' ) );
|
||||
this.options.max > 0 && this.size() >= this.options.max && this.button_new.disable();
|
||||
this._refresh();
|
||||
},
|
||||
|
||||
// create table
|
||||
this.table = new Table.View({
|
||||
cls : 'ui-table-plain',
|
||||
content : ''
|
||||
});
|
||||
this.$el.append(this.table.$el);
|
||||
this.$el.append($('<div/>').append(this.button_new.$el));
|
||||
|
||||
// reset list
|
||||
this.list = {};
|
||||
this.n = 0;
|
||||
},
|
||||
|
||||
/** Number of repeat blocks */
|
||||
size: function() {
|
||||
return this.n;
|
||||
},
|
||||
|
||||
/** Add new repeat block */
|
||||
add: function(options) {
|
||||
if (!options.id || this.list[options.id]) {
|
||||
Galaxy.emit.debug('form-repeat::add()', 'Duplicate repeat block id.');
|
||||
return;
|
||||
}
|
||||
this.n++;
|
||||
var button_delete = new Ui.ButtonIcon({
|
||||
icon : 'fa-trash-o',
|
||||
tooltip : 'Delete this repeat block',
|
||||
cls : 'ui-button-icon-plain',
|
||||
onclick : function() {
|
||||
if (options.ondel) {
|
||||
options.ondel();
|
||||
}
|
||||
/** Delete repeat block */
|
||||
del: function( id ) {
|
||||
if ( !this.list[ id ] ) {
|
||||
Galaxy.emit.debug( 'form-repeat::del()', 'Invalid repeat block id.' );
|
||||
return;
|
||||
}
|
||||
});
|
||||
var portlet = new Portlet.View({
|
||||
id : options.id,
|
||||
title : 'placeholder',
|
||||
cls : options.cls || 'ui-portlet-repeat',
|
||||
operations : {
|
||||
button_delete : button_delete
|
||||
this.$list.find( '#' + id ).remove();
|
||||
delete this.list[ id ];
|
||||
this.button_new.enable();
|
||||
this._refresh();
|
||||
},
|
||||
|
||||
/** Remove all */
|
||||
delAll: function() {
|
||||
for( var id in this.list ) {
|
||||
this.del( id );
|
||||
}
|
||||
});
|
||||
portlet.append(options.$el);
|
||||
portlet.$el.addClass('section-row');
|
||||
this.list[options.id] = portlet;
|
||||
this.table.add(portlet.$el);
|
||||
this.table.append('row_' + options.id, true);
|
||||
if (this.options.max > 0 && this.n >= this.options.max) {
|
||||
this.button_new.disable();
|
||||
}
|
||||
this._refresh();
|
||||
},
|
||||
},
|
||||
|
||||
/** Delete repeat block */
|
||||
del: function(id) {
|
||||
if (!this.list[id]) {
|
||||
Galaxy.emit.debug('form-repeat::del()', 'Invalid repeat block id.');
|
||||
return;
|
||||
}
|
||||
this.n--;
|
||||
var table_row = this.table.get('row_' + id);
|
||||
table_row.remove();
|
||||
delete this.list[id];
|
||||
this.button_new.enable();
|
||||
this._refresh();
|
||||
},
|
||||
/** Hides add/del options */
|
||||
hideOptions: function() {
|
||||
this.button_new.$el.hide();
|
||||
_.each( this.list, function( portlet ) { portlet.hideOperation( 'button_delete' ) } );
|
||||
_.isEmpty( this.list ) && this.$el.append( $( '<div/>' ).addClass( 'ui-form-info' ).html( this.options.empty_text ) );
|
||||
},
|
||||
|
||||
/** Remove all */
|
||||
delAll: function() {
|
||||
for( var id in this.list ) {
|
||||
this.del( id );
|
||||
}
|
||||
},
|
||||
|
||||
/** Hides add/del options */
|
||||
hideOptions: function() {
|
||||
this.button_new.$el.hide();
|
||||
_.each( this.list, function( portlet ) {
|
||||
portlet.hideOperation('button_delete');
|
||||
});
|
||||
if( _.isEmpty( this.list ) ) {
|
||||
this.$el.append( $('<div/>').addClass( 'ui-form-info' ).html( this.options.empty_text ) );
|
||||
}
|
||||
},
|
||||
|
||||
/** Refresh view */
|
||||
_refresh: function() {
|
||||
var index = 0;
|
||||
for (var id in this.list) {
|
||||
var portlet = this.list[id];
|
||||
portlet.title(++index + ': ' + this.options.title);
|
||||
if (this.n > this.options.min) {
|
||||
portlet.showOperation('button_delete');
|
||||
} else {
|
||||
portlet.hideOperation('button_delete');
|
||||
/** Refresh view */
|
||||
_refresh: function() {
|
||||
var index = 0;
|
||||
for ( var id in this.list ) {
|
||||
var portlet = this.list[ id ];
|
||||
portlet.title( ++index + ': ' + this.options.title );
|
||||
portlet[ this.size() > this.options.min ? 'showOperation' : 'hideOperation' ]( 'button_delete' );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
View : View
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
View : View
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -86,7 +86,6 @@ function( Utils, Ui, Portlet, Repeat, InputElement, Parameters ) {
|
||||
// create repeat block element
|
||||
var repeat = new Repeat.View({
|
||||
title : input_def.title || 'Repeat',
|
||||
title_new : input_def.title || '',
|
||||
min : input_def.min,
|
||||
max : input_def.max,
|
||||
onnew : function() { create( input_def.inputs ); self.app.trigger( 'change' ); }
|
||||
@@ -105,7 +104,7 @@ function( Utils, Ui, Portlet, Repeat, InputElement, Parameters ) {
|
||||
// add parsed/minimum number of repeat blocks
|
||||
//
|
||||
var n_cache = _.size( input_def.cache );
|
||||
for ( var i = 0; i < Math.max( Math.max( n_cache, input_def.min ), input_def.default ); i++ ) {
|
||||
for ( var i = 0; i < Math.max( Math.max( n_cache, input_def.min ), input_def.default || 0 ); i++ ) {
|
||||
create( i < n_cache ? input_def.cache[ i ] : input_def.inputs );
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"form-repeat.js","sources":["../../../src/mvc/form/form-repeat.js"],"names":["define","Utils","Table","Portlet","Ui","View","Backbone","extend","initialize","options","this","merge","title","empty_text","max","min","setElement","button_new","ButtonIcon","icon","title_new","tooltip","floating","onclick","onnew","table","cls","content","$el","append","$","list","n","size","add","id","Galaxy","emit","debug","button_delete","ondel","portlet","operations","addClass","disable","_refresh","del","table_row","get","remove","enable","delAll","hideOptions","hide","_","each","hideOperation","isEmpty","html","index","showOperation"],"mappings":"AACAA,QAAQ,cAAe,kBAAmB,oBAAqB,kBACvD,SAASC,EAAOC,EAAOC,EAASC,GACxC,GAAIC,GAAOC,SAASD,KAAKE,QACrBC,WAAa,SAASC,GAElBC,KAAKD,QAAUR,EAAMU,MAAMF,GACvBG,MAAc,UACdC,WAAc,iBACdC,IAAc,KACdC,IAAc,OAElBL,KAAKM,WAAW,UAGhBN,KAAKO,WAAa,GAAIb,GAAGc,YACrBC,KAAU,UACVP,MAAU,UAAYF,KAAKD,QAAQW,UACnCC,QAAU,WAAaX,KAAKD,QAAQW,UAAY,SAChDE,SAAU,QACVC,QAAU,WACFd,EAAQe,OACRf,EAAQe,WAMpBd,KAAKe,MAAQ,GAAIvB,GAAMG,MACnBqB,IAAU,iBACVC,QAAU,KAEdjB,KAAKkB,IAAIC,OAAOnB,KAAKe,MAAMG,KAC3BlB,KAAKkB,IAAIC,OAAOC,EAAE,UAAUD,OAAOnB,KAAKO,WAAWW,MAGnDlB,KAAKqB,QACLrB,KAAKsB,EAAI,GAIbC,KAAM,WACF,MAAOvB,MAAKsB,GAIhBE,IAAK,SAASzB,GACV,IAAKA,EAAQ0B,IAAMzB,KAAKqB,KAAKtB,EAAQ0B,IAEjC,WADAC,QAAOC,KAAKC,MAAM,qBAAsB,6BAG5C5B,MAAKsB,GACL,IAAIO,GAAgB,GAAInC,GAAGc,YACvBC,KAAU,aACVE,QAAU,2BACVK,IAAU,uBACVH,QAAU,WACFd,EAAQ+B,OACR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cAAc,oBAMtC,QACInD,KAAOA"}
|
||||
{"version":3,"file":"form-repeat.js","sources":["../../../src/mvc/form/form-repeat.js"],"names":["define","Utils","Portlet","Ui","View","Backbone","extend","initialize","options","this","list","merge","title","empty_text","max","min","button_new","ButtonIcon","icon","tooltip","floating","cls","onclick","onnew","setElement","$","append","$list","$el","size","_","add","id","Galaxy","emit","debug","button_delete","ondel","portlet","operations","addClass","hide","fadeIn","disable","_refresh","del","find","remove","enable","delAll","hideOptions","each","hideOperation","isEmpty","html","index"],"mappings":"AACAA,QAAU,cAAe,oBAAqB,kBAC9C,SAAUC,EAAOC,EAASC,GACtB,GAAIC,GAAOC,SAASD,KAAKE,QACrBC,WAAY,SAAUC,GAClBC,KAAKC,QACLD,KAAKD,QAAUP,EAAMU,MAAOH,GACxBI,MAAc,SACdC,WAAc,iBACdC,IAAc,KACdC,IAAc,OAElBN,KAAKO,WAAa,GAAIb,GAAGc,YACrBC,KAAU,UACVN,MAAU,UAAYH,KAAKD,QAAQI,MACnCO,QAAU,WAAaV,KAAKD,QAAQI,MAAQ,SAC5CQ,SAAU,QACVC,IAAU,iCACVC,QAAU,WAAad,EAAQe,OAASf,EAAQe,WAEpDd,KAAKe,WAAYC,EAAG,UAAWC,OAAQjB,KAAKkB,MAAQF,EAAG,WACxBC,OAAQD,EAAG,UAAWC,OAAQjB,KAAKO,WAAWY,QAIjFC,KAAM,WACF,MAAOC,GAAED,KAAMpB,KAAKC,OAIxBqB,IAAK,SAAUvB,GACX,IAAMA,EAAQwB,IAAMvB,KAAKC,KAAMF,EAAQwB,IAEnC,WADAC,QAAOC,KAAKC,MAAO,qBAAsB,wCAG7C,IAAIC,GAAgB,GAAIjC,GAAGc,YACvBC,KAAU,aACVC,QAAU,2BACVE,IAAU,0CACVC,QAAU,WAAad,EAAQ6B,OAAS7B,EAAQ6B,WAEhDC,EAAU,GAAIpC,GAAQE,MACtB4B,GAAkBxB,EAAQwB,GAC1BpB,MAAkB,cAClBS,IAAkBb,EAAQa,KAAO,oBACjCkB,YAAoBH,cAAeA,IAEvCE,GAAQZ,OAAQlB,EAAQoB,KACxBU,EAAQV,IAAIY,SAAU,eAAgBC,OACtChC,KAAKC,KAAMF,EAAQwB,IAAOM,EAC1B7B,KAAKkB,MAAMD,OAAQY,EAAQV,IAAIc,OAAQ,SACvCjC,KAAKD,QAAQM,IAAM,GAAKL,KAAKoB,QAAUpB,KAAKD,QAAQM,KAAOL,KAAKO,WAAW2B,UAC3ElC,KAAKmC,YAITC,IAAK,SAAUb,GACX,MAAMvB,MAAKC,KAAMsB,IAIjBvB,KAAKkB,MAAMmB,KAAM,IAAMd,GAAKe,eACrBtC,MAAKC,KAAMsB,GAClBvB,KAAKO,WAAWgC,aAChBvC,MAAKmC,gBANDX,QAAOC,KAAKC,MAAO,qBAAsB,6BAUjDc,OAAQ,WACJ,IAAK,GAAIjB,KAAMvB,MAAKC,KAChBD,KAAKoC,IAAKb,IAKlBkB,YAAa,WACTzC,KAAKO,WAAWY,IAAIa,OACpBX,EAAEqB,KAAM1C,KAAKC,KAAM,SAAU4B,GAAYA,EAAQc,cAAe,mBAChEtB,EAAEuB,QAAS5C,KAAKC,OAAUD,KAAKmB,IAAIF,OAAQD,EAAG,UAAWe,SAAU,gBAAiBc,KAAM7C,KAAKD,QAAQK,cAI3G+B,SAAU,WACN,GAAIW,GAAQ,CACZ,KAAM,GAAIvB,KAAMvB,MAAKC,KAAO,CACxB,GAAI4B,GAAU7B,KAAKC,KAAMsB,EACzBM,GAAQ1B,QAAS2C,EAAQ,KAAO9C,KAAKD,QAAQI,OAC7C0B,EAAS7B,KAAKoB,OAASpB,KAAKD,QAAQO,IAAM,gBAAkB,iBAAmB,oBAK3F,QACIX,KAAOA"}
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"form-section.js","sources":["../../../src/mvc/form/form-section.js"],"names":["define","Utils","Ui","Portlet","Repeat","InputElement","Parameters","View","Backbone","extend","initialize","app","options","this","inputs","parameters","setElement","$","render","self","$el","empty","_","each","input","add","input_def","jQuery","id","uid","input_list","type","_addConditional","_addRepeat","_addSection","_addRow","test_param","sustain_conditionals","disabled","field","model","set","value","selectedCase","data","matchCase","i","cases","case_def","section_row","nonhidden","j","hidden","fadeIn","hide","trigger","sub_section","_append","addClass","create","sub_section_id","block_index","repeat","ondel","del","title","title_new","min","max","onnew","n_cache","size","cache","Math","default","sustain_repeats","hideOptions","input_element","label","name","help","portlet","cls","collapsible","collapsible_button","collapsed","expanded","append","html","on","input_id","length","expand","onchange","field_list","text_value","collapsible_value","collapsible_preview","argument","color","style","backdrop","element_list","attr"],"mappings":"AAGAA,QAAS,cAAe,iBAAkB,oBAAqB,uBAAwB,sBAAuB,4BAC9G,SAAUC,EAAOC,EAAIC,EAASC,EAAQC,EAAcC,GAChD,GAAIC,GAAOC,SAASD,KAAKE,QACrBC,WAAY,SAAUC,EAAKC,GACvBC,KAAKF,IAAMA,EACXE,KAAKC,OAASF,EAAQE,OACtBD,KAAKE,WAAa,GAAIT,GACtBO,KAAKG,WAAYC,EAAG,WACpBJ,KAAKK,UAITA,OAAQ,WACJ,GAAIC,GAAON,IACXA,MAAKO,IAAIC,QACTC,EAAEC,KAAMV,KAAKC,OAAQ,SAAUU,GAAUL,EAAKM,IAAKD,MAIvDC,IAAK,SAAUD,GACX,GAAIE,GAAYC,OAAOlB,QAAQ,KAAUe,EAGzC,QAFAE,EAAUE,GAAKJ,EAAMI,GAAK3B,EAAM4B,MAChChB,KAAKF,IAAImB,WAAYJ,EAAUE,IAAOF,EAC9BA,EAAUK,MACd,IAAK,cACDlB,KAAKmB,gBAAiBN,EACtB,MACJ,KAAK,SACDb,KAAKoB,WAAYP,EACjB,MACJ,KAAK,UACDb,KAAKqB,YAAaR,EAClB,MACJ,SACIb,KAAKsB,QAAST,KAK1BM,gBAAiB,SAAUN,GACvB,GAAIP,GAAON,IACXa,GAAUU,WAAWR,GAAKF,EAAUE,GACpCf,KAAKF,IAAIC,QAAQyB,uBAA0BX,EAAUU,WAAW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EAAUqD,KACnDrC,MAAsBhB,EAAUgB,MAChCqD,WAAsBrE,EAAUqE,WAChCC,kBAAsBtE,EAAUsE,kBAChCC,oBAAsBvE,EAAUuE,oBAChCjB,KAAsBtD,EAAUsD,KAChCkB,SAAsBxE,EAAUwE,SAChC5D,SAAsBZ,EAAUY,SAChC6D,MAAsBzE,EAAUyE,MAChCC,MAAsB1E,EAAU0E,MAChCC,SAAsB3E,EAAU2E,SAChCjD,OAAsB1B,EAAU0B,OAChCb,MAAsBA,GAI1B,OAFA1B,MAAKF,IAAI2F,aAAc1E,GAAOiD,EAC9BhE,KAAK4C,QAASoB,EAAczD,IAAKM,EAAUE,IACpCW,GAIXkB,QAAS,SAAUrC,EAAKQ,GACpBf,KAAKO,IAAImE,OAAQnE,EAAIsC,SAAU,eAAgB6C,KAAM,KAAM3E,MAInE,QACIrB,KAAMA"}
|
||||
{"version":3,"file":"form-section.js","sources":["../../../src/mvc/form/form-section.js"],"names":["define","Utils","Ui","Portlet","Repeat","InputElement","Parameters","View","Backbone","extend","initialize","app","options","this","inputs","parameters","setElement","$","render","self","$el","empty","_","each","input","add","input_def","jQuery","id","uid","input_list","type","_addConditional","_addRepeat","_addSection","_addRow","test_param","sustain_conditionals","disabled","field","model","set","value","selectedCase","data","matchCase","i","cases","case_def","section_row","nonhidden","j","hidden","fadeIn","hide","trigger","sub_section","_append","addClass","create","sub_section_id","block_index","repeat","ondel","del","title","min","max","onnew","n_cache","size","cache","Math","default","sustain_repeats","hideOptions","input_element","label","name","help","portlet","cls","collapsible","collapsible_button","collapsed","expanded","append","html","on","input_id","length","expand","onchange","field_list","text_value","collapsible_value","collapsible_preview","argument","color","style","backdrop","element_list","attr"],"mappings":"AAGAA,QAAS,cAAe,iBAAkB,oBAAqB,uBAAwB,sBAAuB,4BAC9G,SAAUC,EAAOC,EAAIC,EAASC,EAAQC,EAAcC,GAChD,GAAIC,GAAOC,SAASD,KAAKE,QACrBC,WAAY,SAAUC,EAAKC,GACvBC,KAAKF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or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,2 +1,2 @@
|
||||
define(["utils/utils","mvc/ui/ui-table","mvc/ui/ui-portlet","mvc/ui/ui-misc"],function(a,b,c,d){var e=Backbone.View.extend({initialize:function(c){this.options=a.merge(c,{title:"Section",empty_text:"Not available.",max:null,min:null}),this.setElement("<div/>"),this.button_new=new d.ButtonIcon({icon:"fa-plus",title:"Insert "+this.options.title_new,tooltip:"Add new "+this.options.title_new+" block",floating:"clear",onclick:function(){c.onnew&&c.onnew()}}),this.table=new b.View({cls:"ui-table-plain",content:""}),this.$el.append(this.table.$el),this.$el.append($("<div/>").append(this.button_new.$el)),this.list={},this.n=0},size:function(){return this.n},add:function(a){if(!a.id||this.list[a.id])return void Galaxy.emit.debug("form-repeat::add()","Duplicate repeat block id.");this.n++;var b=new d.ButtonIcon({icon:"fa-trash-o",tooltip:"Delete this repeat block",cls:"ui-button-icon-plain",onclick:function(){a.ondel&&a.ondel()}}),e=new c.View({id:a.id,title:"placeholder",cls:a.cls||"ui-portlet-repeat",operations:{button_delete:b}});e.append(a.$el),e.$el.addClass("section-row"),this.list[a.id]=e,this.table.add(e.$el),this.table.append("row_"+a.id,!0),this.options.max>0&&this.n>=this.options.max&&this.button_new.disable(),this._refresh()},del:function(a){if(!this.list[a])return void Galaxy.emit.debug("form-repeat::del()","Invalid repeat block id.");this.n--;var b=this.table.get("row_"+a);b.remove(),delete this.list[a],this.button_new.enable(),this._refresh()},delAll:function(){for(var a in this.list)this.del(a)},hideOptions:function(){this.button_new.$el.hide(),_.each(this.list,function(a){a.hideOperation("button_delete")}),_.isEmpty(this.list)&&this.$el.append($("<div/>").addClass("ui-form-info").html(this.options.empty_text))},_refresh:function(){var a=0;for(var b in this.list){var c=this.list[b];c.title(++a+": "+this.options.title),this.n>this.options.min?c.showOperation("button_delete"):c.hideOperation("button_delete")}}});return{View:e}});
|
||||
define(["utils/utils","mvc/ui/ui-portlet","mvc/ui/ui-misc"],function(a,b,c){var d=Backbone.View.extend({initialize:function(b){this.list={},this.options=a.merge(b,{title:"Repeat",empty_text:"Not available.",max:null,min:null}),this.button_new=new c.ButtonIcon({icon:"fa-plus",title:"Insert "+this.options.title,tooltip:"Add new "+this.options.title+" block",floating:"clear",cls:"ui-button-icon form-repeat-add",onclick:function(){b.onnew&&b.onnew()}}),this.setElement($("<div/>").append(this.$list=$("<div/>")).append($("<div/>").append(this.button_new.$el)))},size:function(){return _.size(this.list)},add:function(a){if(!a.id||this.list[a.id])return void Galaxy.emit.debug("form-repeat::add()","Duplicate or invalid repeat block id.");var d=new c.ButtonIcon({icon:"fa-trash-o",tooltip:"Delete this repeat block",cls:"ui-button-icon-plain form-repeat-delete",onclick:function(){a.ondel&&a.ondel()}}),e=new b.View({id:a.id,title:"placeholder",cls:a.cls||"ui-portlet-repeat",operations:{button_delete:d}});e.append(a.$el),e.$el.addClass("section-row").hide(),this.list[a.id]=e,this.$list.append(e.$el.fadeIn("fast")),this.options.max>0&&this.size()>=this.options.max&&this.button_new.disable(),this._refresh()},del:function(a){return this.list[a]?(this.$list.find("#"+a).remove(),delete this.list[a],this.button_new.enable(),void this._refresh()):void Galaxy.emit.debug("form-repeat::del()","Invalid repeat block id.")},delAll:function(){for(var a in this.list)this.del(a)},hideOptions:function(){this.button_new.$el.hide(),_.each(this.list,function(a){a.hideOperation("button_delete")}),_.isEmpty(this.list)&&this.$el.append($("<div/>").addClass("ui-form-info").html(this.options.empty_text))},_refresh:function(){var a=0;for(var b in this.list){var c=this.list[b];c.title(++a+": "+this.options.title),c[this.size()>this.options.min?"showOperation":"hideOperation"]("button_delete")}}});return{View:d}});
|
||||
//# sourceMappingURL=../../../maps/mvc/form/form-repeat.js.map
|
||||
@@ -1,2 +1,2 @@
|
||||
define(["utils/utils","mvc/ui/ui-misc","mvc/ui/ui-portlet","mvc/form/form-repeat","mvc/form/form-input","mvc/form/form-parameters"],function(a,b,c,d,e,f){var g=Backbone.View.extend({initialize:function(a,b){this.app=a,this.inputs=b.inputs,this.parameters=new f,this.setElement($("<div/>")),this.render()},render:function(){var a=this;this.$el.empty(),_.each(this.inputs,function(b){a.add(b)})},add:function(b){var c=jQuery.extend(!0,{},b);switch(c.id=b.id=a.uid(),this.app.input_list[c.id]=c,c.type){case"conditional":this._addConditional(c);break;case"repeat":this._addRepeat(c);break;case"section":this._addSection(c);break;default:this._addRow(c)}},_addConditional:function(a){var b=this;a.test_param.id=a.id,this.app.options.sustain_conditionals&&(a.test_param.disabled=!0);var c=this._addRow(a.test_param);c.model&&c.model.set("onchange",function(c){var d=b.app.data.matchCase(a,c);for(var e in a.cases){var f=a.cases[e],g=b.$("#"+a.id+"-section-"+e),h=!1;for(var i in f.inputs)if(!f.inputs[i].hidden){h=!0;break}e==d&&h?g.fadeIn("fast"):g.hide()}b.app.trigger("change")});for(var d in a.cases){var e=new g(this.app,{inputs:a.cases[d].inputs});this._append(e.$el.addClass("ui-form-section"),a.id+"-section-"+d)}c.trigger("change")},_addRepeat:function(a){function b(b){var d=a.id+"-section-"+f++,e=new g(c.app,{inputs:b});h.add({id:d,$el:e.$el,ondel:function(){h.del(d),c.app.trigger("change")}})}for(var c=this,f=0,h=new d.View({title:a.title||"Repeat",title_new:a.title||"",min:a.min,max:a.max,onnew:function(){b(a.inputs),c.app.trigger("change")}}),i=_.size(a.cache),j=0;j<Math.max(Math.max(i,a.min),a.default);j++)b(i>j?a.cache[j]:a.inputs);this.app.options.sustain_repeats&&h.hideOptions();var k=new e(this.app,{label:a.title||a.name,help:a.help,field:h});this._append(k.$el,a.id)},_addSection:function(a){var b=new c.View({title:a.title||a.name,cls:"ui-portlet-section",collapsible:!0,collapsible_button:!0,collapsed:!a.expanded});b.append(new g(this.app,{inputs:a.inputs}).$el),b.append($("<div/>").addClass("ui-form-info").html(a.help)),this.app.on("expand",function(a){b.$("#"+a).length>0&&b.expand()}),this._append(b.$el,a.id)},_addRow:function(a){var b=this,c=a.id;a.onchange=function(){b.app.trigger("change",c)};var d=this.parameters.create(a);this.app.field_list[c]=d;var f=new e(this.app,{name:a.name,label:a.label||a.name,value:a.value,text_value:a.text_value,collapsible_value:a.collapsible_value,collapsible_preview:a.collapsible_preview,help:a.help,argument:a.argument,disabled:a.disabled,color:a.color,style:a.style,backdrop:a.backdrop,hidden:a.hidden,field:d});return this.app.element_list[c]=f,this._append(f.$el,a.id),d},_append:function(a,b){this.$el.append(a.addClass("section-row").attr("id",b))}});return{View:g}});
|
||||
define(["utils/utils","mvc/ui/ui-misc","mvc/ui/ui-portlet","mvc/form/form-repeat","mvc/form/form-input","mvc/form/form-parameters"],function(a,b,c,d,e,f){var g=Backbone.View.extend({initialize:function(a,b){this.app=a,this.inputs=b.inputs,this.parameters=new f,this.setElement($("<div/>")),this.render()},render:function(){var a=this;this.$el.empty(),_.each(this.inputs,function(b){a.add(b)})},add:function(b){var c=jQuery.extend(!0,{},b);switch(c.id=b.id=a.uid(),this.app.input_list[c.id]=c,c.type){case"conditional":this._addConditional(c);break;case"repeat":this._addRepeat(c);break;case"section":this._addSection(c);break;default:this._addRow(c)}},_addConditional:function(a){var b=this;a.test_param.id=a.id,this.app.options.sustain_conditionals&&(a.test_param.disabled=!0);var c=this._addRow(a.test_param);c.model&&c.model.set("onchange",function(c){var d=b.app.data.matchCase(a,c);for(var e in a.cases){var f=a.cases[e],g=b.$("#"+a.id+"-section-"+e),h=!1;for(var i in f.inputs)if(!f.inputs[i].hidden){h=!0;break}e==d&&h?g.fadeIn("fast"):g.hide()}b.app.trigger("change")});for(var d in a.cases){var e=new g(this.app,{inputs:a.cases[d].inputs});this._append(e.$el.addClass("ui-form-section"),a.id+"-section-"+d)}c.trigger("change")},_addRepeat:function(a){function b(b){var d=a.id+"-section-"+f++,e=new g(c.app,{inputs:b});h.add({id:d,$el:e.$el,ondel:function(){h.del(d),c.app.trigger("change")}})}for(var c=this,f=0,h=new d.View({title:a.title||"Repeat",min:a.min,max:a.max,onnew:function(){b(a.inputs),c.app.trigger("change")}}),i=_.size(a.cache),j=0;j<Math.max(Math.max(i,a.min),a.default||0);j++)b(i>j?a.cache[j]:a.inputs);this.app.options.sustain_repeats&&h.hideOptions();var k=new e(this.app,{label:a.title||a.name,help:a.help,field:h});this._append(k.$el,a.id)},_addSection:function(a){var b=new c.View({title:a.title||a.name,cls:"ui-portlet-section",collapsible:!0,collapsible_button:!0,collapsed:!a.expanded});b.append(new g(this.app,{inputs:a.inputs}).$el),b.append($("<div/>").addClass("ui-form-info").html(a.help)),this.app.on("expand",function(a){b.$("#"+a).length>0&&b.expand()}),this._append(b.$el,a.id)},_addRow:function(a){var b=this,c=a.id;a.onchange=function(){b.app.trigger("change",c)};var d=this.parameters.create(a);this.app.field_list[c]=d;var f=new e(this.app,{name:a.name,label:a.label||a.name,value:a.value,text_value:a.text_value,collapsible_value:a.collapsible_value,collapsible_preview:a.collapsible_preview,help:a.help,argument:a.argument,disabled:a.disabled,color:a.color,style:a.style,backdrop:a.backdrop,hidden:a.hidden,field:d});return this.app.element_list[c]=f,this._append(f.$el,a.id),d},_append:function(a,b){this.$el.append(a.addClass("section-row").attr("id",b))}});return{View:g}});
|
||||
//# sourceMappingURL=../../../maps/mvc/form/form-section.js.map
|
||||
@@ -1,5 +1,4 @@
|
||||
define([], function() {
|
||||
return {
|
||||
define([], function() { return {
|
||||
'api/datatypes/mapping': {
|
||||
data: '{"ext_to_class_name" : {"txt" : "Text", "data":"Data","tabular":"Tabular", "binary": "Binary", "bam": "Bam" }, "class_to_classes": { "Data": { "Data": true }, "Text": { "Text": true, "Data": true }, "Tabular": { "Tabular": true, "Text": true, "Data": true }, "Binary": { "Data": true, "Binary": true }, "Bam": { "Data": true, "Binary": true, "Bam": true }}}'
|
||||
},
|
||||
@@ -7,7 +6,6 @@ return {
|
||||
data: '["RData", "ab1", "affybatch", "txt"]'
|
||||
},
|
||||
'api/tools/test/build': {
|
||||
data: '{ "id": "test", "name": "_name", "version": "_version", "description": "_description", "display": "true", "requirements": [ { "name": "req_name_a", "version": "req_version_a" }, { "name": "req_name_b", "version": "req_version_b" } ], "inputs": [ { "name": "a", "type": "text" }, { "name": "b", "type": "conditional", "test_param": { "name": "c", "type": "select", "value": "h", "options": [ [ "d", "d", false ], [ "h", "h", false ] ] }, "cases": [ { "name": "d", "value": "d", "inputs": [ { "name": "f", "type": "text" }, { "name": "g", "type": "text" } ] }, { "name": "h", "value": "h", "inputs": [ { "name": "i", "type": "text" }, { "name": "j", "type": "text" } ] } ] }, { "name": "k", "type": "repeat", "cache": [[ { "name": "l", "type": "text" }, { "name": "m", "type": "conditional", "test_param": { "name": "n", "type": "select", "value": "o" }, "cases": [ { "name": "o", "value": "o", "inputs": [ { "name": "p", "type": "text" }, { "name": "q", "type": "text" } ] }, { "name": "r", "value": "r", "inputs": [ { "name": "s", "type": "text" }, { "name": "t", "type": "text" } ] } ] } ] ], "inputs" : [ { "name": "l", "type": "text" }, { "name": "m", "type": "conditional", "test_param": { "name": "n", "type": "select", "value": "o" }, "cases": [ { "name": "o", "value": "o", "inputs": [ { "name": "p", "type": "text" }, { "name": "q", "type": "text" } ] }, { "name": "r", "value": "r", "inputs": [ { "name": "s", "type": "text" }, { "name": "t", "type": "text" } ] } ] } ] } ] }'
|
||||
data: '{ "id": "test", "name": "_name", "version": "_version", "description": "_description", "display": "true", "requirements": [ { "name": "req_name_a", "version": "req_version_a" }, { "name": "req_name_b", "version": "req_version_b" } ], "inputs": [ { "name": "a", "type": "text" }, { "name": "b", "type": "conditional", "test_param": { "name": "c", "type": "select", "value": "h", "options": [ [ "d", "d", false ], [ "h", "h", false ] ] }, "cases": [ { "name": "d", "value": "d", "inputs": [ { "name": "f", "type": "text", "value": "f" }, { "name": "g", "type": "text", "value": "g" } ] }, { "name": "h", "value": "h", "inputs": [ { "name": "i", "type": "text", "value": "i" }, { "name": "j", "type": "text", "value": "j" } ] } ] }, { "name": "k", "min": 1, "max": 2, "type": "repeat", "cache": [[ { "name": "l", "type": "text", "value": "l"}, { "name": "m", "type": "conditional", "test_param": { "name": "n", "type": "select", "value": "r", "options": [ [ "o", "o", false ], [ "r", "r", false ] ] }, "cases": [ { "name": "o", "value": "o", "inputs": [ { "name": "p", "type": "text", "value": "p" }, { "name": "q", "type": "text", "value": "q" } ] }, { "name": "r", "value": "r", "inputs": [ { "name": "s", "type": "text", "value": "s" }, { "name": "t", "type": "text", "value": "t" } ] } ] } ] ], "inputs" : [ { "name": "l", "type": "text", "value": "l" }, { "name": "m", "type": "conditional", "test_param": { "name": "n", "type": "select", "value": "o", "options": [ [ "o", "o", false ], [ "r", "r", false ] ] }, "cases": [ { "name": "o", "value": "o", "inputs": [ { "name": "p", "type": "text", "value": "p" }, { "name": "q", "type": "text", "value": "q" } ] }, { "name": "r", "value": "r", "inputs": [ { "name": "s", "type": "text", "value": "s" }, { "name": "t", "type": "text", "value": "t" } ] } ] } ] } ] }'
|
||||
}
|
||||
}
|
||||
});
|
||||
}});
|
||||
@@ -18,18 +18,29 @@ define([ 'test-app', 'mvc/form/form-input', 'mvc/ui/ui-misc', 'mvc/form/form-dat
|
||||
ok( form.$( '.portlet-title-text' ).html() == '<b>_name</b> _description (Galaxy Version _version)', 'Title correct' );
|
||||
var tour_ids = [];
|
||||
$( '[tour_id]' ).each( function() { tour_ids.push( $( this ).attr( 'tour_id' ) ) } );
|
||||
ok( JSON.stringify( tour_ids ) == '["a","b|c","b|i","b|j"]', 'Tour ids correct' );
|
||||
ok( JSON.stringify( form.data.create() ) == '{"a":"","b|c":"h","b|i":"","b|j":""}', 'Created data correct' );
|
||||
ok( JSON.stringify( tour_ids ) == '["a","b|c","b|i","b|j","k_0|l","k_0|m|n","k_0|m|s","k_0|m|t"]', 'Tour ids correct' );
|
||||
ok( JSON.stringify( form.data.create() ) == '{"a":"","b|c":"h","b|i":"i","b|j":"j","k_0|l":"l","k_0|m|n":"r","k_0|m|s":"s","k_0|m|t":"t"}', 'Created data correct' );
|
||||
var mapped_ids = [];
|
||||
form.data.matchModel( form.options, function( input, id ) { mapped_ids.push( $( '#' + id ).attr( 'tour_id' ) ) } );
|
||||
ok( JSON.stringify( mapped_ids ) == '["a","b|c","b|i","b|j"]', 'Remapped tour ids correct' );
|
||||
ok( JSON.stringify( mapped_ids ) == '["a","b|c","b|i","b|j","k_0|l","k_0|m|n","k_0|m|s","k_0|m|t"]', 'Remapped tour ids correct' );
|
||||
this.clock.tick ( window.WAIT_FADE );
|
||||
var dropdown = form.$( '#menu > .dropdown-menu' );
|
||||
ok( dropdown.children().length == 2, 'Found two menu items' );
|
||||
dropdown.find( '.fa-info-circle' ).parent().click();
|
||||
this.clock.tick ( window.WAIT_FADE );
|
||||
ok( form.$( '.ui-message' ).html() === '<span>This tool requires req_name_a (Version req_version_a) and req_name_b (Version req_version_b). Click <a target="_blank" href="https://wiki.galaxyproject.org/Tools/Requirements">here</a> for more information.</span>', 'Check requirements message' );
|
||||
ok( form.$( '.form-repeat-delete' ).css( 'display' ) == 'none', 'Delete button disabled' );
|
||||
var $add = form.$( '.form-repeat-add' );
|
||||
ok( !$add.attr( 'disabled' ), 'Adding new repeat possible' );
|
||||
$add.click();
|
||||
this.clock.tick ( window.WAIT_FADE );
|
||||
ok( $add.attr( 'disabled' ), 'Adding new repeat has been disabled' );
|
||||
form.$( '.form-repeat-delete' ).each( function( i, d ) { ok( $( d ).css( 'display' ) == 'block', 'Delete buttons ' + i + ' enabled' ) } );
|
||||
ok( JSON.stringify( form.data.create() ) == '{"a":"","b|c":"h","b|i":"i","b|j":"j","k_0|l":"l","k_0|m|n":"r","k_0|m|s":"s","k_0|m|t":"t","k_1|l":"l","k_1|m|n":"o","k_1|m|p":"p","k_1|m|q":"q"}', 'Created data correct, after adding repeat' );
|
||||
form.$( '.form-repeat-delete:first' ).click();
|
||||
ok( form.$( '.form-repeat-delete' ).css( 'display' ) == 'none', 'Delete button disabled' );
|
||||
this.clock.tick ( window.WAIT_FADE );
|
||||
ok( JSON.stringify( form.data.create() ) == '{"a":"","b|c":"h","b|i":"i","b|j":"j","k_0|l":"l","k_0|m|n":"o","k_0|m|p":"p","k_0|m|q":"q"}', 'Created data correct, after removing first repeat' );
|
||||
});
|
||||
|
||||
test( 'data', function() {
|
||||
@@ -40,7 +51,7 @@ define([ 'test-app', 'mvc/form/form-input', 'mvc/ui/ui-misc', 'mvc/form/form-dat
|
||||
} );
|
||||
} } );
|
||||
window.fakeserver.respond();
|
||||
ok( JSON.stringify( visits ) == '[{"name":"a","node":{"name":"a","type":"text"}},{"name":"b|c","node":{"name":"c","type":"select","value":"h","options":[["d","d",false],["h","h",false]]}},{"name":"b|i","node":{"name":"i","type":"text"}},{"name":"b|j","node":{"name":"j","type":"text"}},{"name":"k_0|l","node":{"name":"l","type":"text"}},{"name":"k_0|m|n","node":{"name":"n","type":"select","value":"o"}},{"name":"k_0|m|p","node":{"name":"p","type":"text"}},{"name":"k_0|m|q","node":{"name":"q","type":"text"}}]', 'Testing value visitor' );
|
||||
ok( JSON.stringify( visits ) == '[{"name":"a","node":{"name":"a","type":"text"}},{"name":"b|c","node":{"name":"c","type":"select","value":"h","options":[["d","d",false],["h","h",false]]}},{"name":"b|i","node":{"name":"i","type":"text","value":"i"}},{"name":"b|j","node":{"name":"j","type":"text","value":"j"}},{"name":"k_0|l","node":{"name":"l","type":"text","value":"l"}},{"name":"k_0|m|n","node":{"name":"n","type":"select","value":"r","options":[["o","o",false],["r","r",false]]}},{"name":"k_0|m|s","node":{"name":"s","type":"text","value":"s"}},{"name":"k_0|m|t","node":{"name":"t","type":"text","value":"t"}}]', 'Testing value visitor' );
|
||||
});
|
||||
|
||||
test( 'input', function() {
|
||||
@@ -88,6 +99,5 @@ define([ 'test-app', 'mvc/form/form-input', 'mvc/ui/ui-misc', 'mvc/form/form-dat
|
||||
ok( input.$info.html() == '_help (_argument)', 'Correct help text with argument' );
|
||||
input.model.set( 'help', '_help (_argument)' );
|
||||
ok( input.$info.html() == '_help (_argument)', 'Correct help text with argument from help' );
|
||||
|
||||
} );
|
||||
});
|
||||
Reference in New Issue
Block a user