mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
ToolForm: Try new data selector style
This commit is contained in:
@@ -7,19 +7,19 @@ var View = Backbone.View.extend({
|
||||
// link app and options
|
||||
this.app = app;
|
||||
this.options = options;
|
||||
|
||||
|
||||
// link this
|
||||
var self = this;
|
||||
|
||||
|
||||
// add element
|
||||
this.setElement('<div/>');
|
||||
|
||||
this.setElement('<div class="ui-select-content"/>');
|
||||
|
||||
// list of select fields
|
||||
this.list = {};
|
||||
|
||||
|
||||
// radio button options
|
||||
var radio_buttons = [];
|
||||
|
||||
|
||||
// identify selector type
|
||||
if (options.type == 'data_collection') {
|
||||
this.mode = 'collection';
|
||||
@@ -30,11 +30,11 @@ var View = Backbone.View.extend({
|
||||
this.mode = 'single';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// set initial state
|
||||
this.current = this.mode;
|
||||
this.list = {};
|
||||
|
||||
|
||||
// error messages
|
||||
var extensions = Utils.textify(options.extensions);
|
||||
var hda_error = 'No dataset available.';
|
||||
@@ -45,10 +45,10 @@ var View = Backbone.View.extend({
|
||||
if (extensions) {
|
||||
hdca_error = 'No ' + extensions + ' dataset collection available.';
|
||||
}
|
||||
|
||||
|
||||
// add single dataset selector
|
||||
if (this.mode == 'single') {
|
||||
radio_buttons.push({icon: 'fa-file-o', label : 'Single dataset', value : 'single'});
|
||||
radio_buttons.push({icon: 'fa-file-o', label : '', value : 'single'});
|
||||
this.select_single = new Ui.Select.View({
|
||||
optional : options.optional,
|
||||
error_text : hda_error,
|
||||
@@ -61,10 +61,10 @@ var View = Backbone.View.extend({
|
||||
type : 'hda'
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// add multiple dataset selector
|
||||
if (this.mode == 'single' || this.mode == 'multiple') {
|
||||
radio_buttons.push({icon: 'fa-files-o', label : 'Multiple datasets', value : 'multiple' });
|
||||
radio_buttons.push({icon: 'fa-files-o', label : '', value : 'multiple' });
|
||||
this.select_multiple = new Ui.Select.View({
|
||||
multiple : true,
|
||||
error_text : hda_error,
|
||||
@@ -77,10 +77,10 @@ var View = Backbone.View.extend({
|
||||
type : 'hda'
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// add collection selector
|
||||
if (this.mode == 'single' || this.mode == 'collection') {
|
||||
radio_buttons.push({icon: 'fa-folder-o', label : 'Dataset collection', value : 'collection' });
|
||||
radio_buttons.push({icon: 'fa-folder-o', label : '', value : 'collection' });
|
||||
this.select_collection = new Ui.Select.View({
|
||||
error_text : hdca_error,
|
||||
optional : options.optional,
|
||||
@@ -93,7 +93,7 @@ var View = Backbone.View.extend({
|
||||
type : 'hdca'
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// create button
|
||||
this.button_type = new Ui.RadioButton.View({
|
||||
value : this.current,
|
||||
@@ -104,30 +104,37 @@ var View = Backbone.View.extend({
|
||||
self.trigger('change');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// add batch mode information
|
||||
this.$batch = $(ToolTemplate.batchMode());
|
||||
|
||||
|
||||
// calculate button width (should be placed into css once its supported)
|
||||
var button_width = (_.size(this.list) - 1) * 60 + 'px';
|
||||
|
||||
// add elements to dom
|
||||
if (_.size(this.list) > 1) {
|
||||
this.$el.append(this.button_type.$el.addClass('ui-margin-bottom'));
|
||||
this.$el.append(this.button_type.$el);
|
||||
}
|
||||
for (var i in this.list) {
|
||||
this.$el.append(this.list[i].field.$el);
|
||||
this.$el.append(this.list[i].field.$el.css({
|
||||
'margin-left': button_width
|
||||
}));
|
||||
}
|
||||
this.$el.append(this.$batch);
|
||||
|
||||
this.$el.append(this.$batch.css({
|
||||
'margin-left': button_width
|
||||
}));
|
||||
|
||||
// update options
|
||||
this.update(options.data);
|
||||
|
||||
|
||||
// set initial value
|
||||
if (this.options.value !== undefined) {
|
||||
this.value(this.options.value);
|
||||
}
|
||||
|
||||
|
||||
// refresh view
|
||||
this.refresh();
|
||||
|
||||
|
||||
// add change event. fires on trigger
|
||||
this.on('change', function() {
|
||||
if (options.onchange) {
|
||||
@@ -135,21 +142,21 @@ var View = Backbone.View.extend({
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/** Indicate that select fields are being updated */
|
||||
wait: function() {
|
||||
for (var i in this.list) {
|
||||
this.list[i].field.wait();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/** Indicate that the options update has been completed */
|
||||
unwait: function() {
|
||||
for (var i in this.list) {
|
||||
this.list[i].field.unwait();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/** Update content selector */
|
||||
update: function(options) {
|
||||
// identify dataset options
|
||||
@@ -161,7 +168,7 @@ var View = Backbone.View.extend({
|
||||
value: hda.id
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// identify collection options
|
||||
var collection_options = [];
|
||||
for (var i in options.hdca) {
|
||||
@@ -171,16 +178,16 @@ var View = Backbone.View.extend({
|
||||
value: hdca.id
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// update selection fields
|
||||
this.select_single && this.select_single.update(dataset_options);
|
||||
this.select_multiple && this.select_multiple.update(dataset_options);
|
||||
this.select_collection && this.select_collection.update(collection_options);
|
||||
|
||||
|
||||
// add to content list
|
||||
this.app.content.add(options);
|
||||
},
|
||||
|
||||
|
||||
/** Return the currently selected dataset values */
|
||||
value : function (new_value) {
|
||||
// update current value
|
||||
@@ -216,19 +223,19 @@ var View = Backbone.View.extend({
|
||||
}
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
|
||||
// transform into an array
|
||||
var id_list = this._select().value();
|
||||
if (!(id_list instanceof Array)) {
|
||||
id_list = [id_list];
|
||||
}
|
||||
|
||||
|
||||
// prepare result dict
|
||||
var result = {
|
||||
batch : this.mode == 'single' && this.current != 'single',
|
||||
values : []
|
||||
}
|
||||
|
||||
|
||||
// append to dataset ids
|
||||
for (var i in id_list) {
|
||||
result.values.push({
|
||||
@@ -236,17 +243,17 @@ var View = Backbone.View.extend({
|
||||
src : this.list[this.current].type
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// return
|
||||
return result;
|
||||
},
|
||||
|
||||
|
||||
/** Validate current selection
|
||||
*/
|
||||
validate: function() {
|
||||
return this._select().validate();
|
||||
},
|
||||
|
||||
|
||||
/** Refreshes data selection view */
|
||||
refresh: function() {
|
||||
this.button_type.value(this.current);
|
||||
@@ -264,7 +271,7 @@ var View = Backbone.View.extend({
|
||||
this.$batch.hide();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/** Assists in selecting the current field */
|
||||
_select: function() {
|
||||
return this.list[this.current].field;
|
||||
|
||||
@@ -90,7 +90,7 @@ var View = Options.Base.extend({
|
||||
/** Template for drill down view
|
||||
*/
|
||||
_template: function(options) {
|
||||
return '<div class="ui-options drilldown-container" id="' + options.id + '"/>';
|
||||
return '<div class="ui-options-input drilldown-container" id="' + options.id + '"/>';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ var Base = Backbone.View.extend({
|
||||
this.options = Utils.merge(options, this.optionsDefault);
|
||||
|
||||
// create new element
|
||||
this.setElement('<div/>');
|
||||
this.setElement('<div class="ui-options"/>');
|
||||
|
||||
// create elements
|
||||
this.$message = $('<div/>');
|
||||
@@ -221,7 +221,7 @@ var Base = Backbone.View.extend({
|
||||
/** Main template function
|
||||
*/
|
||||
_template: function() {
|
||||
return '<div class="ui-options"/>';
|
||||
return '<div class="ui-options-input"/>';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -7,19 +7,19 @@ var View = Backbone.View.extend({
|
||||
// link app and options
|
||||
this.app = app;
|
||||
this.options = options;
|
||||
|
||||
|
||||
// link this
|
||||
var self = this;
|
||||
|
||||
|
||||
// add element
|
||||
this.setElement('<div/>');
|
||||
|
||||
this.setElement('<div class="ui-select-content"/>');
|
||||
|
||||
// list of select fields
|
||||
this.list = {};
|
||||
|
||||
|
||||
// radio button options
|
||||
var radio_buttons = [];
|
||||
|
||||
|
||||
// identify selector type
|
||||
if (options.type == 'data_collection') {
|
||||
this.mode = 'collection';
|
||||
@@ -30,11 +30,11 @@ var View = Backbone.View.extend({
|
||||
this.mode = 'single';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// set initial state
|
||||
this.current = this.mode;
|
||||
this.list = {};
|
||||
|
||||
|
||||
// error messages
|
||||
var extensions = Utils.textify(options.extensions);
|
||||
var hda_error = 'No dataset available.';
|
||||
@@ -45,10 +45,10 @@ var View = Backbone.View.extend({
|
||||
if (extensions) {
|
||||
hdca_error = 'No ' + extensions + ' dataset collection available.';
|
||||
}
|
||||
|
||||
|
||||
// add single dataset selector
|
||||
if (this.mode == 'single') {
|
||||
radio_buttons.push({icon: 'fa-file-o', label : 'Single dataset', value : 'single'});
|
||||
radio_buttons.push({icon: 'fa-file-o', label : '', value : 'single'});
|
||||
this.select_single = new Ui.Select.View({
|
||||
optional : options.optional,
|
||||
error_text : hda_error,
|
||||
@@ -61,10 +61,10 @@ var View = Backbone.View.extend({
|
||||
type : 'hda'
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// add multiple dataset selector
|
||||
if (this.mode == 'single' || this.mode == 'multiple') {
|
||||
radio_buttons.push({icon: 'fa-files-o', label : 'Multiple datasets', value : 'multiple' });
|
||||
radio_buttons.push({icon: 'fa-files-o', label : '', value : 'multiple' });
|
||||
this.select_multiple = new Ui.Select.View({
|
||||
multiple : true,
|
||||
error_text : hda_error,
|
||||
@@ -77,10 +77,10 @@ var View = Backbone.View.extend({
|
||||
type : 'hda'
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// add collection selector
|
||||
if (this.mode == 'single' || this.mode == 'collection') {
|
||||
radio_buttons.push({icon: 'fa-folder-o', label : 'Dataset collection', value : 'collection' });
|
||||
radio_buttons.push({icon: 'fa-folder-o', label : '', value : 'collection' });
|
||||
this.select_collection = new Ui.Select.View({
|
||||
error_text : hdca_error,
|
||||
optional : options.optional,
|
||||
@@ -93,7 +93,7 @@ var View = Backbone.View.extend({
|
||||
type : 'hdca'
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// create button
|
||||
this.button_type = new Ui.RadioButton.View({
|
||||
value : this.current,
|
||||
@@ -104,30 +104,37 @@ var View = Backbone.View.extend({
|
||||
self.trigger('change');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// add batch mode information
|
||||
this.$batch = $(ToolTemplate.batchMode());
|
||||
|
||||
|
||||
// calculate button width (should be placed into css once its supported)
|
||||
var button_width = (_.size(this.list) - 1) * 60 + 'px';
|
||||
|
||||
// add elements to dom
|
||||
if (_.size(this.list) > 1) {
|
||||
this.$el.append(this.button_type.$el.addClass('ui-margin-bottom'));
|
||||
this.$el.append(this.button_type.$el);
|
||||
}
|
||||
for (var i in this.list) {
|
||||
this.$el.append(this.list[i].field.$el);
|
||||
this.$el.append(this.list[i].field.$el.css({
|
||||
'margin-left': button_width
|
||||
}));
|
||||
}
|
||||
this.$el.append(this.$batch);
|
||||
|
||||
this.$el.append(this.$batch.css({
|
||||
'margin-left': button_width
|
||||
}));
|
||||
|
||||
// update options
|
||||
this.update(options.data);
|
||||
|
||||
|
||||
// set initial value
|
||||
if (this.options.value !== undefined) {
|
||||
this.value(this.options.value);
|
||||
}
|
||||
|
||||
|
||||
// refresh view
|
||||
this.refresh();
|
||||
|
||||
|
||||
// add change event. fires on trigger
|
||||
this.on('change', function() {
|
||||
if (options.onchange) {
|
||||
@@ -135,21 +142,21 @@ var View = Backbone.View.extend({
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/** Indicate that select fields are being updated */
|
||||
wait: function() {
|
||||
for (var i in this.list) {
|
||||
this.list[i].field.wait();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/** Indicate that the options update has been completed */
|
||||
unwait: function() {
|
||||
for (var i in this.list) {
|
||||
this.list[i].field.unwait();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/** Update content selector */
|
||||
update: function(options) {
|
||||
// identify dataset options
|
||||
@@ -161,7 +168,7 @@ var View = Backbone.View.extend({
|
||||
value: hda.id
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// identify collection options
|
||||
var collection_options = [];
|
||||
for (var i in options.hdca) {
|
||||
@@ -171,16 +178,16 @@ var View = Backbone.View.extend({
|
||||
value: hdca.id
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// update selection fields
|
||||
this.select_single && this.select_single.update(dataset_options);
|
||||
this.select_multiple && this.select_multiple.update(dataset_options);
|
||||
this.select_collection && this.select_collection.update(collection_options);
|
||||
|
||||
|
||||
// add to content list
|
||||
this.app.content.add(options);
|
||||
},
|
||||
|
||||
|
||||
/** Return the currently selected dataset values */
|
||||
value : function (new_value) {
|
||||
// update current value
|
||||
@@ -216,19 +223,19 @@ var View = Backbone.View.extend({
|
||||
}
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
|
||||
// transform into an array
|
||||
var id_list = this._select().value();
|
||||
if (!(id_list instanceof Array)) {
|
||||
id_list = [id_list];
|
||||
}
|
||||
|
||||
|
||||
// prepare result dict
|
||||
var result = {
|
||||
batch : this.mode == 'single' && this.current != 'single',
|
||||
values : []
|
||||
}
|
||||
|
||||
|
||||
// append to dataset ids
|
||||
for (var i in id_list) {
|
||||
result.values.push({
|
||||
@@ -236,17 +243,17 @@ var View = Backbone.View.extend({
|
||||
src : this.list[this.current].type
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// return
|
||||
return result;
|
||||
},
|
||||
|
||||
|
||||
/** Validate current selection
|
||||
*/
|
||||
validate: function() {
|
||||
return this._select().validate();
|
||||
},
|
||||
|
||||
|
||||
/** Refreshes data selection view */
|
||||
refresh: function() {
|
||||
this.button_type.value(this.current);
|
||||
@@ -264,7 +271,7 @@ var View = Backbone.View.extend({
|
||||
this.$batch.hide();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/** Assists in selecting the current field */
|
||||
_select: function() {
|
||||
return this.list[this.current].field;
|
||||
|
||||
@@ -90,7 +90,7 @@ var View = Options.Base.extend({
|
||||
/** Template for drill down view
|
||||
*/
|
||||
_template: function(options) {
|
||||
return '<div class="ui-options drilldown-container" id="' + options.id + '"/>';
|
||||
return '<div class="ui-options-input drilldown-container" id="' + options.id + '"/>';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ var Base = Backbone.View.extend({
|
||||
this.options = Utils.merge(options, this.optionsDefault);
|
||||
|
||||
// create new element
|
||||
this.setElement('<div/>');
|
||||
this.setElement('<div class="ui-options"/>');
|
||||
|
||||
// create elements
|
||||
this.$message = $('<div/>');
|
||||
@@ -221,7 +221,7 @@ var Base = Backbone.View.extend({
|
||||
/** Main template function
|
||||
*/
|
||||
_template: function() {
|
||||
return '<div class="ui-options"/>';
|
||||
return '<div class="ui-options-input"/>';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
define(["utils/utils","mvc/ui/ui-misc","mvc/ui/ui-tabs","mvc/tools/tools-template"],function(c,e,b,a){var d=Backbone.View.extend({initialize:function(l,g){this.app=l;this.options=g;var f=this;this.setElement("<div/>");this.list={};var j=[];if(g.type=="data_collection"){this.mode="collection"}else{if(g.multiple){this.mode="multiple"}else{this.mode="single"}}this.current=this.mode;this.list={};var k=c.textify(g.extensions);var n="No dataset available.";if(k){n="No "+k+" dataset available."}var m="No dataset list available.";if(k){m="No "+k+" dataset collection available."}if(this.mode=="single"){j.push({icon:"fa-file-o",label:"Single dataset",value:"single"});this.select_single=new e.Select.View({optional:g.optional,error_text:n,onchange:function(){f.trigger("change")}});this.list.single={field:this.select_single,type:"hda"}}if(this.mode=="single"||this.mode=="multiple"){j.push({icon:"fa-files-o",label:"Multiple datasets",value:"multiple"});this.select_multiple=new e.Select.View({multiple:true,error_text:n,onchange:function(){f.trigger("change")}});this.list.multiple={field:this.select_multiple,type:"hda"}}if(this.mode=="single"||this.mode=="collection"){j.push({icon:"fa-folder-o",label:"Dataset collection",value:"collection"});this.select_collection=new e.Select.View({error_text:m,optional:g.optional,onchange:function(){f.trigger("change")}});this.list.collection={field:this.select_collection,type:"hdca"}}this.button_type=new e.RadioButton.View({value:this.current,data:j,onchange:function(i){f.current=i;f.refresh();f.trigger("change")}});this.$batch=$(a.batchMode());if(_.size(this.list)>1){this.$el.append(this.button_type.$el.addClass("ui-margin-bottom"))}for(var h in this.list){this.$el.append(this.list[h].field.$el)}this.$el.append(this.$batch);this.update(g.data);if(this.options.value!==undefined){this.value(this.options.value)}this.refresh();this.on("change",function(){if(g.onchange){g.onchange(f.value())}})},wait:function(){for(var f in this.list){this.list[f].field.wait()}},unwait:function(){for(var f in this.list){this.list[f].field.unwait()}},update:function(g){var l=[];for(var j in g.hda){var k=g.hda[j];l.push({label:k.hid+": "+k.name,value:k.id})}var f=[];for(var j in g.hdca){var h=g.hdca[j];f.push({label:h.hid+": "+h.name,value:h.id})}this.select_single&&this.select_single.update(l);this.select_multiple&&this.select_multiple.update(l);this.select_collection&&this.select_collection.update(f);this.app.content.add(g)},value:function(h){if(h!==undefined){if(h&&h.values){try{var l=[];for(var g in h.values){l.push(h.values[g].id)}if(h&&h.values.length>0&&h.values[0].src=="hcda"){this.current="collection";this.select_collection.value(l[0])}else{if(this.mode=="multiple"){this.current="multiple";this.select_multiple.value(l)}else{this.current="single";this.select_single.value(l[0])}}}catch(k){console.debug("tools-select-content::value() - Skipped.")}}else{this.select_single&&this.select_single.value("__null__");this.select_multiple&&this.select_multiple.value("__null__");this.select_collection&&this.select_collection.value("__null__")}this.refresh()}var j=this._select().value();if(!(j instanceof Array)){j=[j]}var f={batch:this.mode=="single"&&this.current!="single",values:[]};for(var g in j){f.values.push({id:j[g],src:this.list[this.current].type})}return f},validate:function(){return this._select().validate()},refresh:function(){this.button_type.value(this.current);for(var g in this.list){var f=this.list[g].field.$el;if(this.current==g){f.show()}else{f.hide()}}if(this.mode=="single"&&this.current!="single"){this.$batch.show()}else{this.$batch.hide()}},_select:function(){return this.list[this.current].field}});return{View:d}});
|
||||
define(["utils/utils","mvc/ui/ui-misc","mvc/ui/ui-tabs","mvc/tools/tools-template"],function(c,e,b,a){var d=Backbone.View.extend({initialize:function(f,o){this.app=f;this.options=o;var n=this;this.setElement('<div class="ui-select-content"/>');this.list={};var l=[];if(o.type=="data_collection"){this.mode="collection"}else{if(o.multiple){this.mode="multiple"}else{this.mode="single"}}this.current=this.mode;this.list={};var j=c.textify(o.extensions);var h="No dataset available.";if(j){h="No "+j+" dataset available."}var k="No dataset list available.";if(j){k="No "+j+" dataset collection available."}if(this.mode=="single"){l.push({icon:"fa-file-o",label:"",value:"single"});this.select_single=new e.Select.View({optional:o.optional,error_text:h,onchange:function(){n.trigger("change")}});this.list.single={field:this.select_single,type:"hda"}}if(this.mode=="single"||this.mode=="multiple"){l.push({icon:"fa-files-o",label:"",value:"multiple"});this.select_multiple=new e.Select.View({multiple:true,error_text:h,onchange:function(){n.trigger("change")}});this.list.multiple={field:this.select_multiple,type:"hda"}}if(this.mode=="single"||this.mode=="collection"){l.push({icon:"fa-folder-o",label:"",value:"collection"});this.select_collection=new e.Select.View({error_text:k,optional:o.optional,onchange:function(){n.trigger("change")}});this.list.collection={field:this.select_collection,type:"hdca"}}this.button_type=new e.RadioButton.View({value:this.current,data:l,onchange:function(i){n.current=i;n.refresh();n.trigger("change")}});this.$batch=$(a.batchMode());var m=(_.size(this.list)-1)*60+"px";if(_.size(this.list)>1){this.$el.append(this.button_type.$el)}for(var g in this.list){this.$el.append(this.list[g].field.$el.css({"margin-left":m}))}this.$el.append(this.$batch.css({"margin-left":m}));this.update(o.data);if(this.options.value!==undefined){this.value(this.options.value)}this.refresh();this.on("change",function(){if(o.onchange){o.onchange(n.value())}})},wait:function(){for(var f in this.list){this.list[f].field.wait()}},unwait:function(){for(var f in this.list){this.list[f].field.unwait()}},update:function(g){var l=[];for(var j in g.hda){var k=g.hda[j];l.push({label:k.hid+": "+k.name,value:k.id})}var f=[];for(var j in g.hdca){var h=g.hdca[j];f.push({label:h.hid+": "+h.name,value:h.id})}this.select_single&&this.select_single.update(l);this.select_multiple&&this.select_multiple.update(l);this.select_collection&&this.select_collection.update(f);this.app.content.add(g)},value:function(h){if(h!==undefined){if(h&&h.values){try{var l=[];for(var g in h.values){l.push(h.values[g].id)}if(h&&h.values.length>0&&h.values[0].src=="hcda"){this.current="collection";this.select_collection.value(l[0])}else{if(this.mode=="multiple"){this.current="multiple";this.select_multiple.value(l)}else{this.current="single";this.select_single.value(l[0])}}}catch(k){console.debug("tools-select-content::value() - Skipped.")}}else{this.select_single&&this.select_single.value("__null__");this.select_multiple&&this.select_multiple.value("__null__");this.select_collection&&this.select_collection.value("__null__")}this.refresh()}var j=this._select().value();if(!(j instanceof Array)){j=[j]}var f={batch:this.mode=="single"&&this.current!="single",values:[]};for(var g in j){f.values.push({id:j[g],src:this.list[this.current].type})}return f},validate:function(){return this._select().validate()},refresh:function(){this.button_type.value(this.current);for(var g in this.list){var f=this.list[g].field.$el;if(this.current==g){f.show()}else{f.hide()}}if(this.mode=="single"&&this.current!="single"){this.$batch.show()}else{this.$batch.hide()}},_select:function(){return this.list[this.current].field}});return{View:d}});
|
||||
@@ -1 +1 @@
|
||||
define(["utils/utils","mvc/ui/ui-options"],function(b,a){var c=a.Base.extend({initialize:function(d){this.display=d.display||"checkbox";d.multiple=(this.display=="checkbox");a.Base.prototype.initialize.call(this,d)},_templateOption:function(d,f,e){return'<div><input name="'+this.options.id+'" class="ui-option" type="'+this.display+'" value="'+f+'">'+d+"<div/>"},_templateOptions:function(f){var e=this;function g(k,l){function j(m){if(m){l.fadeIn("fast");k.removeClass("toggle-expand");k.addClass("toggle");k.is_expanded=true}else{l.hide();k.removeClass("toggle");k.addClass("toggle-expand");k.is_expanded=false}}k.on("click",function(){j(!k.is_expanded)})}function d(p,k){for(i in k){var q=k[i];var m=q.options.length>0;var l=$("<div/>");if(m){var n=$('<span class="ui-drilldown-button form-toggle icon-button toggle-expand" style="position: relative; top: 2px;"/>');var j=$("<div/>");j.append(n);j.append(e._templateOption(q.name,q.value));l.append(j);var o=$('<div style="display: none; margin-left: 25px;"/>');d(o,q.options);l.append(o);g(n,o)}else{l.append(e._templateOption(q.name,q.value))}p.append(l)}}var h=$("<div/>");d(h,f);return h},_template:function(d){return'<div class="ui-options drilldown-container" id="'+d.id+'"/>'}});return{View:c}});
|
||||
define(["utils/utils","mvc/ui/ui-options"],function(b,a){var c=a.Base.extend({initialize:function(d){this.display=d.display||"checkbox";d.multiple=(this.display=="checkbox");a.Base.prototype.initialize.call(this,d)},_templateOption:function(d,f,e){return'<div><input name="'+this.options.id+'" class="ui-option" type="'+this.display+'" value="'+f+'">'+d+"<div/>"},_templateOptions:function(f){var e=this;function g(k,l){function j(m){if(m){l.fadeIn("fast");k.removeClass("toggle-expand");k.addClass("toggle");k.is_expanded=true}else{l.hide();k.removeClass("toggle");k.addClass("toggle-expand");k.is_expanded=false}}k.on("click",function(){j(!k.is_expanded)})}function d(p,k){for(i in k){var q=k[i];var m=q.options.length>0;var l=$("<div/>");if(m){var n=$('<span class="ui-drilldown-button form-toggle icon-button toggle-expand" style="position: relative; top: 2px;"/>');var j=$("<div/>");j.append(n);j.append(e._templateOption(q.name,q.value));l.append(j);var o=$('<div style="display: none; margin-left: 25px;"/>');d(o,q.options);l.append(o);g(n,o)}else{l.append(e._templateOption(q.name,q.value))}p.append(l)}}var h=$("<div/>");d(h,f);return h},_template:function(d){return'<div class="ui-options-input drilldown-container" id="'+d.id+'"/>'}});return{View:c}});
|
||||
@@ -1 +1 @@
|
||||
define(["utils/utils"],function(b){var a=Backbone.View.extend({initialize:function(g){this.optionsDefault={visible:true,data:[],id:b.uuid(),error_text:"No data available.",wait_text:"Please wait..."};this.options=b.merge(g,this.optionsDefault);this.setElement("<div/>");this.$message=$("<div/>");this.$options=$(this._template(g));this.$el.append(this.$message);this.$el.append(this.$options);if(!this.options.visible){this.$el.hide()}this.update(this.options.data);if(this.options.value!==undefined){this.value(this.options.value)}var f=this;this.on("change",function(){f._change()})},update:function(g){var j=this._getValue();this.$options.empty();if(this._templateOptions){this.$options.append(this._templateOptions(g))}else{for(var h in g){var i=$(this._templateOption(g[h]));i.addClass("ui-option");this.$options.append(i)}}var f=this;this.$el.find("input").on("change",function(){f.value(f._getValue());f._change()});this._refresh();this.value(j)},value:function(g){if(g!==undefined){if(!(g instanceof Array)){g=[g]}this.$el.find("input").prop("checked",false);for(var f in g){this.$el.find('input[value="'+g[f]+'"]').first().prop("checked",true)}}return this._getValue()},exists:function(g){if(g!==undefined){if(!(g instanceof Array)){g=[g]}for(var f in g){if(this.$el.find('input[value="'+g[f]+'"]').length>0){return true}}}return false},first:function(){var f=this.$el.find("input");if(f.length>0){return f.val()}else{return undefined}},validate:function(){return b.validate(this.value())},wait:function(){if(this._size()==0){this._messageShow(this.options.wait_text,"info");this.$options.hide()}},unwait:function(){this._messageHide();this._refresh()},_change:function(){if(this.options.onchange){this.options.onchange(this._getValue())}},_refresh:function(){if(this._size()==0){this._messageShow(this.options.error_text,"danger");this.$options.hide()}else{this._messageHide();this.$options.css("display","inline-block")}},_getValue:function(){var g=this.$el.find(":checked");if(g.length==0){return"__null__"}if(this.options.multiple){var f=[];g.each(function(){f.push($(this).val())});return f}else{return g.val()}},_size:function(){return this.$el.find(".ui-option").length},_messageShow:function(g,f){this.$message.show();this.$message.removeClass();this.$message.addClass("ui-message alert alert-"+f);this.$message.html(g)},_messageHide:function(){this.$message.hide()},_template:function(){return'<div class="ui-options"/>'}});var d={};d.View=a.extend({initialize:function(f){a.prototype.initialize.call(this,f)},_templateOption:function(f){return'<div><input type="radio" name="'+this.options.id+'" value="'+f.value+'"/>'+f.label+"<br></div>"}});var c={};c.View=a.extend({initialize:function(f){f.multiple=true;a.prototype.initialize.call(this,f)},_templateOption:function(f){return'<div><input type="checkbox" name="'+this.options.id+'" value="'+f.value+'"/>'+f.label+"<br></div>"}});var e={};e.View=a.extend({initialize:function(f){a.prototype.initialize.call(this,f)},value:function(f){if(f!==undefined){this.$el.find("input").prop("checked",false);this.$el.find("label").removeClass("active");this.$el.find('[value="'+f+'"]').prop("checked",true).closest("label").addClass("active")}return this._getValue()},_templateOption:function(g){var f='<label class="btn btn-default">';if(g.icon){f+='<i class="fa '+g.icon+'"/>'}f+='<input type="radio" name="'+this.options.id+'" value="'+g.value+'">'+g.label+"</label>";return f},_template:function(){return'<div class="btn-group ui-radiobutton" data-toggle="buttons"/>'}});return{Base:a,Radio:d,RadioButton:e,Checkbox:c}});
|
||||
define(["utils/utils"],function(b){var a=Backbone.View.extend({initialize:function(g){this.optionsDefault={visible:true,data:[],id:b.uuid(),error_text:"No data available.",wait_text:"Please wait..."};this.options=b.merge(g,this.optionsDefault);this.setElement('<div class="ui-options"/>');this.$message=$("<div/>");this.$options=$(this._template(g));this.$el.append(this.$message);this.$el.append(this.$options);if(!this.options.visible){this.$el.hide()}this.update(this.options.data);if(this.options.value!==undefined){this.value(this.options.value)}var f=this;this.on("change",function(){f._change()})},update:function(g){var j=this._getValue();this.$options.empty();if(this._templateOptions){this.$options.append(this._templateOptions(g))}else{for(var h in g){var i=$(this._templateOption(g[h]));i.addClass("ui-option");this.$options.append(i)}}var f=this;this.$el.find("input").on("change",function(){f.value(f._getValue());f._change()});this._refresh();this.value(j)},value:function(g){if(g!==undefined){if(!(g instanceof Array)){g=[g]}this.$el.find("input").prop("checked",false);for(var f in g){this.$el.find('input[value="'+g[f]+'"]').first().prop("checked",true)}}return this._getValue()},exists:function(g){if(g!==undefined){if(!(g instanceof Array)){g=[g]}for(var f in g){if(this.$el.find('input[value="'+g[f]+'"]').length>0){return true}}}return false},first:function(){var f=this.$el.find("input");if(f.length>0){return f.val()}else{return undefined}},validate:function(){return b.validate(this.value())},wait:function(){if(this._size()==0){this._messageShow(this.options.wait_text,"info");this.$options.hide()}},unwait:function(){this._messageHide();this._refresh()},_change:function(){if(this.options.onchange){this.options.onchange(this._getValue())}},_refresh:function(){if(this._size()==0){this._messageShow(this.options.error_text,"danger");this.$options.hide()}else{this._messageHide();this.$options.css("display","inline-block")}},_getValue:function(){var g=this.$el.find(":checked");if(g.length==0){return"__null__"}if(this.options.multiple){var f=[];g.each(function(){f.push($(this).val())});return f}else{return g.val()}},_size:function(){return this.$el.find(".ui-option").length},_messageShow:function(g,f){this.$message.show();this.$message.removeClass();this.$message.addClass("ui-message alert alert-"+f);this.$message.html(g)},_messageHide:function(){this.$message.hide()},_template:function(){return'<div class="ui-options-input"/>'}});var d={};d.View=a.extend({initialize:function(f){a.prototype.initialize.call(this,f)},_templateOption:function(f){return'<div><input type="radio" name="'+this.options.id+'" value="'+f.value+'"/>'+f.label+"<br></div>"}});var c={};c.View=a.extend({initialize:function(f){f.multiple=true;a.prototype.initialize.call(this,f)},_templateOption:function(f){return'<div><input type="checkbox" name="'+this.options.id+'" value="'+f.value+'"/>'+f.label+"<br></div>"}});var e={};e.View=a.extend({initialize:function(f){a.prototype.initialize.call(this,f)},value:function(f){if(f!==undefined){this.$el.find("input").prop("checked",false);this.$el.find("label").removeClass("active");this.$el.find('[value="'+f+'"]').prop("checked",true).closest("label").addClass("active")}return this._getValue()},_templateOption:function(g){var f='<label class="btn btn-default">';if(g.icon){f+='<i class="fa '+g.icon+'"/>'}f+='<input type="radio" name="'+this.options.id+'" value="'+g.value+'">'+g.label+"</label>";return f},_template:function(){return'<div class="btn-group ui-radiobutton" data-toggle="buttons"/>'}});return{Base:a,Radio:d,RadioButton:e,Checkbox:c}});
|
||||
@@ -148,7 +148,7 @@ output{display:block;padding-top:5px;font-size:12px;line-height:1.428571429;colo
|
||||
.form-control::-moz-placeholder{color:#999}
|
||||
.form-control:-ms-input-placeholder{color:#999}
|
||||
.form-control::-webkit-input-placeholder{color:#999}
|
||||
.form-control,.ui-input,.ui-textarea,.ui-options,.ui-form-slider .ui-form-slider-text,.ui-select-multiple{display:block;width:100%;height:27px;padding:4px 10px;font-size:12px;line-height:1.428571429;color:#555;vertical-align:middle;background-color:#fff;border:1px solid #aaa;border-radius:3px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border-color ease-in-out .15s, box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s, box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6)}
|
||||
.form-control,.ui-input,.ui-textarea,.ui-options .ui-options-input,.ui-form-slider .ui-form-slider-text,.ui-select-multiple{display:block;width:100%;height:27px;padding:4px 10px;font-size:12px;line-height:1.428571429;color:#555;vertical-align:middle;background-color:#fff;border:1px solid #aaa;border-radius:3px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border-color ease-in-out .15s, box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s, box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6)}
|
||||
.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{cursor:not-allowed;background-color:#eee}
|
||||
textarea.form-control{height:auto}
|
||||
.form-group{margin-bottom:15px}
|
||||
@@ -1434,9 +1434,9 @@ label{font-weight:normal}
|
||||
.ui-portlet-limited,.ui-portlet-narrow,.ui-portlet-narrow{max-width:900px}
|
||||
.ui-popover{max-width:700px;display:none}.ui-popover .popover-close{position:absolute;right:10px;top:7px;font-size:1.2em;cursor:pointer}
|
||||
.ui-popover .popover-title{padding:4px 10px}
|
||||
.ui-input,.ui-textarea,.ui-options,.ui-form-slider .ui-form-slider-text,.ui-select-multiple,.ui-textarea,.ui-options,.ui-form-slider .ui-form-slider-text,.ui-select-multiple{background:transparent}
|
||||
.ui-input,.ui-textarea,.ui-options .ui-options-input,.ui-form-slider .ui-form-slider-text,.ui-select-multiple,.ui-textarea,.ui-options .ui-options-input,.ui-form-slider .ui-form-slider-text,.ui-select-multiple{background:transparent}
|
||||
.ui-textarea{height:100px !important}
|
||||
.ui-options{height:100% !important}
|
||||
.ui-options .ui-options-input{height:100% !important}
|
||||
.ui-form-slider{display:inline-block;width:100%}.ui-form-slider .ui-form-slider-text{width:100px;float:left}
|
||||
.ui-form-slider .ui-form-slider-element{width:calc(100% - 110px);float:left;top:8px;left:10px}
|
||||
.ui-radiobutton{width:100%}.ui-radiobutton label{height:23px;line-height:1em}
|
||||
@@ -1445,6 +1445,7 @@ label{font-weight:normal}
|
||||
.ui-select{position:relative}.ui-select .button{position:absolute;top:5px;right:5px}
|
||||
.ui-select .select2-container{width:100%}
|
||||
.ui-select select{position:relative;top:0px;height:27px;width:100%;padding-left:5px;padding-right:20px;cursor:pointer;background:transparent;-webkit-appearance:none;border:1px solid #bfbfbf;-moz-border-radius:3px;border-radius:3px}
|
||||
.ui-select-content .ui-options{float:left;padding-top:2px}
|
||||
.libraryRow{background-color:#ebd9b2}
|
||||
.datasetHighlighted{background-color:#f9f9f9}
|
||||
.libraryItemDeleted-True{font-style:italic}
|
||||
|
||||
@@ -316,8 +316,10 @@
|
||||
}
|
||||
|
||||
.ui-options {
|
||||
&:extend(.ui-input);
|
||||
height: 100% !important;
|
||||
.ui-options-input {
|
||||
&:extend(.ui-input);
|
||||
height: 100% !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -384,4 +386,11 @@
|
||||
|
||||
.ui-select-multiple {
|
||||
&:extend(.ui-input);
|
||||
}
|
||||
|
||||
.ui-select-content {
|
||||
.ui-options {
|
||||
float: left;
|
||||
padding-top: 2px;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user