mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-31 06:31:41 +00:00
Disabling enter on the search
This commit is contained in:
@@ -3,6 +3,11 @@ angular.module("Shop").controller "ProductsCtrl", ($scope, $rootScope, Product,
|
||||
$scope.order_cycle = OrderCycle.order_cycle
|
||||
Product.update()
|
||||
|
||||
$scope.searchKeypress = (e)->
|
||||
code = e.keyCode || e.which
|
||||
if code == 13
|
||||
e.preventDefault()
|
||||
|
||||
$scope.productPrice = (product) ->
|
||||
if product.variants.length > 0
|
||||
prices = (v.price for v in product.variants)
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
%products{"ng-controller" => "ProductsCtrl", "ng-show" => "order_cycle.order_cycle_id != null"}
|
||||
= form_for :order, :url => populate_orders_path, html: {:class => "custom"} do
|
||||
%input#search.text{"ng-model" => "query", placeholder: "Search"}
|
||||
|
||||
%input#search.text{"ng-model" => "query", placeholder: "Search", "ng-keypress" => "searchKeypress($event)"}
|
||||
%input.button.right{type: :submit, value: "Add to Cart"}
|
||||
|
||||
%table
|
||||
%thead
|
||||
%th.name Item
|
||||
|
||||
Reference in New Issue
Block a user