1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/bda732e549b7/ Changeset: bda732e549b7 User: guerler Date: 2014-10-09 03:01:37+00:00 Summary: ToolForm: Highlight first error only Affected #: 3 files diff -r 386258341ae7da120bc5421bb62ece96e7c32624 -r bda732e549b775718e31423c175a2f415f18a7b7 client/galaxy/scripts/mvc/tools/tools-jobs.js --- a/client/galaxy/scripts/mvc/tools/tools-jobs.js +++ b/client/galaxy/scripts/mvc/tools/tools-jobs.js @@ -73,17 +73,11 @@ // mark error input_element.error(message || 'Please verify this parameter.'); - - // set flag - if (this.valid) { - // scroll to first input element - $(this.app.container).animate({ - scrollTop: input_element.$el.offset().top - 20 - }, 500); - - // set error flag - this.valid = false; - } + + // scroll to first input element + $(this.app.container).animate({ + scrollTop: input_element.$el.offset().top - 20 + }, 500); }, /** Validate job definition @@ -92,9 +86,6 @@ // get input parameters var job_inputs = job_def.inputs; - // validation flag - this.valid = true; - // counter for values declared in batch mode var n_values = -1; @@ -111,6 +102,7 @@ // check basic field validation if (input_def && !input_def.optional && input_field && input_field.validate && !input_field.validate()) { this._foundError(input_id); + return false; } // check if input field is in batch mode @@ -121,6 +113,7 @@ } else { if (n_values !== n) { this._foundError(input_id, 'Please make sure that you select the same number of inputs for all batch mode fields. This field contains <b>' + n + '</b> selection(s) while a previous field contains <b>' + n_values + '</b>.'); + return false; } } } @@ -128,7 +121,7 @@ } // return validation result - return this.valid; + return true; }, /** Refreshes the history panel diff -r 386258341ae7da120bc5421bb62ece96e7c32624 -r bda732e549b775718e31423c175a2f415f18a7b7 static/scripts/mvc/tools/tools-jobs.js --- a/static/scripts/mvc/tools/tools-jobs.js +++ b/static/scripts/mvc/tools/tools-jobs.js @@ -73,17 +73,11 @@ // mark error input_element.error(message || 'Please verify this parameter.'); - - // set flag - if (this.valid) { - // scroll to first input element - $(this.app.container).animate({ - scrollTop: input_element.$el.offset().top - 20 - }, 500); - - // set error flag - this.valid = false; - } + + // scroll to first input element + $(this.app.container).animate({ + scrollTop: input_element.$el.offset().top - 20 + }, 500); }, /** Validate job definition @@ -92,9 +86,6 @@ // get input parameters var job_inputs = job_def.inputs; - // validation flag - this.valid = true; - // counter for values declared in batch mode var n_values = -1; @@ -111,6 +102,7 @@ // check basic field validation if (input_def && !input_def.optional && input_field && input_field.validate && !input_field.validate()) { this._foundError(input_id); + return false; } // check if input field is in batch mode @@ -121,6 +113,7 @@ } else { if (n_values !== n) { this._foundError(input_id, 'Please make sure that you select the same number of inputs for all batch mode fields. This field contains <b>' + n + '</b> selection(s) while a previous field contains <b>' + n_values + '</b>.'); + return false; } } } @@ -128,7 +121,7 @@ } // return validation result - return this.valid; + return true; }, /** Refreshes the history panel diff -r 386258341ae7da120bc5421bb62ece96e7c32624 -r bda732e549b775718e31423c175a2f415f18a7b7 static/scripts/packed/mvc/tools/tools-jobs.js --- a/static/scripts/packed/mvc/tools/tools-jobs.js +++ b/static/scripts/packed/mvc/tools/tools-jobs.js @@ -1,1 +1,1 @@ -define(["utils/utils","mvc/tools/tools-template"],function(b,a){return Backbone.Model.extend({initialize:function(d,c){this.app=d;this.options=b.merge(c,this.optionsDefault)},submit:function(){var c=this;var d={tool_id:this.app.options.id,inputs:this.app.tree.finalize()};this.app.reset();if(!this._validation(d)){console.debug("tools-jobs::submit - Submission canceled. Validation failed.");return}console.debug(d);this.app.modal.show({title:"Please wait...",body:"progress",buttons:{Close:function(){c.app.modal.hide()}}});b.request({type:"POST",url:galaxy_config.root+"api/tools",data:d,success:function(e){c.app.modal.hide();c.app.message(a.success(e));c._refreshHdas()},error:function(e,g){c.app.modal.hide();if(e&&e.message&&e.message.data){var h=c.app.tree.matchResponse(e.message.data);for(var f in h){c._foundError(f,h[f])}}else{console.debug(d);console.debug(e)}}})},_foundError:function(c,d){var e=this.app.element_list[c];e.error(d||"Please verify this parameter.");if(this.valid){$(this.app.container).animate({scrollTop:e.$el.offset().top-20},500);this.valid=false}},_validation:function(g){var c=g.inputs;this.valid=true;var k=-1;for(var i in c){var e=c[i];var j=this.app.tree.match(i);var d=this.app.field_list[j];var h=this.app.input_list[j];if(h&&!h.optional&&d&&d.validate&&!d.validate()){this._foundError(j)}if(e.batch){var f=e.values.length;if(k===-1){k=f}else{if(k!==f){this._foundError(j,"Please make sure that you select the same number of inputs for all batch mode fields. This field contains <b>"+f+"</b> selection(s) while a previous field contains <b>"+k+"</b>.")}}}}return this.valid},_refreshHdas:function(){if(parent.Galaxy&&parent.Galaxy.currHistoryPanel){parent.Galaxy.currHistoryPanel.refreshContents()}}})}); \ No newline at end of file +define(["utils/utils","mvc/tools/tools-template"],function(b,a){return Backbone.Model.extend({initialize:function(d,c){this.app=d;this.options=b.merge(c,this.optionsDefault)},submit:function(){var c=this;var d={tool_id:this.app.options.id,inputs:this.app.tree.finalize()};this.app.reset();if(!this._validation(d)){console.debug("tools-jobs::submit - Submission canceled. Validation failed.");return}console.debug(d);this.app.modal.show({title:"Please wait...",body:"progress",buttons:{Close:function(){c.app.modal.hide()}}});b.request({type:"POST",url:galaxy_config.root+"api/tools",data:d,success:function(e){c.app.modal.hide();c.app.message(a.success(e));c._refreshHdas()},error:function(e,g){c.app.modal.hide();if(e&&e.message&&e.message.data){var h=c.app.tree.matchResponse(e.message.data);for(var f in h){c._foundError(f,h[f])}}else{console.debug(d);console.debug(e)}}})},_foundError:function(c,d){var e=this.app.element_list[c];e.error(d||"Please verify this parameter.");$(this.app.container).animate({scrollTop:e.$el.offset().top-20},500)},_validation:function(g){var c=g.inputs;var k=-1;for(var i in c){var e=c[i];var j=this.app.tree.match(i);var d=this.app.field_list[j];var h=this.app.input_list[j];if(h&&!h.optional&&d&&d.validate&&!d.validate()){this._foundError(j);return false}if(e.batch){var f=e.values.length;if(k===-1){k=f}else{if(k!==f){this._foundError(j,"Please make sure that you select the same number of inputs for all batch mode fields. This field contains <b>"+f+"</b> selection(s) while a previous field contains <b>"+k+"</b>.");return false}}}}return true},_refreshHdas:function(){if(parent.Galaxy&&parent.Galaxy.currHistoryPanel){parent.Galaxy.currHistoryPanel.refreshContents()}}})}); \ No newline at end of file Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.