vendor/assets/javascripts/webshims/shims/forms-picker.js in webshims-rails-1.14.5 vs vendor/assets/javascripts/webshims/shims/forms-picker.js in webshims-rails-1.14.6

- old
+ new

@@ -322,14 +322,11 @@ var curCfg = formcfg.__active || formcfg['']; var stopPropagation = function(e){ e.stopImmediatePropagation(); }; var steps = options.steps; - - var mousePress = function(e){ - $(this)[e.type == 'mousepressstart' ? 'addClass' : 'removeClass']('mousepress-ui'); - }; + var getMonthNameHTML = function(index, year, prefix){ var dateCfg = curCfg.date; var str = []; if(!prefix){ prefix = ''; @@ -439,11 +436,11 @@ 'focusout': onBlur }); } }, 0); })(); - + var isDisabled = false; var spinEvents = {}; var spinElement = o.splitInput ? this.inputElements.filter('.ws-spin') : this.inputElements.eq(0); var elementEvts = { ws__blur: function(e){ if (!preventBlur(e) && !o.disabled && !o.readonly) { @@ -653,15 +650,28 @@ }; spinElement.on(spinEvents); } $(this.buttonWrapper) - .on('mousepressstart mousepressend', '.step-up, .step-down', mousePress) + .on('mousepressstart mousepressend', '.step-up, .step-down', function(e){ + var fn = 'removeClass'; + if(e.type == 'mousepressstart' && !isDisabled){ + fn = 'addClass'; + } + $(this)[fn]('mousepress-ui'); + }) .on('mousedown mousepress', '.step-up', function(e){ - step.stepUp(); + if(e.type == 'mousedown'){ + isDisabled = (o.disabled || o.readOnly || $.find.matchesSelector(that.orig, ':disabled')); + } + if(!isDisabled){ + step.stepUp(); + } }) .on('mousedown mousepress', '.step-down', function(e){ - step.stepDown(); + if(!isDisabled && !o.disabled && !o.readOnly){ + step.stepDown(); + } }) ; initChangeEvents(); } },