mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-04 22:16:08 +00:00
Replace bulk quantity label with input field
Enable the user to enter a number directly.
This commit is contained in:
@@ -34,6 +34,10 @@ Darkswarm.controller "ShopVariantCtrl", ($scope, $modal, Cart) ->
|
||||
wantedQuantity = variant.line_item.max_quantity + quantity
|
||||
$scope.quantityValid(wantedQuantity) && variant.line_item.quantity > 0
|
||||
|
||||
$scope.available = ->
|
||||
variant = $scope.variant
|
||||
variant.on_demand && Infinity || variant.on_hand
|
||||
|
||||
$scope.quantityValid = (quantity) ->
|
||||
variant = $scope.variant
|
||||
minimum = 0
|
||||
|
||||
@@ -16,8 +16,7 @@
|
||||
%button.bulk-buy-add.variant-quantity{type: "button", ng: {click: "add(-1)", disabled: "!canAdd(-1)"}}>
|
||||
-# U+FF0D Fullwidth Hyphen-Minus
|
||||
-
|
||||
%span.bulk-buy.variant-quantity>
|
||||
{{ variant.line_item.quantity }}
|
||||
%input.bulk-buy.variant-quantity{type: "number", min: "0", max: "{{ available() }}", ng: {model: "variant.line_item.quantity"}}>
|
||||
%button.bulk-buy-add.variant-quantity{type: "button", ng: {click: "add(1)", disabled: "!canAdd(1)"}}
|
||||
-# U+FF0B Fullwidth Plus Sign
|
||||
+
|
||||
@@ -28,8 +27,7 @@
|
||||
%button.bulk-buy-add.variant-quantity{type: "button", ng: {click: "addMax(-1)", disabled: "!canAddMax(-1)"}}>
|
||||
-# U+FF0D Fullwidth Hyphen-Minus
|
||||
-
|
||||
%span.bulk-buy.variant-quantity>
|
||||
{{ variant.line_item.max_quantity }}
|
||||
%input.bulk-buy.variant-quantity{type: "number", min: "0", max: "{{ available() }}", ng: {model: "variant.line_item.max_quantity"}}>
|
||||
%button.bulk-buy-add.variant-quantity{type: "button", ng: {click: "addMax(1)", disabled: "!canAddMax(1)"}}
|
||||
-# U+FF0B Fullwidth Plus Sign
|
||||
+
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
.reveal-modal.product-bulk-modal {
|
||||
width: 26em;
|
||||
width: 27em;
|
||||
}
|
||||
|
||||
// Components to add variants to cart and change quantities
|
||||
@@ -89,14 +89,17 @@ button.bulk-buy-add.variant-quantity {
|
||||
width: 2.5rem;
|
||||
}
|
||||
|
||||
span.bulk-buy.variant-quantity {
|
||||
input[type="number"].bulk-buy.variant-quantity {
|
||||
border: .1em solid $grey-200;
|
||||
height: 2.5rem;
|
||||
display: inline-block;
|
||||
min-width: 3em;
|
||||
width: 5em;
|
||||
padding: .5em;
|
||||
text-align: center;
|
||||
vertical-align: top;
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
|
||||
.variant-bulk-buy-price-summary {
|
||||
|
||||
Reference in New Issue
Block a user