1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/c665ed80227c/ Changeset: c665ed80227c User: guerler Date: 2014-08-25 18:27:18 Summary: ToolForm: Add repeat blocks, refactor conditionals, fix styles, pack scripts Affected #: 11 files diff -r 261471d0476328d8bbdbe71b9d6a954abf032ad7 -r c665ed80227c76001c0a2e767e66d992ed72b4ad static/scripts/mvc/tools/tools-form.js --- a/static/scripts/mvc/tools/tools-form.js +++ b/static/scripts/mvc/tools/tools-form.js @@ -1,8 +1,8 @@ -define(['mvc/ui/ui-portlet', 'mvc/ui/ui-table', 'mvc/ui/ui-misc', +define(['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-datasets'], - function(Portlet, Table, Ui, CitationModel, CitationView, - Tools, ToolTemplate, ToolDatasets) { + 'mvc/tools', 'mvc/tools/tools-template', 'mvc/tools/tools-datasets', 'mvc/tools/tools-section'], + function(Portlet, Ui, CitationModel, CitationView, + Tools, ToolTemplate, ToolDatasets, ToolSection) { // create tool model var Model = Backbone.Model.extend({ @@ -39,9 +39,19 @@ // initialize tool form _initializeToolForm: function() { + + // reset field list + this.field_list = {}; + + // reset sequential input definition list + this.inputs_sequential = {}; + // fetch model and render form var self = this; this.model.fetch({ + error: function(response) { + console.debug('tools-form::_initializeToolForm() : Attempt to fetch tool model failed.'); + }, success: function() { // inputs self.inputs = self.model.get('inputs'); @@ -62,9 +72,6 @@ } }); - // create table - self.table = new Table.View(); - // create message self.message = new Ui.Message(); self.portlet.append(self.message.$el); @@ -92,380 +99,14 @@ // configure portlet and form table self.setElement(self.portlet.content()); - self.portlet.append(self.table.$el); - self.render(); - } - }); - }, - - // update - render: function() { - // reset table - this.table.delAll(); - - // reset field list - this.field_list = {}; - - // reset sequential input definition list - this.inputs_sequential = {}; - - // model - var data = new Backbone.Model(); - - // load settings elements into table - for (var id in this.inputs) { - this._add(this.inputs[id], data); - } - - // trigger change - for (var id in this.field_list) { - this.field_list[id].trigger('change'); - } - }, - - // add table row - _add: function(inputs_def, data) { - // identify field type - var type = inputs_def.type; - switch(type) { - // conditional field - case 'conditional': - // add label to input definition root - inputs_def.label = inputs_def.test_param.label; - - // add id to input definition root - inputs_def.name = inputs_def.test_param.name; - - // build options field - this._addRow('conditional', inputs_def, data); - // add fields - for (var i in inputs_def.cases) { - var cases = inputs_def.cases[i]; - for (var j in cases.inputs) { - // add element to form - this._add(cases.inputs[j], data); - } - } - break; - - // default single element row - default: - this._addRow(type, inputs_def, data); - } - }, - - // add table row - _addRow: function(field_type, inputs_def, data) { - // get id - var id = inputs_def.name; - - // field wrapper - var field = null; - - // identify field type - switch(field_type) { - // text input field - case 'text' : - field = this._field_text(inputs_def, data); - break; - - // select field - case 'select' : - field = this._field_select(inputs_def, data); - break; - - // radiobox field - case 'radiobutton' : - field = this._field_radio(inputs_def, data); - break; - - // dataset - case 'data': - field = this._field_data(inputs_def, data); - break; - - // dataset column - case 'data_column': - field = this._field_column(inputs_def, data); - break; - - // text area field - case 'textarea' : - field = this._field_textarea(inputs_def, data); - break; - - // conditional select field - case 'conditional': - field = this._field_conditional(inputs_def, data); - break; - } - - // check if field type was detected - if (!field) { - console.debug('tools-form::_addRow() : Unmatched field type (' + field_type + ').'); - return; - } - - // set value - if (!data.get(id)) { - data.set(id, inputs_def.value); - } - field.value(data.get(id)); - - // add to field list - this.field_list[id] = field; - - // add to input definition into sequential list - this.inputs_sequential[id] = inputs_def; - - // combine field and info - var $input = $('<div/>'); - $input.append(field.$el); - if (inputs_def.info) { - $input.append('<div class="ui-table-form-info">' + inputs_def.info + '</div>'); - } - - // add row to table - this.table.add('<span class="ui-table-form-title">' + inputs_def.label + '</span>', '25%'); - this.table.add($input); - - // add to table - this.table.append(id); - - // show/hide - if (inputs_def.hide) { - this.table.get(id).hide(); - } - }, - - // text input field - _field_text : function(inputs_def, data) { - var id = inputs_def.name; - return new Ui.Input({ - id : 'field-' + id, - value : data.get(id), - onchange : function(value) { - data.set(id, value); - } - }); - }, - - // text area - _field_textarea : function(inputs_def, data) { - var id = inputs_def.name; - return new Ui.Textarea({ - id : 'field-' + id, - onchange : function() { - data.set(id, field.value()); - } - }); - }, - - // conditional input field - _field_conditional : function(inputs_def, data) { - // link this - var self = this; - - // configure options fields - var options = []; - for (var i in inputs_def.test_param.options) { - var option = inputs_def.test_param.options[i]; - options.push({ - label: option[0], - value: option[1] - }); - } - - // select field - var id = inputs_def.name; - return new Ui.Select.View({ - id : 'field-' + id, - data : options, - value : data.get(id), - onchange : function(value) { - // update value - data.set(id, value); - - // recursively hide/show options - function _updateVisibility(root, show) { - // loop through all inputs - for (var i in root.inputs) { - // get input element - var element = root.inputs[i]; - - // identify element name - var element_id = element.name; - - // identify row - var element_row = self.table.get(element_id); - - // show/hide row - if (show) { - element_row.fadeIn(); - } else { - element_row.hide(); - } - - // check if its a nested conditional - if (element.type == 'conditional') { - // identify all cases - for (var j in element.cases) { - _updateVisibility(element.cases[j], show); - } - } - } - } - - // check value in order to hide/show options - for (var i in inputs_def.cases) { - var case_def = inputs_def.cases[i]; - _updateVisibility(case_def, case_def.value == value); - } - } - }); - }, - - // data input field - _field_data : function(inputs_def, data) { - // link this - var self = this; - - // get element id - var id = inputs_def.name; - - // get datasets - var datasets = this.datasets.filterType(); - - // configure options fields - var options = []; - for (var i in datasets) { - options.push({ - label: datasets[i].get('name'), - value: datasets[i].get('id') - }); - } - - // select field - return new Ui.Select.View({ - id : 'field-' + id, - data : options, - value : options[0].value, - onchange : function(value) { - // update value - data.set(id, value); - - // find referenced columns - var column_list = _.where(self.inputs_sequential, { - data_ref : id, - type : 'data_column' + // create tool form section + self.section = new ToolSection.View(self, { + inputs : self.model.get('inputs') }); - // find selected dataset - var dataset = self.datasets.filter(value); - - // check dataset - if (dataset && column_list.length > 0) { - // log selection - console.debug('tool-form::field_data() - Selected dataset ' + value + '.'); - - // get meta data - var meta = dataset.get('metadata_column_types'); - - // check meta data - if (!meta) { - console.debug('tool-form::field_data() - FAILED: Could not find metadata for dataset ' + value + '.'); - } - - // load column options - var columns = []; - for (var key in meta) { - // add to selection - columns.push({ - 'label' : 'Column: ' + (parseInt(key) + 1) + ' [' + meta[key] + ']', - 'value' : key - }); - } - - // update referenced columns - for (var i in column_list) { - var column_field = self.field_list[column_list[i].name] - if (column_field) { - column_field.update(columns); - column_field.value(column_field.first()); - } - } - } else { - // log failure - console.debug('tool-form::field_data() - FAILED: Could not find dataset ' + value + '.'); - } - } - }); - }, - - // select field - _field_column : function (inputs_def, data) { - // configure options fields - var options = []; - for (var i in inputs_def.options) { - var option = inputs_def.options[i]; - options.push({ - label: option[0], - value: option[1] - }); - } - - // select field - var id = inputs_def.name; - return new Ui.Select.View({ - id : 'field-' + id, - data : options, - value : data.get(id), - onchange : function(value) { - data.set(id, value); - } - }); - }, - - // select field - _field_select : function (inputs_def, data) { - // configure options fields - var options = []; - for (var i in inputs_def.options) { - var option = inputs_def.options[i]; - options.push({ - label: option[0], - value: option[1] - }); - } - - // identify display type - var SelectClass = Ui.Select; - if (inputs_def.display == 'checkboxes') { - SelectClass = Ui.Checkbox; - } - - // select field - var id = inputs_def.name; - return new SelectClass.View({ - id : 'field-' + id, - data : options, - value : data.get(id), - onchange : function(value) { - data.set(id, value); - } - }); - }, - - // radio field - _field_radio : function(inputs_def, data) { - var id = inputs_def.name; - return new Ui.RadioButton({ - id : 'field-' + id, - data : inputs_def.data, - value : data.get(id), - onchange : function(value) { - data.set(id, value); + // append tool section + self.portlet.append(self.section.$el); } }); } diff -r 261471d0476328d8bbdbe71b9d6a954abf032ad7 -r c665ed80227c76001c0a2e767e66d992ed72b4ad static/scripts/mvc/tools/tools-section.js --- /dev/null +++ b/static/scripts/mvc/tools/tools-section.js @@ -0,0 +1,409 @@ +define(['mvc/ui/ui-table', 'mvc/ui/ui-misc', 'mvc/ui/ui-tabs'], function(Table, Ui, Tabs) { + + // create form view + var View = Backbone.View.extend({ + // initialize + initialize: function(app, options) { + // link app + this.app = app; + + // link inputs + this.inputs = options.inputs; + + // link datasets + this.datasets = app.datasets; + + // create table + this.table = new Table.View(options); + + // configure portlet and form table + this.setElement(this.table.$el); + + // render tool section + this.render(); + }, + + // update + render: function() { + // reset table + this.table.delAll(); + + // model + var data = new Backbone.Model(); + + // load settings elements into table + for (var id in this.inputs) { + this._add(this.inputs[id], data); + } + + // trigger change + for (var id in this.app.field_list) { + this.app.field_list[id].trigger('change'); + } + }, + + // add table row + _add: function(inputs_def, data) { + // link this + var self = this; + + // identify field type + var type = inputs_def.type; + switch(type) { + // conditional field + case 'conditional': + // add label to input definition root + inputs_def.label = inputs_def.test_param.label; + + // add id to input definition root + inputs_def.name = inputs_def.test_param.name; + + // build options field + this._addRow('conditional', inputs_def, data); + + // add fields + for (var i in inputs_def.cases) { + // create sub section + var sub_section = new View(this.app, { + inputs : inputs_def.cases[i].inputs, + cls : 'ui-table-plain' + }); + + // append sub section + this.table.add(''); + this.table.add(sub_section.$el); + this.table.append(inputs_def.name + '_formsection_' + i); + } + break; + // repeat block + case 'repeat': + // create tab field + var tabs = new Tabs.View({ + title_new : 'Add Group', + onnew : function() { + // create sub section + var sub_section = new View(self.app, { + inputs : inputs_def.inputs, + cls : 'ui-table-plain' + }); + + // create id tag + var sub_section_id = inputs_def.name + '_formsection_' + tabs.size(); + + // add new tab + tabs.add({ + id : sub_section_id, + title : 'Repeat', + $el : sub_section.$el, + ondel : function() { + tabs.del(sub_section_id); + } + }); + + // show tab + tabs.show(sub_section_id); + } + }); + + // append sub section + this.table.add(inputs_def.title); + this.table.add(tabs.$el); + this.table.append(inputs_def.name); + break; + // default single element row + default: + this._addRow(type, inputs_def, data); + } + }, + + // add table row + _addRow: function(field_type, inputs_def, data) { + // get id + var id = inputs_def.name; + + // field wrapper + var field = null; + + // identify field type + switch(field_type) { + // text input field + case 'text' : + field = this._field_text(inputs_def, data); + break; + + // select field + case 'select' : + field = this._field_select(inputs_def, data); + break; + + // radiobox field + case 'radiobutton' : + field = this._field_radio(inputs_def, data); + break; + + // dataset + case 'data': + field = this._field_data(inputs_def, data); + break; + + // dataset column + case 'data_column': + field = this._field_column(inputs_def, data); + break; + + // text area field + case 'textarea' : + field = this._field_textarea(inputs_def, data); + break; + + // conditional select field + case 'conditional': + field = this._field_conditional(inputs_def, data); + break; + } + + // check if field type was detected + if (!field) { + console.debug('tools-form::_addRow() : Unmatched field type (' + field_type + ').'); + return; + } + + // set value + if (!data.get(id)) { + data.set(id, inputs_def.value); + } + field.value(data.get(id)); + + // add to field list + this.app.field_list[id] = field; + + // add to input definition into sequential list + this.app.inputs_sequential[id] = inputs_def; + + // combine field and info + var $input = $('<div/>'); + $input.append(field.$el); + if (inputs_def.help) { + $input.append('<div class="ui-table-form-info">' + inputs_def.help + '</div>'); + } + + // add row to table + this.table.add('<span class="ui-table-form-title">' + inputs_def.label + '</span>', '25%'); + this.table.add($input); + + // add to table + this.table.append(id); + + // show/hide + if (inputs_def.hide) { + this.table.get(id).hide(); + } + }, + + // text input field + _field_text : function(inputs_def, data) { + var id = inputs_def.name; + return new Ui.Input({ + id : 'field-' + id, + value : data.get(id), + onchange : function(value) { + data.set(id, value); + } + }); + }, + + // text area + _field_textarea : function(inputs_def, data) { + var id = inputs_def.name; + return new Ui.Textarea({ + id : 'field-' + id, + onchange : function() { + data.set(id, field.value()); + } + }); + }, + + // conditional input field + _field_conditional : function(inputs_def, data) { + // link this + var self = this; + + // configure options fields + var options = []; + for (var i in inputs_def.test_param.options) { + var option = inputs_def.test_param.options[i]; + options.push({ + label: option[0], + value: option[1] + }); + } + + // select field + var id = inputs_def.name; + return new Ui.Select.View({ + id : 'field-' + id, + data : options, + value : data.get(id), + onchange : function(value) { + // update value + data.set(id, value); + + // check value in order to hide/show options + for (var i in inputs_def.cases) { + // get case + var case_def = inputs_def.cases[i]; + + // identify subsection name + var section_id = inputs_def.name + '_formsection_' + i; + + // identify row + var section_row = self.table.get(section_id); + + // check + if (case_def.value == value) { + section_row.show(); + } else { + section_row.hide(); + } + } + } + }); + }, + + // data input field + _field_data : function(inputs_def, data) { + // link this + var self = this; + + // get element id + var id = inputs_def.name; + + // get datasets + var datasets = this.datasets.filterType(); + + // configure options fields + var options = []; + for (var i in datasets) { + options.push({ + label: datasets[i].get('name'), + value: datasets[i].get('id') + }); + } + + // select field + return new Ui.Select.View({ + id : 'field-' + id, + data : options, + value : options[0].value, + onchange : function(value) { + // update value + data.set(id, value); + + // find referenced columns + var column_list = _.where(self.app.inputs_sequential, { + data_ref : id, + type : 'data_column' + }); + + // find selected dataset + var dataset = self.datasets.filter(value); + + // check dataset + if (dataset && column_list.length > 0) { + // log selection + console.debug('tool-form::field_data() - Selected dataset ' + value + '.'); + + // get meta data + var meta = dataset.get('metadata_column_types'); + + // check meta data + if (!meta) { + console.debug('tool-form::field_data() - FAILED: Could not find metadata for dataset ' + value + '.'); + } + + // load column options + var columns = []; + for (var key in meta) { + // add to selection + columns.push({ + 'label' : 'Column: ' + (parseInt(key) + 1) + ' [' + meta[key] + ']', + 'value' : key + }); + } + + // update referenced columns + for (var i in column_list) { + var column_field = self.app.field_list[column_list[i].name] + if (column_field) { + column_field.update(columns); + column_field.value(column_field.first()); + } + } + } else { + // log failure + console.debug('tool-form::field_data() - FAILED: Could not find dataset ' + value + '.'); + } + } + }); + }, + + // column selection field + _field_column : function (inputs_def, data) { + var id = inputs_def.name; + return new Ui.Select.View({ + id : 'field-' + id, + value : data.get(id), + onchange : function(value) { + data.set(id, value); + } + }); + }, + + // select field + _field_select : function (inputs_def, data) { + // configure options fields + var options = []; + for (var i in inputs_def.options) { + var option = inputs_def.options[i]; + options.push({ + label: option[0], + value: option[1] + }); + } + + // identify display type + var SelectClass = Ui.Select; + if (inputs_def.display == 'checkboxes') { + SelectClass = Ui.Checkbox; + } + + // select field + var id = inputs_def.name; + return new SelectClass.View({ + id : 'field-' + id, + data : options, + value : data.get(id), + onchange : function(value) { + data.set(id, value); + } + }); + }, + + // radio field + _field_radio : function(inputs_def, data) { + var id = inputs_def.name; + return new Ui.RadioButton({ + id : 'field-' + id, + data : inputs_def.data, + value : data.get(id), + onchange : function(value) { + data.set(id, value); + } + }); + } + }); + + return { + View: View + }; +}); diff -r 261471d0476328d8bbdbe71b9d6a954abf032ad7 -r c665ed80227c76001c0a2e767e66d992ed72b4ad static/scripts/mvc/ui/ui-table.js --- a/static/scripts/mvc/ui/ui-table.js +++ b/static/scripts/mvc/ui/ui-table.js @@ -17,7 +17,7 @@ onchange : null, ondblclick : null, onconfirm : null, - cls : '' + cls : 'ui-table' }, // events @@ -198,12 +198,11 @@ }, // load html template - _template: function(options) - { + _template: function(options) { return '<div>' + - '<table class="ui-table ' + options.cls + '">' + + '<table class="' + options.cls + '">' + '<thead></thead>' + - '<tbody style="cursor: pointer;"></tbody>' + + '<tbody></tbody>' + '</table>' + '<tmessage>' + options.content + '</tmessage>' + '<div>'; diff -r 261471d0476328d8bbdbe71b9d6a954abf032ad7 -r c665ed80227c76001c0a2e767e66d992ed72b4ad static/scripts/mvc/ui/ui-tabs.js --- a/static/scripts/mvc/ui/ui-tabs.js +++ b/static/scripts/mvc/ui/ui-tabs.js @@ -2,8 +2,7 @@ define(['utils/utils'], function(Utils) { // return -var View = Backbone.View.extend( -{ +var View = Backbone.View.extend({ // defaults options optionsDefault: { title_new : '', @@ -65,6 +64,11 @@ } }, + // size + size: function() { + return _.size(this.list); + }, + // append add: function(options) { // self diff -r 261471d0476328d8bbdbe71b9d6a954abf032ad7 -r c665ed80227c76001c0a2e767e66d992ed72b4ad static/scripts/packed/galaxy.menu.js --- a/static/scripts/packed/galaxy.menu.js +++ b/static/scripts/packed/galaxy.menu.js @@ -1,1 +1,1 @@ -define(["galaxy.masthead"],function(b){var a=Backbone.Model.extend({options:null,masthead:null,initialize:function(c){this.options=c.config;this.masthead=c.masthead;this.create()},create:function(){var e=new b.GalaxyMastheadTab({id:"analysis",title:"Analyze Data",content:"root/index",title_attribute:"Analysis home view"});this.masthead.append(e);var g={id:"workflow",title:"Workflow",content:"workflow",title_attribute:"Chain tools into workflows"};if(!this.options.user.valid){g.disabled=true}var d=new b.GalaxyMastheadTab(g);this.masthead.append(d);var i=new b.GalaxyMastheadTab({id:"shared",title:"Shared Data",content:"library/index",title_attribute:"Access published resources"});i.add({title:"Data Libraries",content:"library/index"});i.add({title:"Data Libraries Beta",content:"library/list",divider:true});i.add({title:"Published Histories",content:"history/list_published"});i.add({title:"Published Workflows",content:"workflow/list_published"});i.add({title:"Published Visualizations",content:"visualization/list_published"});i.add({title:"Published Pages",content:"page/list_published"});this.masthead.append(i);if(this.options.user.requests){var j=new b.GalaxyMastheadTab({id:"lab",title:"Lab"});j.add({title:"Sequencing Requests",content:"requests/index"});j.add({title:"Find Samples",content:"requests/find_samples_index"});j.add({title:"Help",content:this.options.lims_doc_url});this.masthead.append(j)}var c={id:"visualization",title:"Visualization",content:"visualization/list",title_attribute:"Visualize datasets"};if(!this.options.user.valid){c.disabled=true}var m=new b.GalaxyMastheadTab(c);if(this.options.user.valid){m.add({title:"New Track Browser",content:"visualization/trackster",target:"_frame"});m.add({title:"Saved Visualizations",content:"visualization/list",target:"_frame"})}this.masthead.append(m);if(this.options.enable_cloud_launch){var f=new b.GalaxyMastheadTab({id:"cloud",title:"Cloud",content:"cloudlaunch/index"});f.add({title:"New Cloud Cluster",content:"cloudlaunch/index"});this.masthead.append(f)}if(this.options.is_admin_user){var h=new b.GalaxyMastheadTab({id:"admin",title:"Admin",content:"admin/index",extra_class:"admin-only",title_attribute:"Administer this Galaxy"});this.masthead.append(h)}var l=new b.GalaxyMastheadTab({id:"help",title:"Help",title_attribute:"Support, contact, and community hubs"});if(this.options.biostar_url){l.add({title:"Galaxy Biostar",content:this.options.biostar_url_redirect,target:"_blank"});l.add({title:"Ask a question",content:"biostar/biostar_question_redirect",target:"_blank"})}l.add({title:"Support",content:this.options.support_url,target:"_blank"});l.add({title:"Search",content:this.options.search_url,target:"_blank"});l.add({title:"Mailing Lists",content:this.options.mailing_lists,target:"_blank"});l.add({title:"Videos",content:this.options.screencasts_url,target:"_blank"});l.add({title:"Wiki",content:this.options.wiki_url,target:"_blank"});l.add({title:"How to Cite Galaxy",content:this.options.citation_url,target:"_blank"});if(this.options.terms_url){l.add({title:"Terms and Conditions",content:this.options.terms_url,target:"_blank"})}this.masthead.append(l);if(!this.options.user.valid){var k=new b.GalaxyMastheadTab({id:"user",title:"User",extra_class:"loggedout-only",title_attribute:"Account registration or login"});k.add({title:"Login",content:"user/login",target:"galaxy_main"});if(this.options.allow_user_creation){k.add({title:"Register",content:"user/create",target:"galaxy_main"})}this.masthead.append(k)}else{var k=new b.GalaxyMastheadTab({id:"user",title:"User",extra_class:"loggedin-only",title_attribute:"Account preferences and saved data"});k.add({title:"Logged in as "+this.options.user.email});if(this.options.use_remote_user&&this.options.remote_user_logout_href){k.add({title:"Logout",content:this.options.remote_user_logout_href,target:"_top"})}else{k.add({title:"Preferences",content:"user?cntrller=user",target:"galaxy_main"});k.add({title:"Custom Builds",content:"user/dbkeys",target:"galaxy_main"});k.add({title:"Logout",content:"user/logout",target:"_top",divider:true})}k.add({title:"Saved Histories",content:"history/list",target:"galaxy_main"});k.add({title:"Saved Datasets",content:"dataset/list",target:"galaxy_main"});k.add({title:"Saved Pages",content:"page/list",target:"_top"});k.add({title:"API Keys",content:"user/api_keys?cntrller=user",target:"galaxy_main"});if(this.options.use_remote_user){k.add({title:"Public Name",content:"user/edit_username?cntrller=user",target:"galaxy_main"})}this.masthead.append(k)}if(this.options.active_view){this.masthead.highlight(this.options.active_view)}}});return{GalaxyMenu:a}}); \ No newline at end of file +define(["galaxy.masthead"],function(b){var a=Backbone.Model.extend({options:null,masthead:null,initialize:function(c){this.options=c.config;this.masthead=c.masthead;this.create()},create:function(){var e=new b.GalaxyMastheadTab({id:"analysis",title:"Analyze Data",content:"root/index",title_attribute:"Analysis home view"});this.masthead.append(e);var g={id:"workflow",title:"Workflow",content:"workflow",title_attribute:"Chain tools into workflows"};if(!this.options.user.valid){g.disabled=true}var d=new b.GalaxyMastheadTab(g);this.masthead.append(d);var i=new b.GalaxyMastheadTab({id:"shared",title:"Shared Data",content:"library/index",title_attribute:"Access published resources"});i.add({title:"Data Libraries",content:"library/index"});i.add({title:"Data Libraries Beta",content:"library/list",divider:true});i.add({title:"Published Histories",content:"history/list_published"});i.add({title:"Published Workflows",content:"workflow/list_published"});i.add({title:"Published Visualizations",content:"visualization/list_published"});i.add({title:"Published Pages",content:"page/list_published"});this.masthead.append(i);if(this.options.user.requests){var j=new b.GalaxyMastheadTab({id:"lab",title:"Lab"});j.add({title:"Sequencing Requests",content:"requests/index"});j.add({title:"Find Samples",content:"requests/find_samples_index"});j.add({title:"Help",content:this.options.lims_doc_url});this.masthead.append(j)}var c={id:"visualization",title:"Visualization",content:"visualization/list",title_attribute:"Visualize datasets"};if(!this.options.user.valid){c.disabled=true}var m=new b.GalaxyMastheadTab(c);if(this.options.user.valid){m.add({title:"New Track Browser",content:"visualization/trackster",target:"_frame"});m.add({title:"Saved Visualizations",content:"visualization/list",target:"_frame"})}this.masthead.append(m);if(this.options.enable_cloud_launch){var f=new b.GalaxyMastheadTab({id:"cloud",title:"Cloud",content:"cloudlaunch/index"});f.add({title:"New Cloud Cluster",content:"cloudlaunch/index"});this.masthead.append(f)}if(this.options.is_admin_user){var h=new b.GalaxyMastheadTab({id:"admin",title:"Admin",content:"admin/index",extra_class:"admin-only",title_attribute:"Administer this Galaxy"});this.masthead.append(h)}var l=new b.GalaxyMastheadTab({id:"help",title:"Help",title_attribute:"Support, contact, and community hubs"});if(this.options.biostar_url){l.add({title:"Galaxy Biostar",content:this.options.biostar_url_redirect,target:"_blank"});l.add({title:"Ask a question",content:"biostar/biostar_question_redirect",target:"_blank"})}l.add({title:"Support",content:this.options.support_url,target:"_blank"});l.add({title:"Search",content:this.options.search_url,target:"_blank"});l.add({title:"Mailing Lists",content:this.options.mailing_lists,target:"_blank"});l.add({title:"Videos",content:this.options.screencasts_url,target:"_blank"});l.add({title:"Wiki",content:this.options.wiki_url,target:"_blank"});l.add({title:"How to Cite Galaxy",content:this.options.citation_url,target:"_blank"});if(this.options.terms_url){l.add({title:"Terms and Conditions",content:this.options.terms_url,target:"_blank"})}this.masthead.append(l);if(!this.options.user.valid){var k=new b.GalaxyMastheadTab({id:"user",title:"User",extra_class:"loggedout-only",title_attribute:"Account registration or login"});k.add({title:"Login",content:"user/login",target:"galaxy_main"});if(this.options.allow_user_creation){k.add({title:"Register",content:"user/create",target:"galaxy_main"})}this.masthead.append(k)}else{var k=new b.GalaxyMastheadTab({id:"user",title:"User",extra_class:"loggedin-only",title_attribute:"Account preferences and saved data"});k.add({title:"Logged in as "+this.options.user.email});k.add({title:"Preferences",content:"user?cntrller=user",target:"galaxy_main"});k.add({title:"Custom Builds",content:"user/dbkeys",target:"galaxy_main"});k.add({title:"Logout",content:"user/logout",target:"_top",divider:true});k.add({title:"Saved Histories",content:"history/list",target:"galaxy_main"});k.add({title:"Saved Datasets",content:"dataset/list",target:"galaxy_main"});k.add({title:"Saved Pages",content:"page/list",target:"_top"});k.add({title:"API Keys",content:"user/api_keys?cntrller=user",target:"galaxy_main"});if(this.options.use_remote_user){k.add({title:"Public Name",content:"user/edit_username?cntrller=user",target:"galaxy_main"})}this.masthead.append(k)}if(this.options.active_view){this.masthead.highlight(this.options.active_view)}}});return{GalaxyMenu:a}}); \ No newline at end of file diff -r 261471d0476328d8bbdbe71b9d6a954abf032ad7 -r c665ed80227c76001c0a2e767e66d992ed72b4ad 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(["mvc/ui/ui-portlet","mvc/ui/ui-table","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-datasets"],function(f,i,j,h,a,e,c,g){var d=Backbone.Model.extend({initialize:function(k){this.url=galaxy_config.root+"api/tools/"+k.id+"?io_details=true"}});var b=Backbone.View.extend({main_el:"body",initialize:function(l){var k=this;this.options=l;this.model=new d({id:l.id});this.datasets=new g({success:function(){k._initializeToolForm()}})},_initializeToolForm:function(){var k=this;this.model.fetch({success:function(){k.inputs=k.model.get("inputs");k.portlet=new f.View({icon:"fa-wrench",title:"<b>"+k.model.get("name")+"</b> "+k.model.get("description"),buttons:{execute:new j.ButtonIcon({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",floating:"clear",onclick:function(){}})}});k.table=new i.View();k.message=new j.Message();k.portlet.append(k.message.$el);$(k.main_el).append(k.portlet.$el);if(k.options.help!=""){$(k.main_el).append(c.help(k.options.help))}if(k.options.citations){$(k.main_el).append(c.citations());var l=new h.ToolCitationCollection();l.tool_id=k.options.id;var m=new a.CitationListView({collection:l});m.render();l.fetch()}k.setElement(k.portlet.content());k.portlet.append(k.table.$el);k.render()}})},render:function(){this.table.delAll();this.field_list={};this.inputs_sequential={};var k=new Backbone.Model();for(var l in this.inputs){this._add(this.inputs[l],k)}for(var l in this.field_list){this.field_list[l].trigger("change")}},_add:function(l,p){var n=l.type;switch(n){case"conditional":l.label=l.test_param.label;l.name=l.test_param.name;this._addRow("conditional",l,p);for(var m in l.cases){var o=l.cases[m];for(var k in o.inputs){this._add(o.inputs[k],p)}}break;default:this._addRow(n,l,p)}},_addRow:function(n,k,l){var p=k.name;var m=null;switch(n){case"text":m=this._field_text(k,l);break;case"select":m=this._field_select(k,l);break;case"radiobutton":m=this._field_radio(k,l);break;case"data":m=this._field_data(k,l);break;case"data_column":m=this._field_column(k,l);break;case"textarea":m=this._field_textarea(k,l);break;case"conditional":m=this._field_conditional(k,l);break}if(!m){console.debug("tools-form::_addRow() : Unmatched field type ("+n+").");return}if(!l.get(p)){l.set(p,k.value)}m.value(l.get(p));this.field_list[p]=m;this.inputs_sequential[p]=k;var o=$("<div/>");o.append(m.$el);if(k.info){o.append('<div class="ui-table-form-info">'+k.info+"</div>")}this.table.add('<span class="ui-table-form-title">'+k.label+"</span>","25%");this.table.add(o);this.table.append(p);if(k.hide){this.table.get(p).hide()}},_field_text:function(k,l){var m=k.name;return new j.Input({id:"field-"+m,value:l.get(m),onchange:function(n){l.set(m,n)}})},_field_textarea:function(k,l){var m=k.name;return new j.Textarea({id:"field-"+m,onchange:function(){l.set(m,field.value())}})},_field_conditional:function(m,p){var k=this;var l=[];for(var n in m.test_param.options){var o=m.test_param.options[n];l.push({label:o[0],value:o[1]})}var q=m.name;return new j.Select.View({id:"field-"+q,data:l,value:p.get(q),onchange:function(u){p.set(q,u);function t(x,w){for(var A in x.inputs){var z=x.inputs[A];var v=z.name;var B=k.table.get(v);if(w){B.fadeIn()}else{B.hide()}if(z.type=="conditional"){for(var y in z.cases){t(z.cases[y],w)}}}}for(var s in m.cases){var r=m.cases[s];t(r,r.value==u)}}})},_field_data:function(m,p){var k=this;var q=m.name;var o=this.datasets.filterType();var l=[];for(var n in o){l.push({label:o[n].get("name"),value:o[n].get("id")})}return new j.Select.View({id:"field-"+q,data:l,value:l[0].value,onchange:function(w){p.set(q,w);var s=_.where(k.inputs_sequential,{data_ref:q,type:"data_column"});var y=k.datasets.filter(w);if(y&&s.length>0){console.debug("tool-form::field_data() - Selected dataset "+w+".");var x=y.get("metadata_column_types");if(!x){console.debug("tool-form::field_data() - FAILED: Could not find metadata for dataset "+w+".")}var v=[];for(var u in x){v.push({label:"Column: "+(parseInt(u)+1)+" ["+x[u]+"]",value:u})}for(var t in s){var r=k.field_list[s[t].name];if(r){r.update(v);r.value(r.first())}}}else{console.debug("tool-form::field_data() - FAILED: Could not find dataset "+w+".")}}})},_field_column:function(l,o){var k=[];for(var m in l.options){var n=l.options[m];k.push({label:n[0],value:n[1]})}var p=l.name;return new j.Select.View({id:"field-"+p,data:k,value:o.get(p),onchange:function(q){o.set(p,q)}})},_field_select:function(l,p){var k=[];for(var m in l.options){var n=l.options[m];k.push({label:n[0],value:n[1]})}var o=j.Select;if(l.display=="checkboxes"){o=j.Checkbox}var q=l.name;return new o.View({id:"field-"+q,data:k,value:p.get(q),onchange:function(r){p.set(q,r)}})},_field_radio:function(k,l){var m=k.name;return new j.RadioButton({id:"field-"+m,data:k.data,value:l.get(m),onchange:function(n){l.set(m,n)}})}});return{View:b}}); \ No newline at end of file +define(["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-datasets","mvc/tools/tools-section"],function(f,j,h,a,e,c,g,i){var d=Backbone.Model.extend({initialize:function(k){this.url=galaxy_config.root+"api/tools/"+k.id+"?io_details=true"}});var b=Backbone.View.extend({main_el:"body",initialize:function(l){var k=this;this.options=l;this.model=new d({id:l.id});this.datasets=new g({success:function(){k._initializeToolForm()}})},_initializeToolForm:function(){this.field_list={};this.inputs_sequential={};var k=this;this.model.fetch({error:function(l){console.debug("tools-form::_initializeToolForm() : Attempt to fetch tool model failed.")},success:function(){k.inputs=k.model.get("inputs");k.portlet=new f.View({icon:"fa-wrench",title:"<b>"+k.model.get("name")+"</b> "+k.model.get("description"),buttons:{execute:new j.ButtonIcon({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",floating:"clear",onclick:function(){}})}});k.message=new j.Message();k.portlet.append(k.message.$el);$(k.main_el).append(k.portlet.$el);if(k.options.help!=""){$(k.main_el).append(c.help(k.options.help))}if(k.options.citations){$(k.main_el).append(c.citations());var l=new h.ToolCitationCollection();l.tool_id=k.options.id;var m=new a.CitationListView({collection:l});m.render();l.fetch()}k.setElement(k.portlet.content());k.section=new i.View(k,{inputs:k.model.get("inputs")});k.portlet.append(k.section.$el)}})}});return{View:b}}); \ No newline at end of file diff -r 261471d0476328d8bbdbe71b9d6a954abf032ad7 -r c665ed80227c76001c0a2e767e66d992ed72b4ad static/scripts/packed/mvc/tools/tools-section.js --- /dev/null +++ b/static/scripts/packed/mvc/tools/tools-section.js @@ -0,0 +1,1 @@ +define(["mvc/ui/ui-table","mvc/ui/ui-misc","mvc/ui/ui-tabs"],function(b,d,a){var c=Backbone.View.extend({initialize:function(f,e){this.app=f;this.inputs=e.inputs;this.datasets=f.datasets;this.table=new b.View(e);this.setElement(this.table.$el);this.render()},render:function(){this.table.delAll();var e=new Backbone.Model();for(var f in this.inputs){this._add(this.inputs[f],e)}for(var f in this.app.field_list){this.app.field_list[f].trigger("change")}},_add:function(f,k){var e=this;var j=f.type;switch(j){case"conditional":f.label=f.test_param.label;f.name=f.test_param.name;this._addRow("conditional",f,k);for(var h in f.cases){var l=new c(this.app,{inputs:f.cases[h].inputs,cls:"ui-table-plain"});this.table.add("");this.table.add(l.$el);this.table.append(f.name+"_formsection_"+h)}break;case"repeat":var g=new a.View({title_new:"Add Group",onnew:function(){var m=new c(e.app,{inputs:f.inputs,cls:"ui-table-plain"});var i=f.name+"_formsection_"+g.size();g.add({id:i,title:"Repeat",$el:m.$el,ondel:function(){g.del(i)}});g.show(i)}});this.table.add(f.title);this.table.add(g.$el);this.table.append(f.name);break;default:this._addRow(j,f,k)}},_addRow:function(h,e,f){var j=e.name;var g=null;switch(h){case"text":g=this._field_text(e,f);break;case"select":g=this._field_select(e,f);break;case"radiobutton":g=this._field_radio(e,f);break;case"data":g=this._field_data(e,f);break;case"data_column":g=this._field_column(e,f);break;case"textarea":g=this._field_textarea(e,f);break;case"conditional":g=this._field_conditional(e,f);break}if(!g){console.debug("tools-form::_addRow() : Unmatched field type ("+h+").");return}if(!f.get(j)){f.set(j,e.value)}g.value(f.get(j));this.app.field_list[j]=g;this.app.inputs_sequential[j]=e;var i=$("<div/>");i.append(g.$el);if(e.help){i.append('<div class="ui-table-form-info">'+e.help+"</div>")}this.table.add('<span class="ui-table-form-title">'+e.label+"</span>","25%");this.table.add(i);this.table.append(j);if(e.hide){this.table.get(j).hide()}},_field_text:function(e,f){var g=e.name;return new d.Input({id:"field-"+g,value:f.get(g),onchange:function(h){f.set(g,h)}})},_field_textarea:function(e,f){var g=e.name;return new d.Textarea({id:"field-"+g,onchange:function(){f.set(g,field.value())}})},_field_conditional:function(g,k){var e=this;var f=[];for(var h in g.test_param.options){var j=g.test_param.options[h];f.push({label:j[0],value:j[1]})}var l=g.name;return new d.Select.View({id:"field-"+l,data:f,value:k.get(l),onchange:function(q){k.set(l,q);for(var p in g.cases){var n=g.cases[p];var o=g.name+"_formsection_"+p;var m=e.table.get(o);if(n.value==q){m.show()}else{m.hide()}}}})},_field_data:function(g,k){var e=this;var l=g.name;var j=this.datasets.filterType();var f=[];for(var h in j){f.push({label:j[h].get("name"),value:j[h].get("id")})}return new d.Select.View({id:"field-"+l,data:f,value:f[0].value,onchange:function(r){k.set(l,r);var n=_.where(e.app.inputs_sequential,{data_ref:l,type:"data_column"});var t=e.datasets.filter(r);if(t&&n.length>0){console.debug("tool-form::field_data() - Selected dataset "+r+".");var s=t.get("metadata_column_types");if(!s){console.debug("tool-form::field_data() - FAILED: Could not find metadata for dataset "+r+".")}var q=[];for(var p in s){q.push({label:"Column: "+(parseInt(p)+1)+" ["+s[p]+"]",value:p})}for(var o in n){var m=e.app.field_list[n[o].name];if(m){m.update(q);m.value(m.first())}}}else{console.debug("tool-form::field_data() - FAILED: Could not find dataset "+r+".")}}})},_field_column:function(e,f){var g=e.name;return new d.Select.View({id:"field-"+g,value:f.get(g),onchange:function(h){f.set(g,h)}})},_field_select:function(f,k){var e=[];for(var g in f.options){var h=f.options[g];e.push({label:h[0],value:h[1]})}var j=d.Select;if(f.display=="checkboxes"){j=d.Checkbox}var l=f.name;return new j.View({id:"field-"+l,data:e,value:k.get(l),onchange:function(i){k.set(l,i)}})},_field_radio:function(e,f){var g=e.name;return new d.RadioButton({id:"field-"+g,data:e.data,value:f.get(g),onchange:function(h){f.set(g,h)}})}});return{View:c}}); \ No newline at end of file diff -r 261471d0476328d8bbdbe71b9d6a954abf032ad7 -r c665ed80227c76001c0a2e767e66d992ed72b4ad static/scripts/packed/mvc/ui/ui-table.js --- a/static/scripts/packed/mvc/ui/ui-table.js +++ b/static/scripts/packed/mvc/ui/ui-table.js @@ -1,1 +1,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}}); \ No newline at end of file +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:"ui-table"},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="'+c.cls+'"><thead></thead><tbody></tbody></table><tmessage>'+c.content+"</tmessage><div>"}});return{View:b}}); \ No newline at end of file diff -r 261471d0476328d8bbdbe71b9d6a954abf032ad7 -r c665ed80227c76001c0a2e767e66d992ed72b4ad static/scripts/packed/mvc/ui/ui-tabs.js --- a/static/scripts/packed/mvc/ui/ui-tabs.js +++ b/static/scripts/packed/mvc/ui/ui-tabs.js @@ -1,1 +1,1 @@ -define(["utils/utils"],function(a){var b=Backbone.View.extend({optionsDefault:{title_new:"",operations:null,onnew:null},initialize:function(e){this.visible=false;this.$nav=null;this.$content=null;this.first_tab=null;this.options=a.merge(e,this.optionsDefault);var c=$(this._template(this.options));this.$nav=c.find(".tab-navigation");this.$content=c.find(".tab-content");this.setElement(c);this.list={};var d=this;if(this.options.operations){$.each(this.options.operations,function(g,h){h.$el.prop("id",g);d.$nav.find(".operations").append(h.$el)})}if(this.options.onnew){var f=$(this._template_tab_new(this.options));this.$nav.append(f);f.tooltip({title:"Add a new tab",placement:"bottom",container:d.$el});f.on("click",function(g){f.tooltip("hide");d.options.onnew()})}},add:function(f){var e=this;var h=f.id;var g=$(this._template_tab(f));var d=$(this._template_tab_content(f));this.list[h]=f.ondel?true:false;if(this.options.onnew){this.$nav.find("#new-tab").before(g)}else{this.$nav.append(g)}d.append(f.$el);this.$content.append(d);if(_.size(this.list)==1){g.addClass("active");d.addClass("active");this.first_tab=h}if(f.ondel){var c=g.find("#delete");c.tooltip({title:"Delete this tab",placement:"bottom",container:e.$el});c.on("click",function(){c.tooltip("destroy");e.$el.find(".tooltip").remove();f.ondel();return false})}g.on("click",function(i){i.preventDefault();if(f.onclick){f.onclick()}else{e.show(h)}})},del:function(c){this.$el.find("#tab-"+c).remove();this.$el.find("#tab-content-"+c).remove();if(this.first_tab==c){this.first_tab=null}if(this.first_tab!=null){this.show(this.first_tab)}},delRemovable:function(){for(var c in this.list){if(this.list[c]){this.del(c)}}},show:function(c){this.$el.fadeIn("fast");this.visible=true;if(c){this.$el.find(".tab-element").removeClass("active");this.$el.find(".tab-pane").removeClass("active");this.$el.find("#tab-"+c).addClass("active");this.$el.find("#tab-content-"+c).addClass("active")}},hide:function(){this.$el.fadeOut("fast");this.visible=false},hideOperation:function(c){this.$nav.find("#"+c).hide()},showOperation:function(c){this.$nav.find("#"+c).show()},setOperation:function(e,d){var c=this.$nav.find("#"+e);c.off("click");c.on("click",d)},title:function(e,d){var c=this.$el.find("#tab-title-text-"+e);if(d){c.html(d)}return c.html()},_template:function(c){return'<div class="ui-tabs tabbable tabs-left"><ul id="tab-navigation" class="tab-navigation nav nav-tabs"><div class="operations" style="float: right; margin-bottom: 4px;"></div></ul><div id="tab-content" class="tab-content"/></div>'},_template_tab_new:function(c){return'<li id="new-tab"><a href="javascript:void(0);"><i class="ui-tabs-add fa fa-plus-circle"/>'+c.title_new+"</a></li>"},_template_tab:function(d){var c='<li id="tab-'+d.id+'" class="tab-element"><a id="tab-title-link-'+d.id+'" title="" href="#tab-content-'+d.id+'" data-original-title=""><span id="tab-title-text-'+d.id+'">'+d.title+"</span>";if(d.ondel){c+='<i id="delete" class="ui-tabs-delete fa fa-minus-circle"/>'}c+="</a></li>";return c},_template_tab_content:function(c){return'<div id="tab-content-'+c.id+'" class="tab-pane"/>'}});return{View:b}}); \ No newline at end of file +define(["utils/utils"],function(a){var b=Backbone.View.extend({optionsDefault:{title_new:"",operations:null,onnew:null},initialize:function(e){this.visible=false;this.$nav=null;this.$content=null;this.first_tab=null;this.options=a.merge(e,this.optionsDefault);var c=$(this._template(this.options));this.$nav=c.find(".tab-navigation");this.$content=c.find(".tab-content");this.setElement(c);this.list={};var d=this;if(this.options.operations){$.each(this.options.operations,function(g,h){h.$el.prop("id",g);d.$nav.find(".operations").append(h.$el)})}if(this.options.onnew){var f=$(this._template_tab_new(this.options));this.$nav.append(f);f.tooltip({title:"Add a new tab",placement:"bottom",container:d.$el});f.on("click",function(g){f.tooltip("hide");d.options.onnew()})}},size:function(){return _.size(this.list)},add:function(f){var e=this;var h=f.id;var g=$(this._template_tab(f));var d=$(this._template_tab_content(f));this.list[h]=f.ondel?true:false;if(this.options.onnew){this.$nav.find("#new-tab").before(g)}else{this.$nav.append(g)}d.append(f.$el);this.$content.append(d);if(_.size(this.list)==1){g.addClass("active");d.addClass("active");this.first_tab=h}if(f.ondel){var c=g.find("#delete");c.tooltip({title:"Delete this tab",placement:"bottom",container:e.$el});c.on("click",function(){c.tooltip("destroy");e.$el.find(".tooltip").remove();f.ondel();return false})}g.on("click",function(i){i.preventDefault();if(f.onclick){f.onclick()}else{e.show(h)}})},del:function(c){this.$el.find("#tab-"+c).remove();this.$el.find("#tab-content-"+c).remove();if(this.first_tab==c){this.first_tab=null}if(this.first_tab!=null){this.show(this.first_tab)}},delRemovable:function(){for(var c in this.list){if(this.list[c]){this.del(c)}}},show:function(c){this.$el.fadeIn("fast");this.visible=true;if(c){this.$el.find(".tab-element").removeClass("active");this.$el.find(".tab-pane").removeClass("active");this.$el.find("#tab-"+c).addClass("active");this.$el.find("#tab-content-"+c).addClass("active")}},hide:function(){this.$el.fadeOut("fast");this.visible=false},hideOperation:function(c){this.$nav.find("#"+c).hide()},showOperation:function(c){this.$nav.find("#"+c).show()},setOperation:function(e,d){var c=this.$nav.find("#"+e);c.off("click");c.on("click",d)},title:function(e,d){var c=this.$el.find("#tab-title-text-"+e);if(d){c.html(d)}return c.html()},_template:function(c){return'<div class="ui-tabs tabbable tabs-left"><ul id="tab-navigation" class="tab-navigation nav nav-tabs"><div class="operations" style="float: right; margin-bottom: 4px;"></div></ul><div id="tab-content" class="tab-content"/></div>'},_template_tab_new:function(c){return'<li id="new-tab"><a href="javascript:void(0);"><i class="ui-tabs-add fa fa-plus-circle"/>'+c.title_new+"</a></li>"},_template_tab:function(d){var c='<li id="tab-'+d.id+'" class="tab-element"><a id="tab-title-link-'+d.id+'" title="" href="#tab-content-'+d.id+'" data-original-title=""><span id="tab-title-text-'+d.id+'">'+d.title+"</span>";if(d.ondel){c+='<i id="delete" class="ui-tabs-delete fa fa-minus-circle"/>'}c+="</a></li>";return c},_template_tab_content:function(c){return'<div id="tab-content-'+c.id+'" class="tab-pane"/>'}});return{View:b}}); \ No newline at end of file diff -r 261471d0476328d8bbdbe71b9d6a954abf032ad7 -r c665ed80227c76001c0a2e767e66d992ed72b4ad static/style/blue/base.css --- a/static/style/blue/base.css +++ b/static/style/blue/base.css @@ -1279,6 +1279,9 @@ .upload-ftp .upload-ftp-warning{text-align:center;margin-top:20px} .upload-settings .upload-settings-cover{position:absolute;width:100%;height:100%;top:0px;left:0px;background:#fff;opacity:0.4;cursor:no-drop} .ui-radiobutton label{height:23px;line-height:1em} +.ui-table tbody{cursor:pointer} +.ui-table-plain tbody td{padding:5px 0px 5px 5px !important;border:none !important} +.ui-table-plain tbody{cursor:auto !important} .ui-table-form-separator{font-weight:bold;font-size:0.9em} .ui-label{font-weight:bold} .ui-message{padding:2px 2px 2px 10px} @@ -1528,13 +1531,13 @@ .grid-header{padding-bottom:1em} .grid-header h2{margin:0;margin-bottom:0.5em} .grid-header .title{font-weight:bold} -.grid,.ui-table{padding-top:1em;border-collapse:collapse;width:100%} +.grid,.ui-table,.ui-table-plain{padding-top:1em;border-collapse:collapse;width:100%} .grid tbody td,.ui-table tbody td{line-height:1.428571429;border-top:solid #DDDDDD 1px;border-bottom:solid #DDDDDD 1px;padding:5px} .grid tbody td:empty{padding:0} .grid thead tr{height:2em} .grid thead th{line-height:1.428571429;background:#ebd9b2;color:#000;border-top:solid #d6b161 1px;border-bottom:solid #d6b161 1px;padding:5px;text-align:left;white-space:nowrap} .grid tfoot td{background-color:#F8F8F8;border-top:solid #DDDDDD 1px;border-bottom:solid #DDDDDD 1px;padding:5px} -.grid .current,.ui-table .current{background-color:#EEEEFF} +.grid .current{background-color:#EEEEFF} .count-box{min-width:1.1em;padding:5px;border-width:1px;border-style:solid;text-align:center;display:inline-block} .text-filter-val{border:solid 1px #AAAAAA;padding:1px 2px 1px 3px;margin-right:5px;-moz-border-radius:.5em;-webkit-border-radius:.5em;font-style:italic} .page-link a,.inactive-link{padding:0px 7px 0px 7px;color:#555} diff -r 261471d0476328d8bbdbe71b9d6a954abf032ad7 -r c665ed80227c76001c0a2e767e66d992ed72b4ad static/style/src/less/ui.less --- a/static/style/src/less/ui.less +++ b/static/style/src/less/ui.less @@ -11,8 +11,22 @@ tbody td { &:extend(.grid tbody td); } - .current { - &:extend(.grid .current); + + tbody { + cursor: pointer; + } +} + +.ui-table-plain { + &:extend(.grid); + + tbody td { + padding: 5px 0px 5px 5px !important; + border: none !important; + } + + tbody { + cursor: auto !important; } } 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.