1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/12f6e12d91c9/ Changeset: 12f6e12d91c9 User: guerler Date: 2015-02-06 21:38:11+00:00 Summary: Ui: Fix slider value element Affected #: 3 files diff -r ec3778d1b8081f4790e14908a4b751d857d1789f -r 12f6e12d91c9756154235c9e75436476a2821fe5 client/galaxy/scripts/mvc/ui/ui-slider.js --- a/client/galaxy/scripts/mvc/ui/ui-slider.js +++ b/client/galaxy/scripts/mvc/ui/ui-slider.js @@ -11,21 +11,21 @@ precise : false, split : 10000 }, - + // initialize initialize : function(options) { // link this var self = this; - + // configure options this.options = Utils.merge(options, this.optionsDefault); - + // create new element this.setElement(this._template(this.options)); - + // determine wether to use the slider this.useslider = this.options.max !== null && this.options.min !== null && this.options.max > this.options.min; - + // set default step size if (this.options.step === null) { this.options.step = 1; @@ -33,7 +33,7 @@ this.options.step = (this.options.max - this.options.min) / this.options.split; } } - + // create slider if min and max are defined properly if (this.useslider) { this.$slider = this.$el.find('#slider'); @@ -44,20 +44,20 @@ } else { this.$el.find('.ui-form-slider-text').css('width', '100%'); } - + // link text input field this.$text = this.$el.find('#text'); - + // set initial value if (this.options.value !== undefined) { this.value(this.options.value); } - + // add text field event - this.$text.on('input', function () { - self.value($(this).val()); + this.$text.on('change', function () { + self.value($(this).val()); }); - + // add text field event var pressed = []; this.$text.on('keyup', function(e) { @@ -74,7 +74,7 @@ } }); }, - + // value value : function (new_val) { if (new_val !== undefined) { @@ -82,7 +82,7 @@ if (isNaN(new_val)) { new_val = 0; } - + // apply limit if (this.options.max !== null) { new_val = Math.min(new_val, this.options.max); @@ -90,21 +90,21 @@ if (this.options.min !== null) { new_val = Math.max(new_val, this.options.min); } - + + // set values + this.$slider && this.$slider.slider('value', new_val); + this.$text.val(new_val); + // trigger on change event if (this.options.onchange) { this.options.onchange(new_val); } - - // set values - this.$slider && this.$slider.slider('value', new_val); - this.$text.val(new_val); } - + // return current value return this.$text.val(); }, - + // element _template: function(options) { return '<div id="' + options.id + '" class="ui-form-slider">' + diff -r ec3778d1b8081f4790e14908a4b751d857d1789f -r 12f6e12d91c9756154235c9e75436476a2821fe5 static/scripts/mvc/ui/ui-slider.js --- a/static/scripts/mvc/ui/ui-slider.js +++ b/static/scripts/mvc/ui/ui-slider.js @@ -11,21 +11,21 @@ precise : false, split : 10000 }, - + // initialize initialize : function(options) { // link this var self = this; - + // configure options this.options = Utils.merge(options, this.optionsDefault); - + // create new element this.setElement(this._template(this.options)); - + // determine wether to use the slider this.useslider = this.options.max !== null && this.options.min !== null && this.options.max > this.options.min; - + // set default step size if (this.options.step === null) { this.options.step = 1; @@ -33,7 +33,7 @@ this.options.step = (this.options.max - this.options.min) / this.options.split; } } - + // create slider if min and max are defined properly if (this.useslider) { this.$slider = this.$el.find('#slider'); @@ -44,20 +44,20 @@ } else { this.$el.find('.ui-form-slider-text').css('width', '100%'); } - + // link text input field this.$text = this.$el.find('#text'); - + // set initial value if (this.options.value !== undefined) { this.value(this.options.value); } - + // add text field event - this.$text.on('input', function () { - self.value($(this).val()); + this.$text.on('change', function () { + self.value($(this).val()); }); - + // add text field event var pressed = []; this.$text.on('keyup', function(e) { @@ -74,7 +74,7 @@ } }); }, - + // value value : function (new_val) { if (new_val !== undefined) { @@ -82,7 +82,7 @@ if (isNaN(new_val)) { new_val = 0; } - + // apply limit if (this.options.max !== null) { new_val = Math.min(new_val, this.options.max); @@ -90,21 +90,21 @@ if (this.options.min !== null) { new_val = Math.max(new_val, this.options.min); } - + + // set values + this.$slider && this.$slider.slider('value', new_val); + this.$text.val(new_val); + // trigger on change event if (this.options.onchange) { this.options.onchange(new_val); } - - // set values - this.$slider && this.$slider.slider('value', new_val); - this.$text.val(new_val); } - + // return current value return this.$text.val(); }, - + // element _template: function(options) { return '<div id="' + options.id + '" class="ui-form-slider">' + diff -r ec3778d1b8081f4790e14908a4b751d857d1789f -r 12f6e12d91c9756154235c9e75436476a2821fe5 static/scripts/packed/mvc/ui/ui-slider.js --- a/static/scripts/packed/mvc/ui/ui-slider.js +++ b/static/scripts/packed/mvc/ui/ui-slider.js @@ -1,1 +1,1 @@ -define(["utils/utils"],function(a){var b=Backbone.View.extend({optionsDefault:{min:null,max:null,step:null,precise:false,split:10000},initialize:function(d){var c=this;this.options=a.merge(d,this.optionsDefault);this.setElement(this._template(this.options));this.useslider=this.options.max!==null&&this.options.min!==null&&this.options.max>this.options.min;if(this.options.step===null){this.options.step=1;if(this.options.precise&&this.useslider){this.options.step=(this.options.max-this.options.min)/this.options.split}}if(this.useslider){this.$slider=this.$el.find("#slider");this.$slider.slider(this.options);this.$slider.on("slide",function(f,g){c.value(g.value)})}else{this.$el.find(".ui-form-slider-text").css("width","100%")}this.$text=this.$el.find("#text");if(this.options.value!==undefined){this.value(this.options.value)}this.$text.on("input",function(){c.value($(this).val())});var e=[];this.$text.on("keyup",function(f){e[f.which]=false});this.$text.on("keydown",function(g){var f=g.which;e[f]=true;if(!(f==8||f==9||f==13||f==37||f==39||(f>=48&&f<=57)||(f==190&&$(this).val().indexOf(".")==-1&&c.options.precise)||(f==189&&$(this).val().indexOf("-")==-1)||e[91]||e[17])){event.preventDefault()}})},value:function(c){if(c!==undefined){if(isNaN(c)){c=0}if(this.options.max!==null){c=Math.min(c,this.options.max)}if(this.options.min!==null){c=Math.max(c,this.options.min)}if(this.options.onchange){this.options.onchange(c)}this.$slider&&this.$slider.slider("value",c);this.$text.val(c)}return this.$text.val()},_template:function(c){return'<div id="'+c.id+'" class="ui-form-slider"><input id="text" type="text" class="ui-form-slider-text"/><div id="slider" class="ui-form-slider-element"/></div>'}});return{View:b}}); \ No newline at end of file +define(["utils/utils"],function(a){var b=Backbone.View.extend({optionsDefault:{min:null,max:null,step:null,precise:false,split:10000},initialize:function(d){var c=this;this.options=a.merge(d,this.optionsDefault);this.setElement(this._template(this.options));this.useslider=this.options.max!==null&&this.options.min!==null&&this.options.max>this.options.min;if(this.options.step===null){this.options.step=1;if(this.options.precise&&this.useslider){this.options.step=(this.options.max-this.options.min)/this.options.split}}if(this.useslider){this.$slider=this.$el.find("#slider");this.$slider.slider(this.options);this.$slider.on("slide",function(f,g){c.value(g.value)})}else{this.$el.find(".ui-form-slider-text").css("width","100%")}this.$text=this.$el.find("#text");if(this.options.value!==undefined){this.value(this.options.value)}this.$text.on("change",function(){c.value($(this).val())});var e=[];this.$text.on("keyup",function(f){e[f.which]=false});this.$text.on("keydown",function(g){var f=g.which;e[f]=true;if(!(f==8||f==9||f==13||f==37||f==39||(f>=48&&f<=57)||(f==190&&$(this).val().indexOf(".")==-1&&c.options.precise)||(f==189&&$(this).val().indexOf("-")==-1)||e[91]||e[17])){event.preventDefault()}})},value:function(c){if(c!==undefined){if(isNaN(c)){c=0}if(this.options.max!==null){c=Math.min(c,this.options.max)}if(this.options.min!==null){c=Math.max(c,this.options.min)}this.$slider&&this.$slider.slider("value",c);this.$text.val(c);if(this.options.onchange){this.options.onchange(c)}}return this.$text.val()},_template:function(c){return'<div id="'+c.id+'" class="ui-form-slider"><input id="text" type="text" class="ui-form-slider-text"/><div id="slider" class="ui-form-slider-element"/></div>'}});return{View:b}}); \ 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.