mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Disabling scroll increment/decrement on Number inputs
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
Darkswarm.directive "ofnDisableScroll", ()->
|
||||
restrict: 'A'
|
||||
|
||||
link: (scope, element, attrs)->
|
||||
element.bind 'focus', ->
|
||||
element.bind 'mousewheel', (e)->
|
||||
e.preventDefault()
|
||||
element.bind 'blur', ->
|
||||
element.unbind 'mousewheel'
|
||||
@@ -49,6 +49,7 @@
|
||||
%input{type: :number,
|
||||
value: nil,
|
||||
min: 0,
|
||||
"ofn-disable-scroll" => true,
|
||||
max: "{{product.on_demand && 9999 || product.count_on_hand }}",
|
||||
name: "variants[{{product.master.id}}]",
|
||||
id: "variants_{{product.master.id}}",
|
||||
@@ -58,6 +59,7 @@
|
||||
%span{"ng-show" => "product.group_buy && (product.variants.length == 0)"}
|
||||
%input{type: :number,
|
||||
min: 0,
|
||||
"ofn-disable-scroll" => true,
|
||||
max: "{{product.on_demand && 9999 || product.count_on_hand }}",
|
||||
name: "variant_attributes[{{product.master.id}}][max_quantity]",
|
||||
"ng-model" => "product.max_quantity"}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
%input{type: :number,
|
||||
value: nil,
|
||||
min: 0,
|
||||
"ofn-disable-scroll" => true,
|
||||
max: "{{variant.on_demand && 9999 || variant.count_on_hand }}",
|
||||
name: "variants[{{variant.id}}]", id: "variants_{{variant.id}}",
|
||||
"ng-model" => "variant.quantity"}
|
||||
@@ -13,6 +14,7 @@
|
||||
%span{"ng-show" => "product.group_buy"}
|
||||
%input{type: :number,
|
||||
min: 0,
|
||||
"ofn-disable-scroll" => true,
|
||||
max: "{{variant.on_demand && 9999 || variant.count_on_hand }}",
|
||||
name: "variant_attributes[{{variant.id}}][max_quantity]",
|
||||
"ng-model" => "variant.max_quantity"}
|
||||
|
||||
Reference in New Issue
Block a user