From 117166a553c70629fa4ddde81a4452f95bf07211 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 4 Sep 2014 16:44:39 +0800 Subject: [PATCH 1/4] Add funcationality to specify the amount the value should be incremented/decremented, ex: --- js/bootstrap-formhelpers-number.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/js/bootstrap-formhelpers-number.js b/js/bootstrap-formhelpers-number.js index 1aa5c6a..6b84c80 100644 --- a/js/bootstrap-formhelpers-number.js +++ b/js/bootstrap-formhelpers-number.js @@ -166,7 +166,10 @@ value = this.getValue(); - value = value + 1; + if(this.options.step == undefined) + value = value + 1; + else // if use has specified 'data-step' attribute in tag + value = value + this.options.step this.$element.val(value).change(); }, @@ -176,7 +179,10 @@ value = this.getValue(); - value = value - 1; + if(this.options.step == undefined) + value = value - 1; + else // if use has specified 'data-step' attribute in tag + value = value - this.options.step this.$element.val(value).change(); }, From 9d1a68c2c2dc5b5d88012e5d2c82db9c5b1bbda9 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 4 Sep 2014 17:36:38 +0800 Subject: [PATCH 2/4] Fix Cl build suggestion --- js/bootstrap-formhelpers-number.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/bootstrap-formhelpers-number.js b/js/bootstrap-formhelpers-number.js index 6b84c80..abfc275 100644 --- a/js/bootstrap-formhelpers-number.js +++ b/js/bootstrap-formhelpers-number.js @@ -166,10 +166,10 @@ value = this.getValue(); - if(this.options.step == undefined) + if(this.options.step === undefined) value = value + 1; else // if use has specified 'data-step' attribute in tag - value = value + this.options.step + value = value + this.options.step; this.$element.val(value).change(); }, @@ -179,10 +179,10 @@ value = this.getValue(); - if(this.options.step == undefined) + if(this.options.step === undefined) value = value - 1; else // if use has specified 'data-step' attribute in tag - value = value - this.options.step + value = value - this.options.step; this.$element.val(value).change(); }, From 5a7305ad4ff04ed45b9b25d2dc4ba731d75aa7c1 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 4 Sep 2014 17:39:22 +0800 Subject: [PATCH 3/4] Fix Cl build suggestion --- js/bootstrap-formhelpers-number.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/js/bootstrap-formhelpers-number.js b/js/bootstrap-formhelpers-number.js index abfc275..e742812 100644 --- a/js/bootstrap-formhelpers-number.js +++ b/js/bootstrap-formhelpers-number.js @@ -166,10 +166,12 @@ value = this.getValue(); - if(this.options.step === undefined) - value = value + 1; - else // if use has specified 'data-step' attribute in tag - value = value + this.options.step; + if(this.options.step === undefined){ + value = value + 1; + } + else{ // if use has specified 'data-step' attribute in tag + value = value + this.options.step; + } this.$element.val(value).change(); }, @@ -179,10 +181,12 @@ value = this.getValue(); - if(this.options.step === undefined) - value = value - 1; - else // if use has specified 'data-step' attribute in tag - value = value - this.options.step; + if(this.options.step === undefined){ + value = value - 1; + } + else{ // if use has specified 'data-step' attribute in tag + value = value - this.options.step; + } this.$element.val(value).change(); }, From 8b84c4cc925f563c41c90b5f34f1665e44933ef8 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 4 Sep 2014 17:46:21 +0800 Subject: [PATCH 4/4] Fix indentation issue detected by Cl build --- js/bootstrap-formhelpers-number.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/js/bootstrap-formhelpers-number.js b/js/bootstrap-formhelpers-number.js index e742812..eb6e0d4 100644 --- a/js/bootstrap-formhelpers-number.js +++ b/js/bootstrap-formhelpers-number.js @@ -166,12 +166,12 @@ value = this.getValue(); - if(this.options.step === undefined){ - value = value + 1; - } - else{ // if use has specified 'data-step' attribute in tag - value = value + this.options.step; - } + if(this.options.step === undefined){ + value = value + 1; + } + else{ // if use has specified 'data-step' attribute in tag + value = value + this.options.step; + } this.$element.val(value).change(); }, @@ -181,12 +181,12 @@ value = this.getValue(); - if(this.options.step === undefined){ - value = value - 1; - } - else{ // if use has specified 'data-step' attribute in tag - value = value - this.options.step; - } + if(this.options.step === undefined){ + value = value - 1; + } + else{ // if use has specified 'data-step' attribute in tag + value = value - this.options.step; + } this.$element.val(value).change(); },